hi all, I've this model:

from django.core import meta
from django.models.auth import User

class Article(meta.Model):
        title = meta.CharField(maxlength=255)
        content = meta.TextField()
        author = meta.ForeignKey(User) // problem is here, I think
        categories = meta.ManyToManyField(Category)
        creation_date = meta.DateTimeField('creation date', auto_now_add=True)
        mod_date = meta.DateTimeField('modification date', auto_now=True)
        file = meta.FileField(upload_to='/Users/go/Sites/django/files/')

        class META:
                admin = meta.Admin(
                        fields = (
                                (None, {'fields': ('title', 'content', 
'categories')
                                }),
                        ),
                )

How can I save the field 'author' with the id of current user? I think
to use 'default' attribute, something like this:
        author = meta.ForeignKey(User, default=???)
but how can I get current uesre's id? (user.id doesn't work)

Thanks,
Flavio Curella

Reply via email to