views:

38

answers:

2

Hi all,

How can we create read-only or the non-editable fields in the admin panel? Following is a code snippet from my model:

class AnswerVote(db.Model):
   answer = db.ReferenceProperty(Reply,required = True,editable= False)
   vote = db.BooleanProperty(default = False,editable= False)
   voter = db.ReferenceProperty(User,editable= False)

I have tried editable = False and readonly_fields but nothing seems to work.

I am getting an error message: __init__() got an unexpected keyword argument 'editable'.

Do these things not work on App engine? and if yes, is there an alternative for the same?

Please suggest.

Thanks in advance.

A: 

These things don't work in Google App Engine, since GAE is based on Django 0.96, and readonly_fields and editable = False were part of Django 1.2.

Dominic Rodger
Yes Dominic, I saw that in the documentation. Is there any alternative to these ?
anand
+1  A: 

Your datastore models aren't used by the admin console. The admin consoles (both local and production) use the low-level datastore module to read your datastore directly, so there's no way to specify things in your model that affect them.

Nick Johnson
thanks for your reply Nick. I am actually talking about the admin panel of the Django framework and not the admin console of the Google application engine.
anand
I am using Django with Google app engine and want to make some of the model fields to be non-editable in the admin panel of Django itself.
anand
isn't there any way to to this in Google app engine?
anand
I'm not familiar with Django, so I'm the wrong person to ask, sorry.
Nick Johnson