I have a simple model like so:
# models.py
class Announcement(models.Model):
    """
    Table containing intranet announcements
    """
    category = models.ForeignKey(AnnouncementCategory)
    user = models.ForeignKey(User)
    text = models.TextField()
    timestamp = models.DateTimeField(auto_now_add=True)

In the admin section I don't want to see the user field when adding/
editing.  So I exclude it like so:
# admin.py
class AnnouncementAdmin(CRUDAdmin):
    """
    Options for the Admin interface
    """
    list_display = ['edit_obj', 'timestamp', 'text', 'added_by',
'delete_obj']
    list_display_links = ['timestamp']
    exclude = ['user']

Now obviously if you try to add a new announcement it will fail since
ther user_id is a required value.  What I want to happen is that the
user adding the announcement will have their user_id inserted with the
announcement.  I couldn't find any way of doing this.  Even if I
create a custom form and override the save method I only have access
to the vairables self and commit.  So as far as I can tell I can't do
this in the Admin.  It looks like I would need to write my own custom
form and view.  Is this correct, or is there another way to do this?

Thanks in advance,
Aaron

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to