Yeah, you want to assign that user_id value in the view, when you're
saving the instance:
mydocument.author_id = request.user.id
mydocument.save()
Are you trying to solve for a case where you want the current *admin*
user to be the author_id for the record? You can also add a save
metho
FT wrote:
> class Document(models.Model):
>
> created = models.DateTimeField(
> help_text='Timestamp when the document is created',
> blank=True,
> default=datetime.datetime.now)
>
> author = models.EmailField(blank=True, default=request.user)
>
> Hi there,
>
> I'm tryi
No. Request object does not exist when model classes are created.
On Fri, Nov 21, 2008 at 13:47, FT <[EMAIL PROTECTED]> wrote:
>
> class Document(models.Model):
>
>created = models.DateTimeField(
>help_text='Timestamp when the document is created',
> blank=True,
>default=date
class Document(models.Model):
created = models.DateTimeField(
help_text='Timestamp when the document is created',
blank=True,
default=datetime.datetime.now)
author = models.EmailField(blank=True, default=request.user)
Hi there,
I'm trying to set up a default value the a
4 matches
Mail list logo