Re: (Re)ordering stuff

2006-07-21 Thread Martin Robinsson
"reorder stuff" is quite vague... If you mean specifying the order of and which fields should appear on the admin page you can do that using the ´´fields´´ parameter to Admin as is shown in tutorial 2: http://www.djangoproject.com/documentation/tutorial2/ If you want to control the order in which

Re: ManyToManyField Usage

2006-07-23 Thread Martin Robinsson
Hi Minglei, First of all I think I would rename "author" in Album to "authors" to reflect the fact that there can be many authors. You could use something like this: objalbum, created = Album.objects.get_or_create(name=album) objalbum.authors.add(objauthor) or objauthor.album_set.get_or_create(nam

Re: ManyToManyField Usage

2006-07-23 Thread Martin Robinsson
Minglei Wang wrote: > [...] > when i want to get or create a song object in album like following, the > second parameter (album=objalbum) must be put on. > Otherwise it would report an error: album_id must not be null. > > song, created = objalbum.song_set.get_or_create(name=name, album=objalbum)

Re: Getting foreign relationship data in views

2006-07-24 Thread Martin Robinsson
Hi Not sure I completely get your code. If client_search initially is a variable holding a string I assume you're aware that declaring a function with the same name will override the original variable... When you write ´´first_name__icontains=client_search´´, is client_search supposed to hold a st

Re: ManyToManyField Usage

2006-07-24 Thread Martin Robinsson
Hi Minglei, Sorry for the digression. At first I thought you only wanted to solve your immediate problem of how to add records to a many-to-many relation to be able to move on. I understand now that you also wonder why one has to specify the album a second time when the objalbum.song_set should be

Re: list_display: How to change the label for each field

2006-07-24 Thread Martin Robinsson
Hi Alen Kilian showed how you can change the displayed name of your models. If in addition you want to specify how your fields are displayed please see: http://www.djangoproject.com/documentation/model_api/#verbose-field-names Martin --~--~-~--~~~---~--~~ You rec

Re: How to read parameters

2006-07-24 Thread Martin Robinsson
You might want to consult this page: http://www.djangoproject.com/documentation/request_response/#examples Martin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send em

Re: ManyToManyField Usage

2006-07-29 Thread Martin Robinsson
Sorry for the bump. But I'm genuinly interested in understanding why it's not possible to write: >>> album.song_set.get_or_create(name='name', album=album) without specifying the album explicitly as a kw argument. Shouldn't the album parameter in this example be inferred through the album.song_set