I need to upgrade to django 1.7 (then 1.8, etc but I prefer step by step). I'm actually Django 1.6.11.
I had to do some modifications with AppConfig as I have an app called admin with some models inside.
# apps/admin/apps.py
from django.apps import AppConfig
class AdminConfig(AppConfig):
name = 'admin'
label = "Our Admin"
# project/settings/common.py
INSTALLED_APPS = (
'admin.apps.AdminConfig', # our custom admin
...
# apps/admin/models.py
class CastingProfile(models.Model):
user = models.OneToOneField(User, primary_key=True)
total_casted = models.PositiveIntegerField(default=0)
article_price = models.FloatField(default=0.03)
...
Now I have this error when I try to access my custom admin:
Exception Type: ProgrammingError
Exception Value:
relation "Our Admin_castingprofile" does not exist
LINE 1: ...t", "Our Admin_castingprofile"."video_price" FROM "Our Admin...
IPDB:
ipdb> CastingProfile.objects.get(user=user)
*** ProgrammingError: relation "Our Admin_castingprofile" does not exist
LINE 1: ...t", "Our Admin_castingprofile"."article_price" FROM "Our Admin...
^
Do I have to run a migration to update DB or did I miss something ?
EDIT:
I can't use label = "admin" as from Django 1.7 Duplicate label aren't allowed.
Using db_table = "your_table_name" lead to following error:
Exception Type: ProgrammingError
Exception Value:
relation "castingprofile" does not exist
LINE 1: ..."last_count", "castingprofile"."article_price" FROM "castingpr...
And here is a model of this app where I made the changes:
# apps/admin/models.py
class CastingProfile(models.Model):
user = models.OneToOneField(User, primary_key=True)
total_casted = models.PositiveIntegerField(default=0)
article_price = models.FloatField(default=0.03)
...
class Meta:
db_table = "castingprofile"
...
EDIT:
Works! Great, I just had to add "admin_castingprofile" instead of "castingprofile" in db_table following last advice of e-satis. running throught my db gave me the name of tables.
The problem comes from:
This value condition the name of the table. You can see it in your last error line, where the SQL output the JOIN.
Since you probably had a table containing this data before, you should keep the previous name of it. I'm guessing the name here was "admin" so:
If for some reason you can't use 'admin' as a label, use a label that is a valid Python identifier such as "our_admin" for label. Then for each model of this app, declare an explicit table name:
You should inspect your db to get the proper table name for each model since they are already created. But do so only if the first method didn't work.