I am working on a small online shop with Django 1.9 and JqGrid
Here is a simplification of my models:
class Addresses(models.Model):
address = models.TextField(db_column='ADDRESS', max_length=2000)
city = models.CharField(db_column='CITY', max_length=400, blank=True, null=True)
postal_code = models.CharField(db_column='POSTAL_CODE', max_length=200, blank=True, null=True)
state = models.CharField(Country, db_column='STATE', max_length=400, blank=True, null=True)
country = models.ForeignKey(Country, db_column='COUNTRY_ID', null=True)
class Customers(models.Model):
name = models.CharField(db_column='NAME', max_length=400)
nif = models.CharField(db_column='NIF', max_length=200, null=True, blank=True)
email = models.CharField(db_column='EMAIL', max_length=255, unique=True)
mobile_number = models.CharField(db_column='MOBILE_NUMBER', max_length=200, blank=True, null=True)
phone_number = models.CharField(db_column='PHONE_NUMBER', max_length=200, blank=True, null=True)
addresses = models.ManyToManyField(Addresses, through='CustomerAddresses')
class CustomerAddresses(models.Model):
id = models.AutoField(db_column='ID', primary_key=True)
address_name = models.CharField(db_column='ADDRESS_NAME', max_length=100)
customer = models.ForeignKey(Customers)
address = models.ForeignKey(Addresses)
class Orders(models.Model):
order_number = models.IntegerField(db_column='ORDER_NUMBER', unique=True)
customer = models.ForeignKey('Customers', db_column='CUSTOMER_ID')
payment_date = models.DateTimeField(db_column='PAYMENT_DATE', blank=True, null=True)
payment_method = models.CharField(db_column='PAYMENT_METHOD', max_length=400, blank=True, null=True)
delivery_address = models.ForeignKey('Addresses', db_column='ORDER_DELIVERY_ADDRESS_ID', related_name='delivery_address', blank=True, null=True)
I want an edit page for a given Customer to look like this:

At the bottom, I want to display grids (JqGrid) inside jQuery tabs.
The Orders grid, should contain all the orders that are associated with the current Customer
queryset = Orders.objects.filter(customer=customer_pk)
Idem, for the Addresses.
As you can see, I successfully created the tabs and grid, BUT the grids are not filled with the required data (queryset).
Could you help me understand how I should populate the grids with the data I want?
I am sorry if this question is not well explained. I am new in Django. If there is something you don't understand, please tell me.
Thanks