aircraft
aircraft

Reputation: 26924

Whether I can set field's comment in the Model?

You see the MySQL tables in the Sequel Pro, every field has a Comment:

enter image description here

Whether I can set the field comment in the Model?

class Account(models.Model):

    balance = models.CharField(max_length=16)
    grade = models.CharField(max_length=1, default=1) # whether there is a property for us to set field comment?

Upvotes: 0

Views: 1536

Answers (2)

MestreLion
MestreLion

Reputation: 13726

As I've answered in a similar question:

  • Ticket #13867 is now "superseded" by #18468, which was reopened and is now accepted and waiting for patches. The original rejection, after discussion on the mailing list, changed to

I think we could implement that feature. (Yes I changed my mind from six years ago when I wontfix'd the ticket.)

Upvotes: 1

aliva
aliva

Reputation: 5740

You can't set comment on a field in django (please check this issue)

I understand the idea, but I'm afraid it doesn't have a good usefulness/noise ratio.

The ORM doesn't aim at providing a Python interface for every feature of the supported database engines. Its goal is "just" to provide an OO API.

Since there's neither a clean API proposal, nor a patch, nor a convincing explanation of the value added by this feature, I'm going to close this ticket.

PS: you can use django raw sql queries and manually set the comment.

Upvotes: 1

Related Questions