User.first_name

Both images are of the Django admin section. They are not exposed to end users unless the user is an admin. I don’t think I’m explaining things correctly. Let me try again.

In the admin section I have registered the class PizzaOrder. Actually the registration is done in admin.py.

@admin.register(PizzaOrder)
class PizzaOrder(admin.ModelAdmin):
  list_display = (
  'user_name',
  # 'firstName',
  'pizzaTopping1',
  'pizzaTopping2',
  'drink',
  'order_Number',
  )
  ordering = ('pizzaTopping1',)
  search_fields = ('pizzaTopping1',)

PizzaOrder has a ForeignKey named user_name. user_name provides the user that submitted the order which is good (and necessary) but I would like to get the users first name and/or last name to see in the list of orders in the admin section. I can get the { user.last_name } or { user.first_name } on the html template but I want to see the users first and/or last name in the admin section.

So in the admin section, as an admin I can manually create an order and assign it to a user. When I do I select the user that is available to me through the dropdown box as a user_name. When I make the selection, I would like to have a field populate with that users first name and/or last name.
That means that I would need to have created a field of what what type exactly? A CharField? Another ForeignKey. If I need another ForeignKey how do I write that;

class ForeignKey(to, on_delete, **options)

as an aside; where do I find the options? I have not been able to find options in the Django docs.

I don’t think a ForeignKey would work because I don’t what to select the users first and or last name. I want it to come from the instance of that user.

firstName = models.ForeignKey(User, **options
on_delete=models.CASCADE)

Not sure if that explains it. Let me know if I need to clarify further.