No one? On Mar 16, 10:05 pm, AJ <[email protected]> wrote: > I have a model like this: > > class Post (models.Model): > name = models.CharField(max_length=1000, help_text="required, name > of the post") > description = models.TextField(blank=True) > custom_hashed_url = models.CharField(unique=True, max_length=1000, > editable=False) > > def save(self, *args, **kwargs): > #How to save User here? > super(Model, self).save() > > View code: > > if not errors: > f = PostForm(request.POST) > f.save() > > There is an old post that I followed but could not do it. And also > this post is > old.http://www.b-list.org/weblog/2006/nov/02/django-tips-auto-populated-f... > > Even though I have the user field as FK, I get this error: 'Cannot > assign None: "MyModel.user" does not allow null values.' > > This essentially means (IMHO) that my View does not send the User > along. How can I auto populate the user field with Django User, the > currently logged in user.
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

