If I am not mistaken, editable=False is only applicable to the admin- forms. Simply create a view that checks to see if the user is a superuser and then give them a form to add an email address.
peace, -r On Aug 10, 7:59 pm, Russell Blau <[EMAIL PROTECTED]> wrote: > I am working on an application that includes the following in > models.py: > > class UserEmail(models.Model): > email = models.EmailField("email address", unique=True, > editable=False) > user = models.ForeignKey(UserRegistration) > > # an email address can only be associated with one user, and can > never > # be deleted > # once assigned to a user, it can be shifted to another user only > by > # manual intervention by an administrator > > def delete(self): > "Deletion of email addresses is not permitted" > warnings.warn("Attempt to delete registered email %s > rejected." > % self.email) > > def __str__(self): > return self.email > > class Admin: > pass > > Basically, I want to keep track of every email address that has ever > been registered with my app, to prevent duplication. By overriding > delete(), I prevent any address from being removed from the database, > but I also have to prevent editing the address once it has been > registered. The problem is that "editable=False" works too well -- it > prevents an admin from editing an existing address, but also prevents > them from adding new ones. Is there a way to set up my model so that > the administrator can enter new email addresses for a user, but cannot > change the existing ones? > > Russ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---