An easier way to set the current user in the submitted form is to use
Django signals:
from django.db.models.signals import pre_save
from mezzanine.forms.models import Form
from mezzanine.core.request import current_request
#...
@receiver(pre_save, sender=Form)
def form_set_user(sender, instance, **kwargs):
request = current_request()
user = getattr(request, 'user') if request else None
if user.is_authenticated():
instance.user = user
This assumes that you have added the field "user" to class Form using
EXTRA_MODEL_FIELDS.
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.