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',
)
Community
  • 1
  • 1
RaV
  • 1,029
  • 1
  • 9
  • 25

2 Answers2

1

You should create migrations first:

python manage.py makemigrations

After that run migrate command:

python manage.py migrate
catavaran
  • 44,703
  • 8
  • 98
  • 85
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

Prateek
  • 1,538
  • 13
  • 22