Tagged Questions
4
votes
4answers
6k views
Django: How do I model a tree of heterogeneous data types?
I need to store a tree data structure in my database, for which I plan on using django-treebeard or possibly django-mptt. My source of confusion is that each node could be one of three different ...
3
votes
2answers
359 views
Understanding / mySQL aka tricking ForeignKey relationships in Django
So I've inherited some django.
The mySQL table is simple enough where parent is NOT a FK relationship just the "Parent" id:
CREATE TABLE `Child` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
...
2
votes
3answers
292 views
What's the best way to create a 'history' type model in django?
I'd like to create a feature for my Django app similar to Django admin's 'Recent Actions', in order to store history information on my other models.
For example say I have two models called Book and ...
2
votes
2answers
186 views
How to set up Django models with two types of users with very different attributes
I'm rebuilding and making improvements to an already existing Django site and moving it over from Webfaction to Heroku, and from Amazon's SimpleDB to Heroku Postgres (though testing locally on ...
7
votes
3answers
3k views
Django: Order a model by a many-to-many field
I am writing a Django application that has a model for People, and I have hit a snag. I am assigning Role objects to people using a Many-To-Many relationship - where Roles have a name and a weight. I ...
0
votes
2answers
344 views
Are there performance advantages by splitting a Django model/table into two models/tables?
In SO question 7531153, I asked the proper way to split a Django model into two—either using Django's Multi-table Inheritance or explicitly defining a OneToOneField.
Based Luke Sneeringer's comment, ...
0
votes
2answers
550 views
Designing a database for a user/points system? (in Django)
First of all, sorry if this isn't an appropriate question for StackOverflow. I've tried to make it as generalisable as possible.
I want to create a database (MySQL, site running Django) that has ...
2
votes
2answers
234 views
Comparing two db designs for internal messaging
Which of the following db design would be preferable for an internal messaging system.
Three tables:
MessageThread(models.Model):
- subject
- timestamp
- creator
Message(models.Model):
...
1
vote
2answers
133 views
Returning the current project status (i.e., most recent date on Django ManyToMany relationship)
Schema Description
A project's status can change over time. In order to track the status over time, I've created a many-to-many relationship between the Project model and the ProjectStatusType model ...
1
vote
1answer
80 views
Trouble handling generic relationship in django
I want to model a situation and I´m having real trouble handling it. The domain is like this: There are Posts, and every post has to be associated one to one with a MediaContent. MediaContent can be a ...
1
vote
2answers
300 views
Django: limiting model data
I'm searching in a way to limit the queryset which I can get through a model.
Suppose I have the following models (with dependencies):
Company
|- Section
| |- Employee
| |- Task
| `- more ...
0
votes
2answers
186 views
Many to Many relationships in Django
I am working on a design for some models in Django and wanted to get some advice. I have a model for teams, of which many users can be a part of. The users can also be members of many teams, but ...