Consider a project where users can have many cards (or anything else, card 
is just an example), and the same card can belong to multiple users *but 
only in different time periods*. So if a card is assigned to user from 
1.09.2014 to 1.10.2014 (dd/mm/yyyy), then the same card can be assigned to 
another user but only for time period that ends before 1.09.2014 or starts 
after 1.10.2014. I hope you get it.

I've created the following models:

class User(models.Model):
    cards = models.ManyToManyField(Card, through="UsersCards")

class UsersCards(models.Model):
    user = models.ForeignKey(User)
    card = models.ForeignKey(Card)
    start_date = models.DateField()
    end_date = models.DateField()

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/19c50b68-2ceb-407c-a955-0f5931d9ed5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to