Klucz zagraniczny 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)
Mfathi128