list editabale error
Posted
by ha22109
on Stack Overflow
See other posts from Stack Overflow
or by ha22109
Published on 2010-04-20T10:11:55Z
Indexed on
2010/04/20
11:03 UTC
Read the original article
Hit count: 358
Hello all,
I m using django 1.1 beta.I m facing porblem in case of list_editable.First it was throughing exception saying
need ordering in case of list_editable"
then i added ordering in model but know it is giving me error.The code is working fine with django1.1 final.
here is my code
model.py
class User(models.Model):
advertiser = models.ForeignKey(WapUser,primary_key=True)
status = models.CharField(max_length=20,choices=ADVERTISER_INVITE_STATUS,default='invited')
tos_version = models.CharField(max_length=5)
contact_email = models.EmailField(max_length=80)
contact_phone = models.CharField(max_length=15)
contact_mobile = models.CharField(max_length=15)
contact_person = models.CharField(max_length=80)
feedback=models.BooleanField(choices=boolean_choices,default=0)
def __unicode__(self):
return self.user.login
class Meta:
db_table = u'roi_advertiser_info'
managed=False
ordering=['feedback',]
admin.py
class UserAdmin(ReadOnlyAdminFields, admin.ModelAdmin):
list_per_page = 15
fields = ['advertiser','contact_email','contact_phone','contact_mobile','contact_person']
list_display = ['advertiser','contact_email','contact_phone','contact_mobile','contact_person','status','feedback']
list_editable=['feedback']
readonly = ('advertiser',)
search_fields = ['advertiser__login_id']
radio_fields={'approve_auto': admin.HORIZONTAL}
list_filter=['status','feedback']
admin.site.register(User,UserADmin)
© Stack Overflow or respective owner