I am using CreateWithInlinesView
from django-extra-views
. How would I go about retrieving the current user in this case?
I have something like this currently
class PublisherCreateView(CreateWithInlinesView):
model = Publisher
inlines = [BookInline,]
def form_valid(self, form, inlines):
form.instance.created_by = self.request.user
return super(PublisherCreateView, self).form_valid(form, inlines)
and this still returns the error of (1048, "Column 'created_by_id' cannot be null")
.
edit: made my edit into an answer