On 4 Lut, 21:25, garagefan wrote:
> check out django-tagging. It looks like they're using a custom Manager
> that is handling the creation of new tags based off of an object that
> is using "tags" listing new tags.
Will do.
Meantime, let's take a look again at the weirdest thing:
this DOES work
check out django-tagging. It looks like they're using a custom Manager
that is handling the creation of new tags based off of an object that
is using "tags" listing new tags.
On Feb 4, 3:04 pm, GeneralMean wrote:
> >On 4 Lut, 20:52, koenb wrote:
> > Shouldn't this be obj.tags.add(tag) ? (your m
>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
> def save_model(self, request, obj, form, change):
> super(GamesAdmin, self).save_model(request, obj, form, change)
> if not change:
> #get a tag
> tag = Tags.objects.get(pk=1)
> #associate tag with newly created object
> obj.tag
>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-admin
what exactly are you trying to do with the tag? Your M2M field in the
initial Game class creates the relationship.
You
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
Not totally sure this will help with your error, as i haven't come
across it yet.
But for fields that may be empty I also have a blank = True and null =
True. This is to tell the DB that it is acceptable to have no value in
the field.
ie, i'm using the following to choose add users to a private
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
9 matches
Mail list logo