how to update foreignkey value using class based view in django code example
Example: foreign key django createview
class PhoneCreate(CreateView):
model = Phone
fields = ['number', 'type']
def form_valid(self, form):
form.instance.person_id = self.kwargs.get('pk')
return super(PhoneCreate, self).form_valid(form)