django - python models.py throwing error -


i updated models.py , getting error.. error thrown:

validating models...

unhandled exception in thread started <bound method command.inner_run of <django.contrib.staticfiles.management.commands.runserver.command object @ 0x9eb5dec>> traceback (most recent call last):   file "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 91, in inner_run     self.validate(display_num_errors=true)   file "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 266, in validate     num_errors = get_validation_errors(s, app)   file "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 30, in get_validation_errors     (app_name, error) in get_app_errors().items():   file "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 158, in get_app_errors     self._populate()   file "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 64, in _populate     self.load_app(app_name, true)   file "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 88, in load_app     models = import_module('.models', app_name)   file "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module     __import__(name)   file "/home/vaibhav/trac/bright-coupons/brightcoupons/brightcouponsapp/models.py", line 75, in <module>     admin.site.register(couponvotes, couponvotesadmin)   file "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py", line 74, in register     model in model_or_iterable: typeerror: 'classobj' object not iterable 

whenever try run python manage.py runserver

and models.py:

from django.db import models django.contrib import admin  #------------------------------------------------------------------------------   class store(models.model):      storename = models.charfield(max_length=30)          # store name   class coupon(models.model):          coupondescription = models.textfield()               # coupon description     active =  models.booleanfield(default=true)     couponcode = models.charfield(max_length=30)     couponstore = models.charfield(max_length=30)        # store name     featured =  models.booleanfield(default=false)     coupontitle = models.charfield(max_length=100)       # coupon title     updatedat = models.datetimefield(auto_now=true)     createdat = models.datetimefield(auto_now=true)     lasttested = models.datefield(auto_now_add=true)     # when coupon last tested     localcouponid = models.charfield(max_length=30,primary_key=true)   class commentcoupons(models.model):     couponid = models.charfield(max_length=20)                        # couponid form couponrestapiapp      class meta:         """meta class control display behavior of model name """         verbose_name_plural = "commentcoupons"      def __unicode__(self):         """method display string correctly"""         return unicode(self.couponid)   class couponvotes():     success = models.integerfield()                      # count of number of times people have made work     failure = models.integerfield()                      # count of number of times has failed         couponid = models.onetoonefield(commentcoupons)  class comments(models.model):      comment = models.textfield()     addedon = models.datefield(auto_now=true)     username = models.charfield(max_length=30)     commentcoupon = models.foreignkey(commentcoupons)         class meta:         """meta class control display behavior of model name """         verbose_name_plural = "comments"      def __unicode__(self):         """method display string correctly"""         return unicode(self.comment)   class commentcouponsadmin(admin.modeladmin):     list_display = ('couponid',)  class commentsadmin(admin.modeladmin):     list_display = ('comment','addedon','username','commentcoupon',)  class couponadmin(admin.modeladmin):     list_display = ('coupontitle','coupondescription','couponcode',                     'couponstore','updatedat',                     'createdat','localcouponid','active','featured')  class couponvotesadmin(admin.modeladmin):     list_display = ('success','failure',)  admin.site.register(coupon,couponadmin) admin.site.register(comments, commentsadmin) admin.site.register(couponvotes, couponvotesadmin) admin.site.register(commentcoupons,commentcouponsadmin)  #------------------------------------------------------------------------------ 

i did not understand happened added new model couponvotes , error occurred why?

your class couponvotes not inherit models.model.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -