I have a django model and a ModelForm. The model has about 10 fields, but I only want to show a few with the ModelForm for the user. So I have something like this:
class Create_EventForm(ModelForm): class Meta: model = Event fields = ['event_name','event_datetime','event_venue','event_url','event_tags','event_zip','event_category','event_description']
However, I can't create an object based on this data, because there are still missing fields. When I receive the data via POST in my view I am doing one of these:
if request.user.is_authenticated: if request.POST: f = Create_EventForm(request.POST) if f.is_valid(): ne = f.save()
What I want to do is right before the f.save() I want to do lookups based on existing data I have to pull in other data I need for the model and create the object. Any idea how this can be done?