0

I am learning and it might be just stupid mistake, but syncdb and migrate creates all admin tables, but no my app tables so only Groups and Users works in admin panel. I see my models in admin panel, but when I try to enter them it gives me an error Table 'baza63843_django.testowa_news' doesn't exist.

models.py

from django.db import models

# Create your models here.

class Category(models.Model):
    name = models.CharField('Nazwa Kategorii', max_length=100)
    slug = models.SlugField('Odnośnik', unique=True, max_length=100)
    icon = models.ImageField('Ikonka Kategorii', upload_to='icons',
                              blank=True)

    class Meta:
        verbose_name = "Kategoria"
        verbose_name_plural = "Kategorie"

    def __unicode__(self):
        return self.name


class News(models.Model):
    title = models.CharField('Tytuł', max_length=255)
    slug = models.SlugField('Odnośnik', max_length=255, unique=True)
    text = models.TextField(verbose_name='Treść')
    #categories = models.ForeignKey(Category, verbose_name="Kategoria")
    #categories = models.ManyToManyField(Category, verbose_name='Kategorie')
    posted_date = models.DateTimeField('Data dodania', auto_now_add=True)

    class Meta:
        verbose_name = "Wiadomość"
        verbose_name_plural = "Wiadomości"

    def __unicode__(self):
        return self.title

At the beginning I made here ManyToManyField, but according to this I changed it. But still doesn't work.

I have my app in settings.py, it is called testowa

INSTALLED_APPS = (
    'django_admin_bootstrapped',
    #'bootstrap_admin', # always before django.contrib.admin
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    #'django.contrib.sites',
    'testowa',
)
1
  • Which version of Django are you using. Commented Jan 20, 2015 at 5:16

2 Answers 2

1

You should create migrations first:

python manage.py makemigrations

After that run migrate command:

python manage.py migrate
Sign up to request clarification or add additional context in comments.

1 Comment

Srsly, facepalm. I couldn't find that info in few tutorials. Thanks man!
1

If you are using Django 1.7 please follow the following commands to get the tables created in the db.

python manage.py makemigrations

after that command run the following command

python manage.py migrate

As south database migrations are inbuild with Django 1.7

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.