try this:
def attach_bar(self, bar):
if getattr(self, "bars", None) is None:
self.bars = []
self.bars.append(bar)
On Mon, Feb 9, 2009 at 12:03 AM, Jack Orenstein wrote:
>
> I have a model object that looks something like this:
>
> class Foo(models.Model)
I have a model object that looks something like this:
class Foo(models.Model)
foo_id = models.IntegerField(primary_key = True)
xyz = models.CharField(max_length = 20)
In my application, I'd like to add a list of Bar objects. It's like a
foreign key, except that Bar objects don
2 matches
Mail list logo