Here is my model :
from django.db import models
from django.contrib.auth.models import User
from hsf.middleware import threadlocals

class DonorProfile(models.Model):
    owner = models.ForeignKey(User,related_name="owner",blank=True,
editable=False)
    last_edited_by =
models.ForeignKey(User,related_name="last_edited_by",blank=True,
editable=False)
    title = models.CharField(maxlength=60)
    text = models.TextField()
    time_created = models.DateTimeField( auto_now=True )
    published = models.BooleanField( default = False )
 # Set the owner and last_edited_by when appropriate
    def save(self):
        # If the object already existed, it will already have an id
        if self.id:
            # This object is being edited, not saved, set
last_edited_by
            self.last_edited_by = threadlocals.get_current_user()
        else:
            # This is a new object, set the owner
            self.owner = self.last_edited_by =
threadlocals.get_current_user()
        super(DonorProfile,self).save()

    class Admin:
        pass
        list_display = ('title','owner','time_created')

All what i want is to make the published field to appear for certain
user only in the admin interface
is there in way to do that with django pleasssssee


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