It seems this is the OneToOneField's fault, but I don't know how to fix it...
2008/6/16 Daniel Kersten <[EMAIL PROTECTED]>:
> Hi yet again,
>
> While I think about the i18n issues, I'm continuing work on other
> aspects of the website and I just ran into another problem.
> I have a feeling I'm using django wrong if I have all these issues! At
> least I'm learning a lot of django in the process :-)
>
> Anyway, it seems I ran into a known issue in the admin interface (it
> cannot currently handle (non-abstract) model inheritance) and they
> plan to have this fixed in the coming months when the admin interface
> has been converted to newforms. So I changed my base model to
> abstract, dropped the existing tables and recreated them. Website
> works grand.
> However, the admin interface is still having problems. When I try to
> save, it gives me this error:
>
> Exception Type: AttributeError
> Exception Value: 'PrimaryLevelAdvertiser' object has no attribute 'get'
> Exception Location:
> /usr/lib/python2.5/site-packages/django/db/models/manipulators.py in
> save, line 168
>
> Line 168 of manipulators.py is:
> old_rel_obj = getattr(self.original_object,
> related.get_accessor_name()).get(**{'%s__exact' %
> related.opts.pk.name: rel_new_data[related.opts.pk.attname][0]})
>
> and getattr(self.original_object, related.get_accessor_name()) returns
> an object of type 'PrimaryLevelAdvertiser', which is my model, defined
> as:
>
> class PrimaryLevelAdvertiser(Advertiser):
> vacancy =
> models.OneToOneField(AdvertVacancyPrimary, edit_inline=models.STACKED,
> core=True)
>
> and Advertiser is my (now abstract) base model, defined as:
>
> class Advertiser(models.Model):
> employers_name = models.CharField(max_length=75, core=True)
> advertiser_name = models.CharField(max_length=75, core=True)
> advertiser_email = models.EmailField(core=True)
> advertiser_areacode = models.CharField(max_length=5, core=True)
> advertiser_phone = models.CharField(max_length=10, core=True)
> advertiser_position = models.CharField(max_length=75, core=True)
> advertiser_times_available = models.CharField(max_length=255, core=True)
> ip_address = models.CharField(max_length=25, core=True)
> class Meta:
> abstract = True
>
> Now, it makes sense to me that it doesn't have an attribute 'get' but
> I have no idea why the django admin interface expects it to have
> one... if anything, it should be PrimaryLevelAdvertiser.objects.get(),
> right? I also don't understand why it's not working now, when I have
> other abstract base models which seem to work perfectly fine.
> Also, my own code is able to create and save the models...
>
> Anyone got any ideas..?
>
>
> PS: Apologies for all these django emails! I'm willing to buy pints,
> for anyone who's been helping me, at the IOTC :-P
>
> Dan.
>
> --
> Daniel Kersten.
> Leveraging dynamic paradigms since the synergies of 1985.
>
--
Daniel Kersten.
Leveraging dynamic paradigms since the synergies of 1985.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Python Ireland" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.ie/group/pythonireland?hl=en
-~----------~----~----~----~------~----~------~--~---