Putting content_type on a different class for a generic relation?

2011-03-02 Thread Jim D
I've got two models. Here's what I'm trying to do: class InterestSet(models.Model, MailChimpAPIMixin): name = models.CharField(help_text="The interest grouping to add. Grouping names must be unique.", max_length=128, unique=True) content_type = models.ForeignKey(ContentType, blank=True, nu

Re: Does loaddata in fact save objects to DB with a raw save? Or is this a bug?

2011-01-14 Thread Jim D.
> loaddata saves object created via deserialization, which pass raw=True to > the model's save_base, see: > > http://code.djangoproject.com/browser/django/trunk/django/core/serial... Thanks Karen. That's exactly the answer I was looking for. -- You received this message because you are subscribe

Does loaddata in fact save objects to DB with a raw save? Or is this a bug?

2011-01-13 Thread Jim D.
I was just now researching some options for how to manage the way certain post_save/pre_save signals can interfere with fixture loading during tests, when I happened upon this ticket: http://code.djangoproject.com/ticket/12610 Which says: "There is already a hook to check for this - data saved d

Re: Preventing code from running during user tests

2010-09-16 Thread Jim D.
d the documentation for signals. On Sep 16, 5:13 pm, Russell Keith-Magee wrote: > On Fri, Sep 17, 2010 at 6:15 AM, Jim D. wrote: > > I have some code that calls a third-party API in a Django application > > I'm working on, which could be triggered at various points throughout >

Preventing code from running during user tests

2010-09-16 Thread Jim D.
I have some code that calls a third-party API in a Django application I'm working on, which could be triggered at various points throughout a project. I would like to ensure that the API itself doesn't actually get called at all during test mode, much the same way that Django itself swaps out the e

Admin widget for large number of related records

2008-12-05 Thread Jim D.
I apologize if this question has been asked/answered here before, but I searched around and couldn't find anything. We're working on a django app in which we're porting some existing user data overwe have about 100,000 user records that are being imported. We have many other models that are l

Re: Custom template tag problem: "No module named models"

2008-11-18 Thread Jim D.
I came across this thread and was having the exact same problem. *Exactly* the same... I had tried everything you tried to no avail. I actually fixed it by taking a hint from something that came out of following along with your debug session in my own code. I'll put my solution in terms of your

Re: How to know which fields a model contains?

2008-08-25 Thread Jim D.
I'm pretty new to python myself, but my favorite way to inspect objects that I have found so far is the builtin method dir(). As in: dir(Publisher.objects.get(pk=1)) dir() tells you all of the methods and attributes for a given object, though it doesn't display the value of attributes. --~--~---

Issue with serializing a queryset that includes a custom SQL field defined by extra()

2008-08-25 Thread Jim D.
I think this might be a bug in source code, but before I report a ticket I thought I would ask just to ensure it's not me doing something wrong/stupid. In brief, I have a (MySQL) database table containing latitude and longitude columns. I am finding records from this table and sorting them based