After I add my application to INSTALLED_APPS section I can't make
python manage.py check - it returns an error.
Would you, please, help me to find out what I am doing wrong?
1) console window with an error @line55 of models.py
text of the console:
(py350-dja185-venv)MacBook-Pro:recipe_1_1 mac1$ python manage.py check shell Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/Users/mac1/Envs/py350-dja185-venv/lib/python3.5/site-packages/django/core/management/init.py", line 351, in execute_from_command_line utility.execute() File "/Users/mac1/Envs/py350-dja185-venv/lib/python3.5/site-packages/django/core/management/init.py", line 325, in execute django.setup() File "/Users/mac1/Envs/py350-dja185-venv/lib/python3.5/site-packages/django/init.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "/Users/mac1/Envs/py350-dja185-venv/lib/python3.5/site-packages/django/apps/registry.py", line 108, in populate app_config.import_models(all_models) File "/Users/mac1/Envs/py350-dja185-venv/lib/python3.5/site-packages/django/apps/config.py", line 198, in import_models self.models_module = import_module(models_module_name) File "/Users/mac1/Envs/py350-dja185-venv/lib/python3.5/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 986, in _gcd_import File "", line 969, in _find_and_load File "", line 958, in _find_and_load_unlocked File "", line 673, in _load_unlocked
File "", line 662, in exec_module File "", line 222, in _call_with_frames_removed File "/Users/mac1/Documents/workspace/recipe_1_1/meals/models.py", line 55, in class Ingredients(models.Model): File "/Users/mac1/Envs/py350-dja185-venv/lib/python3.5/site-packages/django/db/models/base.py", line 308, in new new_class._prepare() File "/Users/mac1/Envs/py350-dja185-venv/lib/python3.5/site-packages/django/db/models/base.py", line 361, in _prepare cls.doc = "%s(%s)" % (cls.name, ", ".join(f.name for f in opts.fields)) TypeError: sequence item 7: expected str instance, int found
2) piece of code @models.py Why does it give me an error at line 55?
36-39 MEASUREMENT_CHOICES = (('шт', 'штук'), ...,)
41 class Recipe(models.Model):
42 recipe_id = models.PositiveIntegerField()
43 meal_id = models.ForeignKey('Meal')
44 ingredient_id = models.ForeignKey('Ingredients', related_name = '+')
45 ingr_quantity = models.PositiveSmallIntegerField()
46 ingr_measurement = models.CharField(max_length = 5, choices = MEASUREMENT_CHOICES)
47 tail = models.CharField(max_length = 35)
49 SEASON_CHOICES = ((u'01', u'январь'), (u'02', u'февраль'), (u'03', u'март'),
(u'04', u'апрель'), (u'05', u'май'), (u'06', u'июнь'),
(u'07', u'июль'), (u'08', u'август'), (u'09', u'сентябрь'),
(u'10', u'октябрь'), (u'11', u'ноябрь'), (u'12', u'декабрь'),
)
55 class Ingredients(models.Model):
56 ingr_name = models.CharField(max_length = 20)
57 ingr_category = models.ForeignKey('IngrCategory')
58 calories_raw = models.PositiveSmallIntegerField()
59 calories_boiled = models.PositiveSmallIntegerField()
60 calories_fried = models.PositiveSmallIntegerField()
61 ingr_unit = models.CharField(10)
62 price_in_season = models.DecimalField(7,2)
63 price_in_no_season = models.DecimalField(7,2)
64 price_current = models.DecimalField(7,2)
65 season = models.CharField(max_length = 2, choices = SEASON_CHOICES)
Somehow, it goes through the class Recipe, and through the previous class also, and gives me an error at the class Ingredients(models.Model) line. Why?
3) eclipse window - same project, different error types:
Finding files... done. Importing test modules ... done. Traceback (most recent call last): <...> File "/Applications/Eclipse.app/Contents/Eclipse/plugins/org.python.pydev_4.3.0.201508182223/pysrc/pydev_runfiles.py", line 813, in run_tests raise AssertionError("Unable to run suite with DjangoTestSuiteRunner because it couldn't be imported.") AssertionError: Unable to run suite with DjangoTestSuiteRunner because it couldn't be imported.
Thank you so much for your help.
Ingredientsclass code shown here? - Michał FitaMEASUREMENT_CHOICES? - trinchet