On Mon, Aug 20, 2012 at 4:31 PM, MN TS <mnt...@gmail.com> wrote:

> Hello
> I'm new in Django using 1.4version.
> So got some error.
>
> 'myapp.models.AdversiteImages'> has no ForeignKey to <class 
> 'myapp.models.Adversite'>
>
> *
> MODEL*
>
> class AdversiteImages(models.Model):
>     image = models.FileField(u'Photo' ,
> upload_to='adversiteimage/%Y/%m/%d', null=True, blank=True)
>
> class Adversite(models.Model):
>     category = models.ForeignKey(AdversiteCategory, verbose_name=u'Зарын
> ангилал', related_name='adv_cat', blank=True, null=True)
>     image_many = models.ManyToManyField(AdversiteImages,
> verbose_name=u'Photos',related_name="photos")
>     title = models.CharField(u'Title', max_length=128)
>     body = models.TextField(u'Description')
>
>
> *ADMIN*
>
> class
> AdversiteImagesInline(admin.TabularInline):
>
>     model = Adversite.image_many.through
>     extra = 1
>
> class AdversiteAdmin(admin.StackedInline):
>     fieldsets = ((u'Ерөнхий',
> {'fields':('category','title','body','code')}),
>                  (u'Тайлбар',
> {'fields':('price','phone','email','image1','image2','image3','image4','image5'
>
> ,'is_active','is_special','is_premium','start_at','finish_at')}))
>     list_display = ('category','title','code','is_active','is_special')
>     search_fields = ('category','title','code','is_active')
>     model = Adversite.image_many.through
>
> Please help me.
>
>

Well, this is just a guess, but you are setting the model in the form as
the through attribute of an M2M relationship
and that might the problem, have you tried explicitly declaring the through
parameter in the M2M like it says here?

https://docs.djangoproject.com/en/dev/topics/db/models/#intermediary-manytomany




>  --
> 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.
>



-- 
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

-- 
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