Answer the question
In order to leave comments, you need to log in
What relationships?
Hello. Made a model for adding pdf files. I made categories but when adding a file and selecting a category, it gives an error:
The above exception (ERROR: relation "portal_category" does not exist LINE 1: INSERT INTO "portal_category" ("ca2") VALUES ('Positions') R... ^ ) was the direct cause of the following exception:
migrate and makemigrations doesn't help
<code>class Category(models.Model):
ca2 = models.CharField(max_length=50, verbose_name='Название категории')
class Meta():
verbose_name = 'Категория'
verbose_name_plural = 'Категории'
def __str__(self):
return self.name
class Pdf(models.Model):
title = models.CharField(max_length=100)
file = models.FileField(upload_to='files')
#date_pub_f = models.DateTimeField(blank=True, null=True)
ca1 = models.ForeignKey(Category, verbose_name='Категория', on_delete = models.CASCADE)
def __str__(self):
return self.title</code>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question