Hi all.

I can add Criterias to a place. How can I add Places to a criteria?

Models:

class Criterias(models.Model):
    name = ...
class Places(models.Model):
    name = ...
class PlacesToCriterias(models.Model):
    content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
    object_id = models.PositiveIntegerField()
    content_object = GenericForeignKey()

    criteria_group = models.ForeignKey(Criterias)

Admin - PLACES part:

class PlaceCriteriasInlineAdmin(GenericTabularInline):
    model = PlacesToCriterias
class PlacesAdmin(admin.ModelAdmin):
    inlines = [PlaceCriteriasInlineAdmin]

admin.site.register(Places, PlacesAdmin)

In this case, when I open Places admin change page, I can add Criterias items 
to my 'place'.

Admin - CRITERIAS part:

class CriteriaPlacesInlineAdmin(GenericTabularInline):
    model = PlacesToCriterias
class CriteriasAdmin(admin.ModelAdmin):
    inlines = [CriteriaPlacesInlineAdmin]

admin.site.register(Criterias, CriteriasAdmin)

In this case, when I open Criterias admin change page, I CAN NOT add Places 
item 
to my 'criteria', because instead of possible places I see criterias.

How to get Places items at Criterias admin page?
Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c0a69075-a933-44cc-946a-451b60a34a10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to