Re: Edit-once object in admin?

2012-04-28 Thread Roy Smith
On Saturday, April 28, 2012 10:35:40 AM UTC-4, Shawn Milochik wrote: > > Override the save() method to raise an exception if "self.id is not > None." > But, that still doesn't tell the admin interface to *show* the fields as read-only (which is really what I'm interested in). If I raise an

Re: Edit-once object in admin?

2012-04-28 Thread Shawn Milochik
I think you have to change your model. Override the save() method to raise an exception if "self.id is not None." This won't prevent developers from using the 'update()' or 'delete()' methods of a queryset, but for a single instance it shouldn't be editable. It will still be able to be

Edit-once object in admin?

2012-04-28 Thread Roy Smith
I've got a model that looks something like this: class Image(Model): name = CharField(max_length=40) class ImageVersion(Model): image = ForeignKey(Image) upload_date = DateTimeField(auto_now_add=True) data = ImageField(upload_to="images/learncms") I want all the data in an