Opened 14 years ago

Closed 13 years ago

#13955 closed (invalid)

capitalization of ForeignKey

Reported by: jason@… Owned by: nobody
Component: contrib.admin Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Alex Gaynor)

In a Model,

class Report(models.Model):
    report_number = models.CharField('NCAC report number', primary_key=True)

I've set the name for the capitalization of the acronym.

When I use the Model as a ForeignKey,

class RSL(models.Model):
    report_number = models.ForeignKey('Report', null=True)

the capitalization of the field name is lost, it will show up as 'Ncac report number' in the admin view for the RSL database.

Change History (6)

comment:1 by Alex Gaynor, 14 years ago

Description: modified (diff)

I've reformatted the description of this ticket, in the future you can use the "Preview" button to ensure that your message is formatted the way you intended.

comment:2 by James Bennett, 14 years ago

Resolution: invalid
Status: newclosed

You've set the name for a field. To control how the name of the model itself is displayed, you need to set verbose_name in the model class' Meta declaration, as covered in the documentation.

comment:3 by Jason Mader <jason@…>, 14 years ago

Resolution: invalid
Status: closedreopened

comment:4 by Jason Mader <jason@…>, 14 years ago

I wasn't referring to the verbose_name of the Model, but the field that is included as the primary key of ForeignKey or ManyToManyField.

In the Admin interface if I view the model Report, the field name shows with the capitalization I set. In the view of the RSL model, the same field (the primary key of Report) does not have the same capitalization.

in reply to:  4 comment:5 by Ramiro Morales, 14 years ago

Replying to Jason Mader <jason@ncac.gwu.edu>:

I wasn't referring to the verbose_name of the Model, but the field that is included as the primary key of ForeignKey or ManyToManyField.

In the Admin interface if I view the model Report, the field name shows with the capitalization I set. In the view of the RSL model, the same field (the primary key of Report) does not have the same capitalization.

Are you using inlines?. Please post the complete admin setup that is need in addition to your models so people can try to reproduce the issue. It would have been a good idea to post it when you submitted the bug.

comment:6 by Ramiro Morales, 13 years ago

Resolution: invalid
Status: reopenedclosed

I've implemented a test project with the models and I don't see what you describe when looking the different views related to the RSL model in the admin, in fact I don't see the description of the Report.report_number at all.

I' closing this ticket again with status invalid. Please reopen it only if you are willing to provide the complete models and admin setup plus description of where you are seeing the 'NCAC report number' with the case of 'NCAC' changed. For example, you omitted the required max_length option in the Report.report_number field and the app wouldn't even validate with that error.

Note: See TracTickets for help on using tickets.
Back to Top