considering this model:
class Inventory (models.Model):
id = models.AutoField (primary_key=True)
Barcode = models.BigIntegerField(blank=False)
Location = models.CharField (max_length=25,blank=False,
db_index=True)
Sku = models.CharField (max_length=25,blank=False,
db_index=True)
Quantity = models.DecimalField (blank=False, max_digits=7,
default=0,decimal_places=2,help_text='Quanity on barcode')
LastAction = models.ForeignKey('AppSettings.InventoryOption',
verbose_name=_('Last Action'), related_name='LastAction',blank=False,
null=False)
LastTouchedBy = models.ForeignKey(User, unique=False,
db_index=True, blank=False)
LastUpdated = models.DateTimeField
(auto_now_add=True,blank=False, db_index=True,help_text='Auto Filled')
class InventoryAdmin(admin.ModelAdmin):
list_display =
('Barcode','Sku','Location','LastAction','LastUpdated','User.first_name',)
search_fields = ['Barcode','Location','Sku','LastTouchedBy']
readonly_fields =
['BarCode','Location','Sku','Quantity','LastAction','LastTouchedBy','LastUpdated']
admin.site.register(Inventory,InventoryAdmin)
two questions.
1) LastTouchedBy is the userid - what do i need to do to print out the
firstname+lastname of the user in the list_display. (ie instead of
printing out userid 123, I want to print out the user's full name,
"john doe"
2) LastAction - I'm importing AppSettings model further up the page,
how can I print out the text value of
(AppSettings.InventoryOption.name) in place of the numerical value
stored in LastAction
rapid help greatly appreciated.
--
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.