Your query can be translated into the ORM by simply using '__gt' and
'__lt' on your start_date and ends_date.

Regards
Knut

2010/11/8 Rogério Carrasqueira <rogerio.carrasque...@gmail.com>:
> Hello Everybody!
>
> I'm developing a routine that will control the information about scheduled
> events and it will avoid that some events override others and prevent that
> it cannot happen. I made a query on mysql where that works fine and gives
> the results that I need. For example I have an event that begins at 05
> november and ends at 22 november, it must lock the agenda to prevent another
> event in this date range, so if I try to insert a new event that will hapens
> on 09 november and ends at 14 november, the system will return a message
> reporting that this operation cannot be done due the collision with another
> event previously scheduled.
>
> My goal is translate this query to ORM Django: select * from my_table  where
> ('2010-11-09' between start_date AND ends_date) or ('2010-11-14' between
> start_date AND ends_date )
>
> I've tried with range atribute but I was'n happy on this way
>
> Someone can help?
>
> Thanks so much!
>
> Rogério Carrasqueira
>
> ---
> e-mail: rogerio.carrasque...@gmail.com
> skype: rgcarrasqueira
> MSN: rcarrasque...@hotmail.com
> ICQ: 50525616
> Tel.: (11) 7805-0074
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to