2008-8-19
| 23:30 | DigitalVibe | what would be the best way to extract the id field from a queryset into the format [1, 2, 4, 5] ? |
| 23:31 | mattmcc | values_list |
| 23:32 | mile1 | hi - i'm looking for tip on using inline ManyToMany fields in the admin interface. I've got a Task model that can be assigned to a User in the admin. I'd like the selection of Users available in the admin UI to be a subset of all the Users of the website. Any suggestions on how that might be done? Many thanks in advance... |
| 23:32 | DigitalVibe | mattmcc: thanks muchly. i'm having trouble finding my way through the documentation tonight... i've been up working, in meetings, etc for 16 hours :S |
| 23:33 | Zalamander | mile1 I dunno, I recently tried that, using the limit_choices_to parameter when defining the M2M, but it didn't have any affect. I'm not sure if I did something wrong, or if it's broken. |
| 23:34 | shivraj | anyone know what this is ? http://dpaste.com/72561/ |
| 23:34 | shivraj | something about bad magic number in newforms |
| 23:35 | Zalamander | shivraj hm, sounds like your pyc file may be corrupted somehow. Remove /usr/lib/python2.5/site-packages/django/newforms/__init__.pyc and try again. |
| 23:36 | mile1 | shivraj - i ran into the same problem & solved it by removing the pyc files, which were out of date |
| 23:36 | mile1 | i suspect it had something to do with me switching back and forth between nfa and pre-nfa |
| 23:37 | Magus- hugs vimpager | |
| 23:37 | Magus- | </random> |
| 23:37 | shivraj | ok cause its saying something else ... let me remove all of the .pyc |
| 23:37 | mile1 | Zalamander - thanks. i'm not familiar with limit_choices_to_parameter. i'll need to check that out (though if it didn't work for you....) |
| 23:38 | Zalamander | that's a lot of pyc's :-) |
| 23:38 | mile1 | yep :-) |
| 23:38 | Zalamander | mile1 yeah, I tried limit_choices_to={'is_superuser':(False,)} maybe I need to use 0 instead of False |
| 23:39 | shivraj | Zalamander : where ? |
| 23:39 | shivraj | I onlyremoved the ones in newforms |
| 23:39 | Zalamander | shivraj where what? |
| 23:39 | shivraj | nwo I get this error http://dpaste.com/72563/ |
| 23:40 | shivraj | which .pyc files do I remove ? |
| 23:40 | Zalamander | shivraj it looks like you got all the bad ones. |
| 23:41 | mile1 | Zalamander - i think you're on to something. using limit_choices_to={'username': 'mynamehere'} worked as expected |
| 23:41 | sol1dus | /join #debianeee |
| 23:41 | mile1 | now to try the group filtering.... |
| 23:41 | Magus- | limit_choices_to cannot be dynamic though |
| 23:41 | sol1dus | oops.. |
| 23:41 | Zalamander | mile1 eh, good to know, lemme see if my boolean change works |
| 23:42 | t3mp3st | if I have two models, joined by a OneToOneField, and I delete one of them-- will the delete cascade to the other? |
| 23:42 | Magus- | only if you delete the one without the 1-1 field |
| 23:42 | mile1 | Magus - thanks for the tip |
| 23:42 | mile1 | any other ideas/approaches? |
| 23:42 | mile1 | i'd like to filter by group membership |
| 23:43 | t3mp3st | Magus-: is this a general rule of thumb-- that deleting the object lacking the relation field cascades to the one with the field? |
| 23:43 | Magus- | mile1: I have no solution for you |
| 23:43 | Magus- | I just know that option won't work |
| 23:43 | shivraj | mile1 : I have to delete all .pyc files in django ?? |
| 23:43 | mile1 | ok - thanks anyway |
| 23:43 | FunkyBob | ~. |
| 23:43 | Magus- | t3mp3st: yes, that's how cascading works |
| 23:43 | Magus- | it doesn't go the other way |
| 23:43 | Magus- | the cascade is because you would otherwise have a hanging relationship |
| 23:43 | Magus- | like fkey_id = 3, but id = 3 is deleted |
| 23:43 | Magus- | but if you delete the one /with/ the relationship, nothing is left hanging |
| 23:43 | t3mp3st | okay, that certainly makes sense :P |
| 23:44 | Zalamander | mile1 ah, I got it, I needed to use False, not (False,). I was too caught up in mimicing the example, which uses a containment test. |
| 23:44 | t3mp3st | thanks Magus-, as always! |
| 23:44 | shivraj | I think I should remove Django and reinstall a new copy |
| 23:44 | mile1 | shivraj - yes - i used the find command |
| 23:44 | Magus- | shivraj: you do actually have that view mapped as a url, yes? |
| 23:46 | shivraj | Magus- : which one ? registration_complete ? |
| 23:47 | Magus- | no, one that isn't erroring... |
| 23:47 | Magus- | x.x |
| 23:47 | Magus- | of course that one :รพ |
| 23:47 | shivraj | heh |
| 23:47 | Magus- | we're looking for a url name of that btw, not a view name |
| 23:47 | shivraj | well its in accounts/ |
| 23:47 | Magus- | but does it actually have that name? |
| 23:47 | mile1 | Zalamander - good to know - i'll watch out for that |
| 23:48 | Zalamander | yeah, beware stupidity :-) |
| 23:49 | shivraj | let me check, I installed the other apps it was complaining abt reverse for |
| 23:51 | shivraj | return HttpResponseRedirect(success_url or reverse('registration_complete')) |
| 23:52 | shivraj | so I have to put success_url in urls.py ? or where exactly should this registration_complete view go ? |
| 23:54 | shivraj | will it go to the first url with a registration_complete view in it ? |
| 23:58 | webar7 | whoa neato --> http://code.nytimes.com/projects/dbslayer |
Page 39 of 39
← Previous
(3,866 total)