expanded Single food model
This commit is contained in:
parent
7e971ca91b
commit
39f4231969
25
ofu_app/apps/food/migrations/0004_auto_20171020_0146.py
Normal file
25
ofu_app/apps/food/migrations/0004_auto_20171020_0146.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.2 on 2017-10-19 23:46
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('food', '0003_auto_20171013_1902'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='singlefood',
|
||||||
|
name='image',
|
||||||
|
field=models.ImageField(blank=True, upload_to='food/%Y/%m/'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='singlefood',
|
||||||
|
name='rating',
|
||||||
|
field=models.FloatField(default=0),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -23,6 +23,8 @@ class Menu(models.Model):
|
|||||||
class SingleFood(models.Model):
|
class SingleFood(models.Model):
|
||||||
id = models.AutoField(primary_key=True)
|
id = models.AutoField(primary_key=True)
|
||||||
name = models.CharField(unique=True, max_length=MAX_LENGTH)
|
name = models.CharField(unique=True, max_length=MAX_LENGTH)
|
||||||
|
image = models.ImageField(upload_to='food/%Y/%m/', blank=True)
|
||||||
|
rating = models.FloatField(default=0)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|||||||
Binary file not shown.
@ -151,3 +151,6 @@ USE_X_FORWARDED_HOST = True
|
|||||||
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||||
|
|
||||||
# FORCE_SCRIPT_NAME = "app"
|
# FORCE_SCRIPT_NAME = "app"
|
||||||
|
# Media files should be stored here
|
||||||
|
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
|
||||||
|
MEDIA_URL = '/media/'
|
||||||
|
|||||||
@ -31,7 +31,8 @@
|
|||||||
{% macro get_menu(menu) -%}
|
{% macro get_menu(menu) -%}
|
||||||
<ul class="border">
|
<ul class="border">
|
||||||
{% for single_food in menu %}
|
{% for single_food in menu %}
|
||||||
<li><p>{{ single_food.name }}</p></li>
|
<li><p>{{ single_food.name }} <i class="fa fa-star-o" aria-hidden="true"></i>
|
||||||
|
</p></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|||||||
Reference in New Issue
Block a user