> The Project and ProjectUnits are defined before the Crews are > assigned, but when assigning a Crew to a ProjectUnit I'd like to know > if the Crew is already scheduled to work that day. That's allowed, > but I'd like a confirmation alert when this happens, or ideally, have > the droplist for crew in the admin show a * (or any indicator) next to > everyone already on assignment that day. > > Any suggestions for doing this would be appreciated. If the above > isn't possible, pointers to doing this type of thing outside the admin > interface would be helpful. Thanks,
Here are two offhand suggestions that won't require much effort, although both are hackish. 1. If you're not using the __str__() method in your Crew model for anything important (and if you have small database) you could insert an asterisk there and it will show up in your drop-down list:: def is_working_today(self): # untested code...returns true if the crew # has any other projectunits assigned today return bool( self.projectunit_set.filter( day=datetime.date.today())) def __str__(self): return is_working_today() and '*'+ crew_name or crew_name 2. Or, if you have a lot of crew entries in your database, you could use raw_id_admin [1]_ to pop-up the list of crew members and put is_working_today in your list_display [2]_ which will give you a quick yes-or-no view. .. [1] http://www.djangoproject.com/documentation/model-api/#many-to-one-relationships .. [2] http://www.djangoproject.com/documentation/model-api/#list-display Maybe someone else will have a suggestion that makes mine look silly. Either way, good luck! - whiteinge --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---