Hi,

I created a model (Catalog), which is linked to its items via a m2m
relationship.
I added a raw_id_admin=True to the items field (good when I have a
long list of items).
Also, for convience reasons I wanted a different pk for my items, so I
added primary_key=True to one of the fields (in the simplified example
below, its name).

This does not seems to work properly when trying to link more than one
item to the catalog.
In the models.py below, I added two fields - one is good_items, which
contains a 'regular' id field, and works fine, and the other -
bad_items, which creates the above problem.
Also, I added validator_list=[isOnlyDigits], since non-integer id's
caused another problem while adding these items to the catalog.

I checked it with version 0.96.1 and current version from trunk (7403)
- fails on both.

Any suggestions where to go from here? (beside removing the
primary_key=True, and using a regular id field, of course)

models.py:

from django.db import models
from django.core.validators import isOnlyDigits

class BadItem(models.Model):
    name =
models.CharField(maxlength=50,primary_key=True,validator_list=[isOnlyDigits])

    def __str__(self):
        return self.name

    class Admin:
        list_display = ('name',)

class GoodItem(models.Model):
    name =
models.CharField(maxlength=50,blank=False,null=False,unique=True)

    def __str__(self):
        return self.name

    class Admin:
        list_display = ('id','name')

class Catalog(models.Model):
    name = models.CharField(maxlength=50,blank=False,null=False)
    good_items = models.ManyToManyField(GoodItem,raw_id_admin=True)
    bad_items = models.ManyToManyField(BadItem,raw_id_admin=True)

    class Admin:
        list_display = ('id','name',)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to