Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8485117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:33:11+00:00 2026-06-10T20:33:11+00:00

By convention django places the class Meta: declaration second to last in the class

  • 0

By convention django places the class Meta: declaration second to last in the class definition, right before the __unicode__ method definition. Is this required? I’m trying to trace an insidious error on Lion OSX where the case (capital/lower) of a db_table = u'TableName' statement is being ignored for some models. For some models manage.py syncdb creates mysql tables with the lower()ed table names and for others it uses the db_table case properly. The more complicated models, with custom save() and other methods are the ones that are converted to lowercase before creating mysql tables. I’m trying lots of code rearranging to see if that’s the issue, but can’t find documentation for the proper order of things, though I recall in the past somewhere that a position for class Meta: was specified.

Also tried both unicode literals for the db_table spec and single-byte string literals. Niether make a difference (for the working or the nonworking models)

Here’s the relevant code:

grep -A5 -B2 _table ‘entityorganizer/models.py’

    class Meta:
        db_table     = 'Entity'
        verbose_name_plural = "entities"
        ordering = ["map_status","type_name","name"] 
        get_latest_by = "updated"

--

    class Meta:
        db_table = 'EntityRelationship'
        ordering = ["to_entity","relationship_type"]
        unique_together = (('from_entity','to_entity','relationship_type'))
        get_latest_by = "updated"
        verbose_name = "relationship"

--

    class Meta:
        db_table = 'Specialty'
        verbose_name_plural = u'specialties'

    def __unicode__(self):
        return '%s'%(self.specialty)

--

    class Meta:
        db_table = 'ZipCode'
        get_latest_by = "updated"

    def get_region(self):
        return REGION[region_id_v2-200][1] or 0

--

    class Meta:
        db_table = 'Setting'

    def __unicode__(self):
        return '%s = %s'%(self.name, self.value) #, self.updated)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:33:13+00:00Added an answer on June 10, 2026 at 8:33 pm

    You can put your class Meta wherever you want in your models, so long as it matches the correct indentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Django uses Meta class for lots of additional object information. However, they store this
I have this Django model: from django.contrib.gis.db import models class Event(models.Model): address = models.TextField()
Is there any naming convention for created and last edit dates in Django? ie.
When using test fixtures in Django is the convention to include the foreign models
I know the naming convention for class methods in C# is to begin with
I'm writing a Django 1.3 view method which requires TLS/SSL to be used. I
It seems that Django doesn't have a convention on the placement of template files.
What is the preferred naming convention for Django model classes?
I have django models with a manytomany connection with a through class: class userProfile(models.Model):
I have django running through WSGI like this : <VirtualHost *:80> WSGIScriptAlias / /home/ptarjan/django/django.wsgi

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.