-
Remove user field from rendered form (using
excludeorfields, https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#selecting-the-fields-to-use )class CandidateForm(forms.ModelForm): class Meta: model = Candidate exclude = ["user"] -
Find user profile and set user field in the create view.
class CandidateCreateView(CreateView): ... def form_valid(self, form): candidate = form.save(commit=False) candidate.user = UserProfile.objects.get(user=self.request.user) # use your own profile here candidate.save() return HttpResponseRedirect(self.get_success_url())