Questions tagged [generic-relations]

35 questions
0
votes
1 answer

generic relation model declaration

Just a quick noob question. Do I need to have content_type, object_id, and content_object every time I use GenericRelation in models? I get the concept behind generic relation but I'm confused on how to implement it. Below is the setup. Address - a…
Wreeecks
  • 2,186
  • 1
  • 33
  • 53
0
votes
1 answer

In Django how to create references to different models & being agnostic about what model it is?

I am relatively new to Django/Pinax & I am faced with this peculiar situation. Say I have a model "Vehicle". Now each instance of "Vehicle" has some attributes pertaining to the "vehicle" but it also has a reference to instance of one of…
Chantz
  • 5,883
  • 10
  • 56
  • 79
0
votes
0 answers

Generic relations vs. iterating on objects in Django

I have three models called Post, Category and Flag. I let users to make a Flag on each Post which is tagged with a Category. Now I want to list all of Flags, related to Posts on a certain Category. I've found two ways of doing it using ListView…
0
votes
3 answers

Help with understanding generic relations in Django (and usage in Admin)

I'm building a CMS for my company's website (I've looked at the existing Django solutions and want something that's much slimmer/simpler, and that handles our situation specifically.. Plus, I'd like to learn this stuff better). I'm having trouble…
saturdayplace
  • 8,370
  • 8
  • 35
  • 39
-1
votes
2 answers

Associate model classes Django with instances of another model

Heavily edited in response to comment by @Todor. [I use Django 1.7.6 and Python 3.4.1.] — So in my Django project I've defined an Item model with various specific subclassing models. I've also defined a Category model. A toy version of my models…
1 2
3