Answer the question
In order to leave comments, you need to log in
Tables not being created from model?
I do makemigrations, migrate
Tables are not created, and there are no errors. I tried to delete all files from the migrations folder, then try again, to no avail. What can be wrong?
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext as _
from django.db import models
# Create your models here.
class Categs (models.Model):
title = models.CharField(verbose_name=('Заголовок'), max_length=256, null=True, blank=True)
alias = models.CharField(verbose_name=('Алиас'), max_length=256, null=True, blank=True)
def __unicode__(self):
return self.title
class Meta:
verbose_name = ('Категории')
verbose_name_plural = ('Категории')
class Video (models.Model):
title = models.CharField(verbose_name=('Заголовок'), max_length=256, null=True, blank=True)
alias = models.CharField(verbose_name=('Алиас'), max_length=256, null=True, blank=True)
category = models.ForeignKey(Categs, verbose_name=('Категория'), null=True, blank=True)
video_id = models.CharField(verbose_name=('Id видео'), max_length=256, null=True, blank=True)
view_num = models.IntegerField(verbose_name=('Просмотры'), max_length=256, default=0),
desc = models.TextField(verbose_name=('Описание'), null=True, blank=True),
created_at = models.DateTimeField(verbose_name=('Дата добавления'), auto_now_add=True, null=True, blank=True)
status = models.BooleanField(verbose_name=('Статус'), default=1)
def __unicode__(self):
return self.title
class Meta:
verbose_name = ('Видео')
verbose_name_plural = ('Видео')
Answer the question
In order to leave comments, you need to log in
In the migrations folder there must be a __init__.py file MANDATORY
Then in the terminal
manage.py makemigrations appname
manage.py migrate
# if the djanga is below 1.8
manage.py syncdb
manage.py migrate youtube 0001
and in general - show the output of the commandmanage.py showmigrations youtube
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question