I am fairly new to Django and I am trying to get a few things working
in Django Admin.

I have the models shown below. I have a profile table and a test
table. I have a joining table called testsuite which allows me to map
multiple tests to a profile. This all works fine, but in the admin
part I have to add one profile/test at a time. What I want to be able
to do is select a profile and select multiple tests and add them at
the same time. I would also like to be able to select a profile and
see the test already assigned to it and be able to edit them and add
or remove tests.
Is it possible to do this?

My admin file looks like this. Just the basic register lines.

---------------------------------------------------
Admin
---------------------------------------------------
from django.contrib import admin
from bisite.models import   Testcase, Testsuite, Profile, Source

admin.site.register(Profile)
admin.site.register(Source)
admin.site.register(Testcase)
admin.site.register(Testsuite)


---------------------------------------------------
Models
--------------------------------------------------

class Profile(models.Model):
    profile_id = models.AutoField(primary_key=True)
    profile_name = models.CharField(max_length=75)
    description = models.CharField(max_length=1500, blank=True)
    def __unicode__(self):
                        return self.profile_name
    class Meta:
        db_table = u'profile'

class Testcase(models.Model):
    test_id = models.AutoField(primary_key=True)
    test_name = models.CharField(max_length=300)
    src = models.ForeignKey(Source, null=True, blank=True)
    bitrate = models.IntegerField(null=True, blank=True)
    test_type = models.CharField(max_length=300)
    output_resolution = models.CharField(max_length=15, blank=True)
    description = models.CharField(max_length=3000, blank=True)
    ref_file = models.CharField(max_length=765, blank=True)
    ref_encode_filesize = models.IntegerField(null=True, blank=True)
    ref_y_psnr = models.DecimalField(null=True, max_digits=7,
decimal_places=2, blank=True)
    ref_u_psnr = models.DecimalField(null=True, max_digits=7,
decimal_places=2, blank=True)
    ref_v_psnr = models.DecimalField(null=True, max_digits=7,
decimal_places=2, blank=True)
    ref_yuv_psnr = models.DecimalField(null=True, max_digits=7,
decimal_places=2, blank=True)
    highmark_version = models.CharField(max_length=60, blank=True)
    def __unicode__(self):
                return self.test_name
    class Meta:
        db_table = u'testcase'

class Testsuite(models.Model):
    testsuite_id = models.AutoField(primary_key=True)
    profile = models.ForeignKey(Profile, related_name='profile')
    test = models.ForeignKey(Testcase, related_name='test')
    #def __unicode__(self):
                        #                       return
self.testsuite_id
    def __unicode__(self):
               return '%s,%s' % (self.profile, self.test)
    class Meta:
        db_table = u'testsuite'

--

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


Reply via email to