Re: How to use month/date/year menus for date?
Sean Schertell wrote: (...) > In my view, I'm using FormWrapper and that automatically makes a text > field for the date where the user is expected to enter the date as > -mm-dd. Personally, I think that's not the most user friendly way > to collect a date from the user. I like the more typical method of > having three select menus: one for month, one for date, and one for > year. > > The question is, how can I get those three menus to create a single > date object that plays nice with Django? I think that writing CustomForm with SelectFields would be good idea. Next in views or in overwritten save() method, you could join data from those fields into one date field and save it. See in django source how is written ChangeManipulator. Regards, Jakub --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: problem with filtering data
Thanks for answer Finally I get correct result, using objects.extra method: Service.objects.extra(where=['sms_service.id not in (select sms_userservices.service_id from sms_userservices where sms_userservices.user_id = 9)'],tables=['sms_userservices']).distinct() Maybe not so clean and tasty but works. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
problem with filtering data
Hi there, I've looked for some clue on this group but nothing similar for my case. I've got the following models: class Service: name = ... class TimeTable: ... class UserService: user = ForeignKey(User) service = ForeignKey(Service) timetable = ForeignKey(TimeTable) I've tried to get list of service that aren't used by selected user, in this way: cursor.execute("SELECT sms_service.name FROM sms_service WHERE sms_service.id NOT IN (SELECT sms_userservices.service_id FROM sms_userservices WHERE sms_userservices.user_id = 9)"), it's in dirty sql. I was trying use filter and exclude, but didn't get correct results. Service.objects.exclude(userservices__user__id=9) return empty list, I'm sure that I've some service that aren't used by this user. I don't know why that didn't work for me, so could sombody show me how to rewrite this piece of sql code into django right way? Greets, Jakub --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---