please don't shout

On Tue, Mar 8, 2011 at 12:34 AM, pankaj sharma
<new.pankajsha...@gmail.com>wrote:

> same as categories i have to add affiliation to every college.
> so i added
>
> class Affiliation(models.Model):
>    title = models.CharField(max_length=100)
>
>    def __unicode__(self):
>        return self.title
>
> to models.py
>
>
> and  added one more field to class of colleges
>
> class College(models.Model):
>   name = models.CharField(max_length=250)
>   category = models.ForeignKey(Category)
>   city = models.ForeignKey(City)
>   affiliation = models.ForeignKey(Affiliation)            ### i added
> this line to college class in models .py
>
> now i changed my admin.py to this:
>
>
>
> from django.contrib import admin
> from college.models import *
>
> class CollegeAdmin(admin.ModelAdmin):
>    list_display = ('name','category', 'city', 'affiliation')
>    list_filter = ['category', 'city']
>    search_fields = ['name', 'city']
>
>
> class CityAdmin(admin.ModelAdmin):
>    list_display = ('title', 'state')
>    list_filter = ['state']
>    search_fields = ['title',]
>
> admin.site.register(College, CollegeAdmin)
> admin.site.register(City, CityAdmin)
> admin.site.register(State)
> admin.site.register(Category)
> admin.site.register(Affiliation)
>
>
>  but when i use syncdb command it shows no fixtures found
>
> and when i click on college in admin site  then it show me error like
> this
>
>
> OperationalError at /admin/college/college/
> (1054, "Unknown column 'college_college.affiliation_id' in 'field
> list'")
>
>
>
>
> now what to do? do i have to edit some more codes?
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to