Merge branch 'develop_donar'

This commit is contained in:
Götz 2017-10-30 00:30:14 +01:00
commit feb15bd5f4
22 changed files with 439 additions and 223 deletions

View File

@ -1,3 +1,7 @@
from django.contrib import admin
from apps.donar.models import Room, Lecture, Lecture_Terms, VGN_Coords
# Register your models here.
admin.site.register(Room)
admin.site.register(Lecture)
admin.site.register(Lecture_Terms)
admin.site.register(VGN_Coords)

View File

@ -0,0 +1,14 @@
from django.core.management.base import BaseCommand, CommandError
from apps.donar.models import Room
from apps.donar.utils import migrate_data_lectures
class Command(BaseCommand):
help = "Imports Lectures from UnivIS PRG. Requires Room import"
def add_arguments(self, parser):
pass
def handle(self, *args, **options):
migrate_data_lectures.main()
self.stdout.write(self.style.SUCCESS('Successfully migrate data'))

View File

@ -1,6 +1,6 @@
from django.core.management.base import BaseCommand, CommandError
from apps.donar.models import Room
from apps.donar.utils import migrate_data
from apps.donar.utils import migrate_data_rooms
class Command(BaseCommand):
@ -10,5 +10,5 @@ class Command(BaseCommand):
pass
def handle(self, *args, **options):
migrate_data.main()
migrate_data_rooms.main()
self.stdout.write(self.style.SUCCESS('Successfully migrate data'))

View File

@ -0,0 +1,11 @@
from django.core.management.base import BaseCommand, CommandError
from apps.donar.utils import migrate_data_vgn_coords
class Command(BaseCommand):
help = "Imports Rooms from Univis PRG"
def add_arguments(self, parser):
pass
def handle(self, *args, **options):
migrate_data_vgn_coords.migrate()

View File

@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-25 21:40
# Generated by Django 1.11.2 on 2017-10-29 23:28
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
@ -13,6 +15,25 @@ class Migration(migrations.Migration):
]
operations = [
migrations.CreateModel(
name='Lecture',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('univis_ref', models.CharField(max_length=60, unique=True)),
('univis_id', models.CharField(max_length=60, unique=True)),
('name', models.CharField(max_length=60)),
('short', models.CharField(max_length=60)),
('type', models.CharField(max_length=60)),
('lecturer_id', models.CharField(max_length=60)),
],
),
migrations.CreateModel(
name='Lecture_Terms',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('starttime', models.TimeField(default=datetime.datetime(2017, 10, 29, 23, 28, 46, 228504, tzinfo=utc))),
],
),
migrations.CreateModel(
name='Room',
fields=[
@ -38,4 +59,14 @@ class Migration(migrations.Migration):
('latitude', models.CharField(max_length=60, unique=True)),
],
),
migrations.AddField(
model_name='lecture_terms',
name='room',
field=models.ManyToManyField(blank=True, to='donar.Room'),
),
migrations.AddField(
model_name='lecture',
name='term',
field=models.ManyToManyField(to='donar.Lecture_Terms'),
),
]

View File

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-10-29 23:29
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('donar', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='lecture_terms',
name='starttime',
field=models.TimeField(default=datetime.datetime(2017, 10, 29, 23, 29, 23, 775652, tzinfo=utc)),
),
]

View File

@ -1,4 +1,5 @@
from django.db import models
from django.utils import timezone
MAX_LENGTH = 60
@ -16,10 +17,39 @@ class Room(models.Model):
size = models.CharField(max_length=MAX_LENGTH, default="")
description = models.CharField(max_length=200, default="")
def __str__(self):
return "%s - size: %s" % (self.short, str(self.size))
class VGN_Coords(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=MAX_LENGTH, unique=True)
coords = models.CharField(max_length=MAX_LENGTH, unique=True)
longitude = models.CharField(max_length=MAX_LENGTH, unique=True)
latitude = models.CharField(max_length=MAX_LENGTH, unique=True)
latitude = models.CharField(max_length=MAX_LENGTH, unique=True)
def __str__(self):
return "%s" % self.name
class Lecture(models.Model):
id = models.AutoField(primary_key=True)
univis_ref = models.CharField(max_length=MAX_LENGTH, unique=True)
univis_id = models.CharField(max_length=MAX_LENGTH, unique=True)
name = models.CharField(max_length=MAX_LENGTH)
short = models.CharField(max_length=MAX_LENGTH)
type = models.CharField(max_length=MAX_LENGTH)
lecturer_id = models.CharField(max_length=MAX_LENGTH)
term = models.ManyToManyField('Lecture_Terms', blank=False)
def __str__(self):
return "%s - Type: %s" % (self.short, str(self.type))
class Lecture_Terms(models.Model):
id = models.AutoField(primary_key=True)
starttime = models.TimeField(blank=False, default=timezone.now())
room = models.ManyToManyField('Room', blank=True)
def __str__(self):
return "%s" % self.starttime.strftime("%Y-%m-%d")

View File

@ -1,66 +0,0 @@
import json
from pprint import pprint
from django.db.utils import IntegrityError
from apps.donar.models import Room
from apps.donar.utils.parser import univis_rooms_parser
# CONFIG
UNIVIS_RPG_GuK = "http://univis.uni-bamberg.de/prg?search=rooms&department=Fakult%E4t%20Geistes-%20und%20Kulturwissenschaften&show=xml"
UNIVIS_RPG_SoWi = "http://univis.uni-bamberg.de/prg?search=rooms&department=Fakult%E4t%20Sozial-%20und%20Wirtschaftswissenschaften&show=xml"
UNIVIS_RPG_HuWi = "http://univis.uni-bamberg.de/prg?search=rooms&department=Fakult%E4t%20Humanwissenschaften&show=xml"
UNIVIS_RPG_WIAI = "http://univis.uni-bamberg.de/prg?search=rooms&department=Fakult%E4t%20Wirtschaftsinformatik&show=xml"
def getJsonFromFile(path):
with open(path, "r") as file:
return json.load(file)
def writeFekideDataInDB(data):
for room in data:
try:
key = ""
address = ""
building_key = ""
floor = ""
name = ""
orgname = ""
short = ""
size = ""
description = ""
if '@key' in room:
key = room['@key']
if 'address' in room:
address = room['address']
if 'buildingkey' in room:
building_key = room['buildingkey']
if 'floor' in room:
floor = room['floor']
if 'name' in room:
name = room['name']
if 'short' in room:
short = room['short']
if 'size' in room:
size = room['size']
if 'description' in room:
description = room['description']
Room.objects.create(key=key, address=address, building_key=building_key, floor=floor, name=name,
orgname=orgname, short=short, size=size, description=description)
except IntegrityError:
# ignored
break
def main():
# get food jsons
writeFekideDataInDB(univis_rooms_parser.parsePage(UNIVIS_RPG_GuK))
writeFekideDataInDB(univis_rooms_parser.parsePage(UNIVIS_RPG_SoWi))
writeFekideDataInDB(univis_rooms_parser.parsePage(UNIVIS_RPG_HuWi))
writeFekideDataInDB(univis_rooms_parser.parsePage(UNIVIS_RPG_WIAI))
pprint("Room: " + str(Room.objects.count()))
if __name__ == '__main__':
main()

View File

@ -0,0 +1,124 @@
from apps.donar.models import Room, Lecture_Terms, Lecture
from datetime import datetime
import json
from pprint import pprint
from django.db.utils import IntegrityError
from apps.donar.utils.parser import univis_lectures_parser
# CONFIG Fakultaet
FAKULTAET_GuK = "Fakult%E4t%20Geistes-%20und%20Kulturwissenschaften"
FAKULTAET_SoWi = "Fakult%E4t%20Sozial-%20und%20Wirtschaftswissenschaften"
FAKULTAET_HuWi = "Fakult%E4t%20Humanwissenschaften"
FAKULTAET_WIAI = "Fakult%E4t%20Wirtschaftsinformatik"
# CONFIG ROOMS
def univis_rooms(fakultaet):
return "http://univis.uni-bamberg.de/prg?search=rooms&department=" + fakultaet + "&show=xml"
# CONFIG LECTURES
def univis_lectures(fakultaet):
return "http://univis.uni-bamberg.de/prg?search=lectures&department=" + fakultaet + "&show=exml"
def getJsonFromFile(path):
with open(path, "r") as file:
return json.load(file)
def writeUnivisLectureTermsInDB(lecture, lecture_obj):
if 'terms' in lecture:
if type(lecture['terms']['term']) == list:
for term in lecture['terms']['term']:
try:
term_obj = Lecture_Terms.objects.create()
starttime = "00:00"
if 'starttime' in term:
starttime = term['starttime']
term_obj.starttime = datetime.strptime(starttime, "%H:%M")
if 'room' in term:
room_id = term['room']['UnivISRef']['@key']
term_obj.room = [Room.objects.get(key=room_id)]
term_obj.save()
lecture_obj.term.add(term_obj)
except IntegrityError as err:
print(err.args)
else:
try:
term_obj = Lecture_Terms.objects.create()
univis_starttime = "00:00"
if 'starttime' in lecture['terms']['term']:
univis_starttime = lecture['terms']['term']['starttime']
term_obj.starttime = datetime.strptime(univis_starttime, '%H:%M')
if 'room' in lecture['terms']['term']:
room_id = lecture['terms']['term']['room']['UnivISRef']['@key']
pprint("Room: " + room_id)
Room.objects.get(key=room_id)
term_obj.room = [Room.objects.get(key=room_id)]
term_obj.save()
lecture_obj.term.add(term_obj)
except IntegrityError as err:
print(err.args)
def writeUnivisLectureDataInDB(data):
for lecture in data:
try:
key = ''
name = ''
orgname = ''
short = ''
lecture_type = ''
lecturer_id = ''
if '@key' in lecture:
key = lecture['@key']
if 'name' in lecture:
# TODO Fix name bug
name = lecture['name']
if 'id' in lecture:
univis_id = lecture['id']
if 'orgname' in lecture:
orgname = lecture['orgname']
if 'short' in lecture:
short = lecture['short']
if 'type' in lecture:
lecture_type = lecture['type']
if 'dozs' in lecture:
lecturer_id = dict(lecture['dozs']['doz']['UnivISRef'])['@key']
print("Lecture: " + name)
lecture_obj = Lecture.objects.create(univis_ref=key, univis_id=univis_id, name=name, short=short,
type=lecture_type, lecturer_id=lecturer_id)
writeUnivisLectureTermsInDB(lecture, lecture_obj)
lecture_obj.save()
except IntegrityError as err:
print(err.args)
return
def showStatus(status: str):
print(status)
pprint("Lectures: " + str(Lecture.objects.count()))
pprint("Lecture Terms: " + str(Lecture_Terms.objects.count()))
pprint("Room: " + str(Room.objects.count()))
def main():
# get food jsons
showStatus("Start with:")
# writeUnivisLectureDataInDB(univis_lectures_parser.parsePage(univis_lectures(FAKULTAET_SoWi)))
showStatus("After SoWi:")
# writeUnivisLectureDataInDB(univis_lectures_parser.parsePage(univis_lectures(FAKULTAET_GuK)))
showStatus("After GuK:")
writeUnivisLectureDataInDB(univis_lectures_parser.parsePage(univis_lectures(FAKULTAET_HuWi)))
showStatus("After HuWi:")
writeUnivisLectureDataInDB(univis_lectures_parser.parsePage(univis_lectures(FAKULTAET_WIAI)))
showStatus("After WIAI:")
if __name__ == '__main__':
main()

View File

@ -0,0 +1,108 @@
import json
from pprint import pprint
from django.db.utils import IntegrityError
from apps.donar.models import Room, Lecture_Terms, Lecture
from apps.donar.utils.parser import univis_rooms_parser
from apps.donar.utils.parser import univis_lectures_parser
# CONFIG Fakultaet
FAKULTAET_GuK = "Fakult%E4t%20Geistes-%20und%20Kulturwissenschaften"
FAKULTAET_SoWi = "Fakult%E4t%20Sozial-%20und%20Wirtschaftswissenschaften"
FAKULTAET_HuWi = "Fakult%E4t%20Humanwissenschaften"
FAKULTAET_WIAI = "Fakult%E4t%20Wirtschaftsinformatik"
# CONFIG Locations
RZ = "http://univis.uni-bamberg.de/prg?search=rooms&name=rz&show=xml"
WEBEREI = "http://univis.uni-bamberg.de/prg?search=rooms&name=we&show=xml"
FEKI = "http://univis.uni-bamberg.de/prg?search=rooms&name=f&show=xml"
MARKUSHAUS = "http://univis.uni-bamberg.de/prg?search=rooms&name=m&show=xml"
UNIVERSITAET = "http://univis.uni-bamberg.de/prg?search=rooms&name=u&show=xml"
KAPUZINERSTR = "http://univis.uni-bamberg.de/prg?search=rooms&name=k&show=xml"
ZWINGER = "http://univis.uni-bamberg.de/prg?search=rooms&name=z&show=xml"
AULA = "http://univis.uni-bamberg.de/prg?search=rooms&name=a&show=xml"
ZWINGER = "http://univis.uni-bamberg.de/prg?search=rooms&name=k&show=xml"
ZWINGER = "http://univis.uni-bamberg.de/prg?search=rooms&name=k&show=xml"
# CONFIG ROOMS
def univis_rooms(fakultaet):
return "http://univis.uni-bamberg.de/prg?search=rooms&department=" + fakultaet + "&show=xml"
# CONFIG LECTURES
def univis_lectures(fakultaet):
return "http://univis.uni-bamberg.de/prg?search=lectures&department=" + fakultaet + "&show=exml"
def univis_rooms_loc(kuerzel):
return "http://univis.uni-bamberg.de/prg?search=rooms&name=" + kuerzel + "&show=xml"
def getJsonFromFile(path):
with open(path, "r") as file:
return json.load(file)
def writeUnivisRoomDataInDB(data):
for room in data:
try:
key = ""
address = ""
building_key = ""
floor = ""
name = ""
orgname = ""
short = ""
size = ""
description = ""
if '@key' in room:
key = room['@key']
if 'address' in room:
address = room['address']
if 'buildingkey' in room:
building_key = room['buildingkey']
if 'floor' in room:
floor = room['floor']
if 'name' in room:
name = room['name']
if 'short' in room:
short = room['short']
if 'size' in room:
size = room['size']
if 'description' in room:
description = room['description']
Room.objects.create(key=key, address=address, building_key=building_key, floor=floor, name=name,
orgname=orgname, short=short, size=size, description=description)
except IntegrityError as err:
pprint(err.args)
def main():
# get food jsons
pprint("Begin: Room: " + str(Room.objects.count()))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms(FAKULTAET_GuK)))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms(FAKULTAET_SoWi)))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms(FAKULTAET_HuWi)))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms(FAKULTAET_WIAI)))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("k")))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("z")))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("u")))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("w")))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("f")))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("r")))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("h")))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("l")))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("m")))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("o")))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("p")))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("v")))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("w")))
writeUnivisRoomDataInDB(univis_rooms_parser.parsePage(univis_rooms_loc("d")))
pprint("Now: Room: " + str(Room.objects.count()))
if __name__ == '__main__':
main()

View File

@ -1,8 +1,7 @@
from django.core.management.base import BaseCommand, CommandError
from apps.donar.models import VGN_Coords
def migrate_locations():
def migrate():
locations = []
locations.append(
{'location': 'Erba', 'vgn_key': 'coord%3A4418901%3A629758%3ANAV4%3ABamberg%2C An der Weberei 5',
@ -65,13 +64,3 @@ def migrate_locations():
location_obj.coords = location['vgn_key']
location_obj.latitude = location['lat']
location_obj.longitude = location['lon']
class Command(BaseCommand):
help = "Imports Rooms from Univis PRG"
def add_arguments(self, parser):
pass
def handle(self, *args, **options):
migrate_locations()

View File

@ -0,0 +1,29 @@
import requests
import datetime
import xmltodict
import json
from pprint import pprint
def loadPage(url: str):
return requests.get(url).content
def getDay():
return datetime.datetime.today().strftime("%A, %d.%m.%Y")
def getLectures(dict: dict):
lectures = []
for lecture in dict['UnivIS']['Lecture']:
lectures.append(lecture)
return lectures
def parsePage(url):
page = loadPage(url)
dict = xmltodict.parse(page)
lectures = getLectures(dict)
return lectures
# parsePage( "http://univis.uni-bamberg.de/prg?search=lectures&department=Fakult%E4t%20Geistes-%20und%20Kulturwissenschaften&show=exml")

View File

@ -1,6 +1,6 @@
from django.shortcuts import render, redirect
from apps.donar.models import Room
from django.db.models import Min
from apps.donar.models import Room, Lecture, Lecture_Terms
from apps.donar.models import VGN_Coords
@ -15,11 +15,12 @@ def all_rooms(request):
def search_room(request):
id = request.GET.get('search_room', None)
if id:
token = request.GET.get('search_room', None)
if token:
# create a form instance and populate it with data from the request:
rooms = Room.objects.filter(short__contains=id)
return render(request, 'donar/search_rooms.jinja', {'id': id, 'rooms': rooms})
rooms_by_id = Room.objects.filter(short__contains=token)
lectures = Lecture.objects.annotate(min_starttime=Min('term__starttime')).filter(name__contains=token).order_by('min_starttime')
return render(request, 'donar/search_rooms.jinja', {'id': token, 'rooms': rooms_by_id, 'lectures': lectures})
return render(request, 'donar/search_rooms.jinja', {})

View File

@ -129,13 +129,13 @@ def main():
# deleteUnivisObjects()
# events, rooms, persons = univis_eventpage_parser.parsePage(UNIVIS_RPG_HuWi)
# writeUnivisDataInDB(events, rooms, persons)
# writeUnivisRoomDataInDB(events, rooms, persons)
# events, rooms, persons = univis_eventpage_parser.parsePage(UNIVIS_RPG_SoWi)
# writeUnivisDataInDB(events, rooms, persons)
# writeUnivisRoomDataInDB(events, rooms, persons)
# events, rooms, persons = univis_eventpage_parser.parsePage(UNIVIS_RPG_GuK)
# writeUnivisDataInDB(events, rooms, persons)
# writeUnivisRoomDataInDB(events, rooms, persons)
# events, rooms, persons = univis_eventpage_parser.parsePage(UNIVIS_RPG_WIAI)
# writeUnivisDataInDB(events, rooms, persons)
# writeUnivisRoomDataInDB(events, rooms, persons)
writeFekideDataInDB(fekide_eventpage_parser.parsePage())

View File

@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-10-25 23:47
# Generated by Django 1.11.2 on 2017-10-29 23:28
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
@ -11,6 +13,7 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
@ -50,14 +53,18 @@ class Migration(migrations.Migration):
('price_guest', models.CharField(blank=True, max_length=10, null=True)),
('image', models.ImageField(blank=True, upload_to='food/%Y/%m/')),
('rating', models.FloatField(default=0)),
('first_star', models.SmallIntegerField(default=0)),
('second_star', models.SmallIntegerField(default=0)),
('third_star', models.SmallIntegerField(default=0)),
('fourth_star', models.SmallIntegerField(default=0)),
('fifth_star', models.SmallIntegerField(default=0)),
('allergens', models.ManyToManyField(blank=True, to='food.Allergene')),
],
),
migrations.CreateModel(
name='UserRating',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('rating', models.FloatField(default=0)),
('food', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='food.SingleFood')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddField(
model_name='menu',
name='menu',

View File

@ -1,27 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-10-29 22:35
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('food', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='UserRating',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('rating', models.FloatField(default=0)),
('food', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='food.SingleFood')),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]

View File

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-10-29 22:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('food', '0002_userrating'),
]
operations = [
migrations.AlterField(
model_name='userrating',
name='id',
field=models.AutoField(primary_key=True, serialize=False),
),
]

View File

@ -1,27 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-10-29 22:43
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('food', '0003_auto_20171029_2341'),
]
operations = [
migrations.AlterField(
model_name='userrating',
name='food',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='food.SingleFood'),
),
migrations.AlterField(
model_name='userrating',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
]

View File

@ -1,35 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-10-29 23:23
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('food', '0004_auto_20171029_2343'),
]
operations = [
migrations.RemoveField(
model_name='singlefood',
name='fifth_star',
),
migrations.RemoveField(
model_name='singlefood',
name='first_star',
),
migrations.RemoveField(
model_name='singlefood',
name='fourth_star',
),
migrations.RemoveField(
model_name='singlefood',
name='second_star',
),
migrations.RemoveField(
model_name='singlefood',
name='third_star',
),
]

Binary file not shown.

Binary file not shown.

View File

@ -7,24 +7,45 @@
<div class="row pt-5">
<form type="get" action="{{ url('search-rooms') }}" style="margin: 0">
<input id="search_room" type="text" name="search_room" placeholder="Search...">
<button id="search_submit" type="submit">Submit</button>
<button id="search_submit" type="submit">Search</button>
</form>
</div>
<div class="row mt-4">
{% if id %}
{% if id %}
<div class="row mt-4">
<h2>Ergebnisse für: {{ id }}</h2>
{% endif %}
</div>
<div class="row">
{% if rooms %}
{% for room in rooms %}
<div class="col-12 p-1">
<div class="p-2 border border-dark rounded-3 border border-dark rounded bg-light text-dark">
<a href="{{ url('show-room', args=[room.short]) }}"><p><strong>Short:</strong> {{ room.short }}</p></a>
</div>
<div class="row">
{% if rooms %}
<h3>Ergebnisse Räume:</h3>
{% for room in rooms %}
<div class="col-12 p-1">
<div class="p-2 border border-dark rounded-3 border border-dark rounded bg-light text-dark">
<a href="{{ url('show-room', args=[room.short]) }}"><p>
<strong>Raum:</strong> {{ room.short }}</p></a>
</div>
</div>
</div>
{% endfor %}
{% endif %}
</div>
{% endfor %}
{% endif %}
</div>
<div class="row">
{% if lectures %}
<h3>Ergebnisse Lehrveranstaltungen:</h3>
{% for lecture in lectures %}
<div class="col-12 p-1">
<div class="p-2 border border-dark rounded-3 border border-dark rounded bg-light text-dark">
<h5>{{ lecture.name }}</h5>
{% for term in lecture.term.all() %}
<small>Start: {{ term.starttime.strftime("%H:%M") }}</small>
{% for room in term.room.all() %}
<a href="{{ url('show-room', args=[room.short]) }}"><p>
<strong>Raum:</strong> {{ room.short }}</p></a>
{% endfor %}
{% endfor %}
</div>
</div>
{% endfor %}
{% endif %}
</div>
{% endif %}
</div>
{% endblock %}