Django has DateRangeField but that is only available if you are using 
postgres

On Monday, October 8, 2018 at 1:10:04 PM UTC+2, Shareef 617 wrote:
>
> 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/051e2658-0a5a-4002-a973-dcb12bc04b9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to