(Reposted since my thread was hijacked...)

I have a "legacy database" filled with  data for many customer's
website content.

In the admin I always want to filter the queries so that only the
current customer's inventory, categories and subcategories are
viewable. Can this be done with the "sites" framework? Do I need to
hack the CurrentSiteManager class?  I am not sure how the
settings.SITE_ID corresponds to my own "keyfgallid" foreign key, so I
just made them the same value.

Here is my model:

from django.db import models
from django.contrib.sites.models import Site
from django.contrib.sites.managers import CurrentSiteManager

from galleryhosting import settings

class Inventory(models.Model):
    keypid = models.IntegerField(primary_key=True)
    keyfgallid = models.ForeignKey(Gallery,db_column='keyfgallid')
    sku = models.CharField(maxlength=45)
    name = models.CharField(maxlength=360)
    artist = models.CharField(blank=True, maxlength=450)
    description = models.TextField()
    date_info = models.CharField(maxlength=300)
    keyfcategoryid =
models.ForeignKey(Category,db_column='keyfcategoryid')
    keyfsubcategoryid = models.ForeignKey(Subcategory,

db_column='keyfsubcategoryid')
    h = models.CharField(maxlength=120)
    w = models.CharField(maxlength=120)
    d = models.CharField(maxlength=120)
    site = models.ForeignKey(Site)
    #Site Stuff
    site = models.ForeignKey(Gallery,db_column='keyfgallid',
                             blank=True, default=settings.SITE_ID,
                             related_name='Gallery')
    objects = models.Manager()
    on_site = CurrentSiteManager(field_name='keyfgallid')

    def __str__(self):
        return "%s / %s / %s" %
(self.sku,self.name,self.keyfcategoryid,)
    class Meta:
        db_table = 'inventory'
    class Admin:
        pass

best,

david


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to