Answers for "foreign key django createview"

0

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)
Posted by: Guest on September-19-2020

Python Answers by Framework

Browse Popular Code Answers by Language