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):
|
||||
id = models.AutoField(primary_key=True)
|
||||
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):
|
||||
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')
|
||||
|
||||
# FORCE_SCRIPT_NAME = "app"
|
||||
# Media files should be stored here
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{% macro day_menu(title, location_menu, fail_text) -%}
|
||||
<div class="col p-2">
|
||||
<div class="p-3 border border-dark rounded bg-light text-dark">
|
||||
<h2>{{ title }}</h2>
|
||||
<h2>{{ title }} </h2>
|
||||
{% if location_menu %}
|
||||
<p>{{ location_menu.date.strftime('%d.%m.%Y') }}</p>
|
||||
{{ get_menu(location_menu.menu.all()) }}
|
||||
@ -31,7 +31,8 @@
|
||||
{% macro get_menu(menu) -%}
|
||||
<ul class="border">
|
||||
{% 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 %}
|
||||
</ul>
|
||||
{% endmacro %}
|
||||
|
||||
Reference in New Issue
Block a user