Re: adding field to query set

2010-10-29 Thread Jumpfroggy
If it were my project, I'd probably add this kind of custom field to your mapping: mapping = { # list the normal columns first... then: 'full_name': ['user__first_name', 'user__last_name'], } Then your render code would be something like this: def render(self): for row in

Re: adding field to query set

2010-10-28 Thread owidjaya
Ok the motive is for this reason. I have a table generator class that display an html table from the query set depending on the columns that you selected class TableGenerator(name,mapping,data): def __init__(self,name,mapping,data): self._mapping = mapping self._name = name

Re: adding field to query set

2010-10-28 Thread Jumpfroggy
What's your motive? Are you worried about performance? If performance is not an issue, you can just do this: for project in Project.objects.all(): print project.user.first_name + ' ' + project.user.last_namea This might speed things up: projects =

adding field to query set

2010-10-28 Thread owidjaya
If I have such models class Project(models.Model): project = models.CharField(max_length=200) user = models.ForeignKey(User) # user is from django.contrib.auth.models => user I would like to be able to display an an attribute that is made up of first_name and last_name concatenated when i

adding field to query set

2010-10-28 Thread owidjaya
If i have such models class Project(model.Model): project = model. -- 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