2007/11/27, mike <[EMAIL PROTECTED]>:
>
>
> My last post was a little confusing, I have two classes a Customer
> class and an Issue class, I would like the customer class to display
> issues where the "name" of the customer field matches the "customer"
> field of the issues class, thus listing each customer's issues at a
> glance, any help would be appreciated. thx in advance
>
>
>
> class Customer(models.Model):
> name = models.CharField(maxlength=100)
> service = models.IntegerField(blank=True, default=4,
> choices=SERVICE_CODES)
> comp = models.IntegerField(blank=True, default=4,
> choices=CUSTOMER_TYPES)
> email = models.CharField(blank=True, maxlength=100)
> phone_number = models.CharField(blank=True, maxlength=100)
> phone_number2 = models.CharField(blank=True, maxlength=100)
> IP_address = models.CharField(blank=True, maxlength=100)
> submitted_date = models.DateField(auto_now_add=True)
> modified_date = models.DateField(auto_now=True)
> description = models.TextField(blank=True)
> list_issues = ???????????
> class Admin:
> list_display = ('name', 'service', 'phone_number',
> 'submitted_date', 'modified_date')
> list_filter = ('service', 'submitted_date')
> search_fields = ('name',
> 'description','email','phone_number','IP_address')
>
>
>
> class Meta:
> ordering = ('service', 'submitted_date', 'name')
>
> def __str__(self):
> return self.name
>
> class Issue(models.Model):
> issue = models.TextField(blank=True)
> date = models.DateField()
> customer = models.ForeignKey(Customer, related_name="Customer")
>
> def __unicode__(self):
> return self.issue
>
> class Meta:
> ordering = ('issue',)
> class Admin:
> pass
>
>
> >
>
hi mike,
in class Issue try to change the attribute customer according to the
following line:
customer = models.ForeignKey(Customer, edit_inline=models.TABULAR,
related_name="Customer")
there's also the num_in option which determines the number of displayed
INLINE customers
customer = models.ForeignKey(Customer, edit_inline=models.TABULAR,
num_in_admin=2, related_name="Customer")
maybe this is what you want.
-cheers, roman
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---