bj, form, change)
if not change:
tag = Tags.objects.get(pk=2)
obj.tag.add(tag)
#the best part - not asserting anything
#assert null
What's going on behind the scene? I'm runnin' out of ideas, please,
help.
> On Feb 4, 3:04 pm,
>On 4 Lut, 20:52, koenb wrote:
> Shouldn't this be obj.tags.add(tag) ? (your m2mfield is called tags
> not tag)
Typo... It actually should say obj.tag.add(tag) - I wasn't pasting
this code, wrote it by hand ;)
Actual code has no syntax errors :)
--~--~-~--~~~---~--~--
On 4 Lut, 20:24, garagefan wrote:
> From my limited understanding of Django...
>
> the admin.py stuff should not contain any save function.
>
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-a...
Hmm, take a look at this then:
http://docs.djangoproject.com/en/dev/ref/contrib
Thanks for the answer,
I modified my Game model according to your suggestion, and also,
simplified whole thing.
I can create new game without having to choose any tags - that's
correct. Now, take a look at
the save_model() method in GamesAdmin - I try to associate newly
created Game with some
tag
This is a huge one:
I want to implement an optional m2m realtionship in django admin
application, so it is possible to create a new Game (model description
below) without choosing any tags associated with it. By default django
form validation returns an error when I try to do such thing. So I
cre
5 matches
Mail list logo