Awesome. Thanks ...

On Feb 5, 1:00 am, r_f_d <[EMAIL PROTECTED]> wrote:
> Sure, you can do it, with two (at least) ways, one is to put this into
> your model so it automatically happens, search the documentation or
> users group for threadlocals middleware.  The other way is to simply
> put it into your view as all views get the request, request.user will
> provide you with what you need.
>
> On Feb 4, 2:48 pm, nikosk <[EMAIL PROTECTED]> wrote:
>
> > I need the default value of a field in a model to be the id of the
> > user creating the new instance of the object the model is modeling
> > ( am I making sense at all?)
>
> > i.e. :
> > class Article(models.Model):
> >     category = models.ForeignKey(Category)
> >     title = models.CharField(max_length=200)
> >     sub_title = models.CharField(max_length=200)
> >     intro_text = models.TextField(blank=True)
> >     main_text = models.TextField()
> >     pub_date = models.DateTimeField(default=datetime.now)
> >     author = models.ForeignKey(User)
>
> > When someone is creating a new Article in the admin app I want the new
> > Article's author field to be the user's id.
>
> > Is that possible ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to