how can i store foreign key value in django view 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)