new constraints for happyhour
This commit is contained in:
parent
46d8d284a8
commit
87df7de1f8
19
ofu_app/apps/food/migrations/0003_auto_20171013_1902.py
Normal file
19
ofu_app/apps/food/migrations/0003_auto_20171013_1902.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.2 on 2017-10-13 17:02
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('food', '0002_auto_20171008_1102'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='happyhour',
|
||||||
|
unique_together=set([('date', 'location', 'starttime', 'endtime')]),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -37,7 +37,7 @@ class HappyHour(models.Model):
|
|||||||
description = models.CharField(max_length=MAX_LENGTH)
|
description = models.CharField(max_length=MAX_LENGTH)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ('date', 'location')
|
unique_together = ('date', 'location', 'starttime', 'endtime')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Date: %s, Location: %s" % (self.date.strftime("%Y.%m.%d"), self.location)
|
return "Date: %s, Location: %s" % (self.date.strftime("%Y.%m.%d"), self.location)
|
||||||
|
|||||||
@ -54,6 +54,9 @@ def writeFekideDataInDB(data):
|
|||||||
happyhour.endtime = datetime.strptime(time[1], "%H:%M").time()
|
happyhour.endtime = datetime.strptime(time[1], "%H:%M").time()
|
||||||
happyhour.save()
|
happyhour.save()
|
||||||
|
|
||||||
|
print("%s: Happy Hour: Location: %s, Description: %s" % (
|
||||||
|
str(happyhour.date.date()), str(happyhour.location), str(happyhour.description)))
|
||||||
|
|
||||||
|
|
||||||
def writeoutDBObjects():
|
def writeoutDBObjects():
|
||||||
pprint("SingleFood: " + str(SingleFood.objects.count()))
|
pprint("SingleFood: " + str(SingleFood.objects.count()))
|
||||||
@ -65,7 +68,8 @@ def delete():
|
|||||||
happy_hours = HappyHour.objects.all()
|
happy_hours = HappyHour.objects.all()
|
||||||
print("Deleted following Happy Hours:")
|
print("Deleted following Happy Hours:")
|
||||||
for happy_hour in happy_hours:
|
for happy_hour in happy_hours:
|
||||||
print("Happy Hour: Location: %s, Description: %s" % (str(happy_hour.location), str(happy_hour.description)))
|
print("%s: Happy Hour: Location: %s, Description: %s" % (
|
||||||
|
str(happy_hour.date), str(happy_hour.location), str(happy_hour.description)))
|
||||||
happy_hour.delete()
|
happy_hour.delete()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
<meta name="author" content="Michael Götz"/>
|
<meta name="author" content="Michael Götz"/>
|
||||||
{# {% javascript "main_js" %}#}
|
{# {% javascript "main_js" %}#}
|
||||||
{# {% block js_head %}{% endblock %}#}
|
{# {% block js_head %}{% endblock %}#}
|
||||||
|
{% block head_extra_first %}{% endblock %}
|
||||||
<link rel="stylesheet" href="{{ static('libs/bootstrap-4.0.0-beta-dist/css/bootstrap.css') }}">
|
<link rel="stylesheet" href="{{ static('libs/bootstrap-4.0.0-beta-dist/css/bootstrap.css') }}">
|
||||||
{% block head_extra %}{% endblock %}
|
{% block head_extra %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@ -1,8 +1,28 @@
|
|||||||
{% extends 'base.jinja' %}
|
{% extends 'base.jinja' %}
|
||||||
|
{% block head_extra_first %}
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.2.0/dist/leaflet.css"
|
||||||
|
integrity="sha512-M2wvCLH6DSRazYeZRIm1JnYyh22purTM+FDB5CsyxtQJYeKq83arPe5wgbNmcFXGqiSH2XR8dT/fJISVA1r/zQ=="
|
||||||
|
crossorigin=""/>
|
||||||
|
<!-- Make sure you put this AFTER Leaflet's CSS -->
|
||||||
|
<script src="https://unpkg.com/leaflet@1.2.0/dist/leaflet.js"
|
||||||
|
integrity="sha512-lInM/apFSqyy1o6s89K4iQUKg6ppXEgsVxT35HbzUupEVRh2Eu9Wdl4tHj7dZO0s1uvplcYGmt3498TtHq+log=="
|
||||||
|
crossorigin=""></script>
|
||||||
|
{% endblock %}
|
||||||
{% block headline %}
|
{% block headline %}
|
||||||
<h1 class="text-center"> Donar </h1>
|
<h1 class="text-center"> Donar </h1>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{# TODO: implement Leaflet #}
|
||||||
|
{# <div id="mapid" style="height: 280px;"></div>#}
|
||||||
|
{# <script>#}
|
||||||
|
{# var mymap = L.map('mapid').setView([51.505, -0.09], 13);#}
|
||||||
|
{# L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {#}
|
||||||
|
{# attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',#}
|
||||||
|
{# maxZoom: 18,#}
|
||||||
|
{# id: 'mapbox.streets',#}
|
||||||
|
{# accessToken: 'your.mapbox.access.token'#}
|
||||||
|
{# }).addTo(mymap);#}
|
||||||
|
{# </script>#}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% if room %}
|
{% if room %}
|
||||||
|
|||||||
Reference in New Issue
Block a user