0

I would like to name the fields of my Django model with integers. I found the way to do it in MySQL but the same seems not applicable in Django. If I write something like:

class WidgetContributionDevelopment(models.Model):
    site = models.ForeignKey(Site, db_column='site_id', default=None)
    `1` = models.FloatField(default=0.0)
    `2` = models.FloatField(default=0.0)
    `3` = models.FloatField(default=0.0)

I get a syntax error. Is there a way to do it? Thanks.

Mattia Paterna
  • 1,268
  • 3
  • 15
  • 31
  • Name django fields with numbers is a pretty bas idea to my mind ^^ – Essex Jul 24 '17 at 14:44
  • ok, this may make sense :) it was just: I have numbers from 1 to 7 coming from an `isoweekday()` function and I was wondering if there was any shortcut instead of mapping these numbers to the column name, and make the query then. – Mattia Paterna Jul 25 '17 at 06:41

0 Answers0