mirror of
https://github.com/lucaspalomodevelop/eventcally.git
synced 2026-03-13 00:07:22 +00:00
Kategorie
This commit is contained in:
parent
34f07ae562
commit
7dc40147aa
58
app.py
58
app.py
@ -40,7 +40,7 @@ db = SQLAlchemy(app)
|
||||
|
||||
# Setup Flask-Security
|
||||
# Define models
|
||||
from models import Image, EventSuggestion, EventSuggestionDate, OrgOrAdminUnit, Actor, Place, Location, User, Role, AdminUnit, AdminUnitMember, AdminUnitMemberRole, OrgMember, OrgMemberRole, Organization, AdminUnitOrg, AdminUnitOrgRole, Event, EventDate
|
||||
from models import EventCategory, Image, EventSuggestion, EventSuggestionDate, OrgOrAdminUnit, Actor, Place, Location, User, Role, AdminUnit, AdminUnitMember, AdminUnitMemberRole, OrgMember, OrgMemberRole, Organization, AdminUnitOrg, AdminUnitOrgRole, Event, EventDate
|
||||
user_datastore = SQLAlchemySessionUserDatastore(db.session, User, Role)
|
||||
security = Security(app, user_datastore)
|
||||
|
||||
@ -48,6 +48,26 @@ security = Security(app, user_datastore)
|
||||
def get_locale():
|
||||
return request.accept_languages.best_match(app.config['LANGUAGES'])
|
||||
|
||||
def print_dynamic_texts():
|
||||
gettext('Event_Art')
|
||||
gettext('Event_Book')
|
||||
gettext('Event_Movie')
|
||||
gettext('Event_Family')
|
||||
gettext('Event_Festival')
|
||||
gettext('Event_Religious')
|
||||
gettext('Event_Shopping')
|
||||
gettext('Event_Comedy')
|
||||
gettext('Event_Music')
|
||||
gettext('Event_Dance')
|
||||
gettext('Event_Nightlife')
|
||||
gettext('Event_Theater')
|
||||
gettext('Event_Dining')
|
||||
gettext('Event_Conference')
|
||||
gettext('Event_Meetup')
|
||||
gettext('Event_Fitness')
|
||||
gettext('Event_Sports')
|
||||
gettext('Event_Other')
|
||||
|
||||
def get_img_resource(res):
|
||||
with current_app.open_resource('static/img/' + res) as f:
|
||||
return f.read()
|
||||
@ -263,7 +283,15 @@ def upsert_event_suggestion(event_name, host_name, place_name, start, descriptio
|
||||
|
||||
return result
|
||||
|
||||
def upsert_event(event_name, host, location_name, start, description, link = None, verified = False, admin_unit = None, ticket_link=None, photo_res=None):
|
||||
def upsert_event_category(category_name):
|
||||
result = EventCategory.query.filter_by(name = category_name).first()
|
||||
if result is None:
|
||||
result = EventCategory(name = category_name)
|
||||
db.session.add(result)
|
||||
|
||||
return result
|
||||
|
||||
def upsert_event(event_name, host, location_name, start, description, link = None, verified = False, admin_unit = None, ticket_link=None, photo_res=None, category=None):
|
||||
if admin_unit is None:
|
||||
admin_unit = get_admin_unit('Stadt Goslar')
|
||||
place = upsert_place(location_name)
|
||||
@ -289,6 +317,9 @@ def upsert_event(event_name, host, location_name, start, description, link = Non
|
||||
if photo_res is not None:
|
||||
result.photo = upsert_image_with_res(result.photo, photo_res)
|
||||
|
||||
if category is not None:
|
||||
result.category = upsert_event_category(category)
|
||||
|
||||
return result
|
||||
|
||||
def get_event_hosts():
|
||||
@ -568,6 +599,26 @@ def get_event_suggestions_for_current_user():
|
||||
|
||||
@app.before_first_request
|
||||
def create_user():
|
||||
# Event categories
|
||||
upsert_event_category('Art')
|
||||
upsert_event_category('Book')
|
||||
upsert_event_category('Movie')
|
||||
upsert_event_category('Family')
|
||||
upsert_event_category('Festival')
|
||||
upsert_event_category('Religious')
|
||||
upsert_event_category('Shopping')
|
||||
upsert_event_category('Comedy')
|
||||
upsert_event_category('Music')
|
||||
upsert_event_category('Dance')
|
||||
upsert_event_category('Nightlife')
|
||||
upsert_event_category('Theater')
|
||||
upsert_event_category('Dining')
|
||||
upsert_event_category('Conference')
|
||||
upsert_event_category('Meetup')
|
||||
upsert_event_category('Fitness')
|
||||
upsert_event_category('Sports')
|
||||
upsert_event_category('Other')
|
||||
|
||||
# Admin units
|
||||
goslar = upsert_admin_unit('Stadt Goslar')
|
||||
harzburg = upsert_admin_unit('Stadt Bad Harzburg')
|
||||
@ -815,7 +866,8 @@ def create_user():
|
||||
'Auch im Jahr 2020 wagt sich das MINER’S ROCK wieder an eine Doppel-Schicht. LOTTE wird bei uns das Wochenende am Berg abrunden! Nach der bereits ausverkauften Schicht am 30. Oktober mit Subway to Sally, wird Lotte den Samstagabend zu einem Pop-Erlebnis machen.\nAb Anfang Februar ist sie in den Konzerthallen in Deutschland unterwegs und wird ihr neues Album „Glück“ vorstellen. Glück ist der langersehnte Nachfolger von LOTTEs Debütalbum „Querfeldein". Mit Songs wie der ersten Single „Schau mich nicht so an" oder dem Duett mit Max Giesinger „Auf das was da noch kommt“, durchmisst LOTTE dabei die Höhen und Tiefen des menschlichen Glücksstrebens. Und auch wenn jeder der zwölf Songs seine eigene Geschichte erzählt – sie alle eint die Suche nach der ganz persönlichen Bedeutung dieses großen Wortes. Glück ist kein Werk über einen abgeschlossenen Prozess, sondern ein beeindruckend ehrliches und facettenreiches Album über eine menschliche Suche. „Auf das was da noch kommt“ läuft derzeit in den Radiostationen auf und ab und macht einfach Spaß.\n\nWichtig zu wissen:\n\nEinlass: 19:00 Uhr\nBeginn des Musikprogramms: 20:00 Uhr\nTickets gibt es ab sofort im Shop des MINER‘S ROCK unter www.miners-rock.de und in den Geschäftsstellen der Goslarschen Zeitung.',
|
||||
'https://www.miners-rock.de/xvi-lotte',
|
||||
ticket_link='https://www.regiolights.de/tickets/product/schicht-xvi-lotte',
|
||||
photo_res="lotte.jpeg")
|
||||
photo_res="lotte.jpeg",
|
||||
category='Music')
|
||||
|
||||
db.session.commit()
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: ea09dc1839df
|
||||
Revision ID: 4c52ae230b29
|
||||
Revises:
|
||||
Create Date: 2020-06-23 12:04:01.423454
|
||||
Create Date: 2020-06-23 14:55:52.652970
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
@ -10,7 +10,7 @@ import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ea09dc1839df'
|
||||
revision = '4c52ae230b29'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
@ -34,6 +34,12 @@ def upgrade():
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.create_table('eventcategory',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.Unicode(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('name')
|
||||
)
|
||||
op.create_table('orgmemberrole',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=80), nullable=True),
|
||||
@ -235,8 +241,10 @@ def upgrade():
|
||||
sa.Column('ticket_link', sa.String(length=255), nullable=True),
|
||||
sa.Column('verified', sa.Boolean(), nullable=True),
|
||||
sa.Column('photo_id', sa.Integer(), nullable=True),
|
||||
sa.Column('category_id', sa.Integer(), nullable=True),
|
||||
sa.Column('created_by_id', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['admin_unit_id'], ['adminunit.id'], ),
|
||||
sa.ForeignKeyConstraint(['category_id'], ['eventcategory.id'], ),
|
||||
sa.ForeignKeyConstraint(['created_by_id'], ['user.id'], ),
|
||||
sa.ForeignKeyConstraint(['host_id'], ['org_or_adminunit.id'], ),
|
||||
sa.ForeignKeyConstraint(['photo_id'], ['image.id'], ),
|
||||
@ -284,6 +292,7 @@ def downgrade():
|
||||
op.drop_table('user')
|
||||
op.drop_table('role')
|
||||
op.drop_table('orgmemberrole')
|
||||
op.drop_table('eventcategory')
|
||||
op.drop_table('adminunitorgrole')
|
||||
op.drop_table('adminunitmemberrole')
|
||||
# ### end Alembic commands ###
|
||||
15
models.py
15
models.py
@ -196,6 +196,11 @@ class Place(db.Model, TrackableMixin):
|
||||
description = Column(UnicodeText())
|
||||
|
||||
# Events
|
||||
class EventCategory(db.Model):
|
||||
__tablename__ = 'eventcategory'
|
||||
id = Column(Integer(), primary_key=True)
|
||||
name = Column(Unicode(255), nullable=False, unique=True)
|
||||
|
||||
class EventSuggestion(db.Model, TrackableMixin):
|
||||
__tablename__ = 'eventsuggestion'
|
||||
id = Column(Integer(), primary_key=True)
|
||||
@ -236,14 +241,12 @@ class Event(db.Model, TrackableMixin):
|
||||
verified = Column(Boolean())
|
||||
photo_id = db.Column(db.Integer, db.ForeignKey('image.id'))
|
||||
photo = db.relationship('Image', uselist=False)
|
||||
category_id = db.Column(db.Integer, db.ForeignKey('eventcategory.id'))
|
||||
category = relationship('EventCategory', uselist=False)
|
||||
|
||||
dates = relationship('EventDate', backref=backref('event', lazy=False), cascade="all, delete-orphan")
|
||||
# wiederkehrende Dates sind zeitlich eingeschränkt
|
||||
# beim event müsste man dann auch nochmal start_time (nullable=False) und end_time machen.
|
||||
#photo: image(1200x628)
|
||||
#category: relationship, nullable=False
|
||||
# Facebook: ART_EVENT, BOOK_EVENT, MOVIE_EVENT, FUNDRAISER, VOLUNTEERING, FAMILY_EVENT, FESTIVAL_EVENT, NEIGHBORHOOD, RELIGIOUS_EVENT, SHOPPING, COMEDY_EVENT, MUSIC_EVENT, DANCE_EVENT, NIGHTLIFE, THEATER_EVENT, DINING_EVENT, FOOD_TASTING, CONFERENCE_EVENT, MEETUP, CLASS_EVENT, LECTURE, WORKSHOP, FITNESS, SPORTS_EVENT, OTHER
|
||||
# Kärnten: https://veranstaltungen.kaernten.at/api/v2/categories
|
||||
#keywords/tags = Column(String(255)) oder liste?
|
||||
#kid_friendly: bool
|
||||
# target_group:
|
||||
@ -253,9 +256,6 @@ class Event(db.Model, TrackableMixin):
|
||||
#
|
||||
#
|
||||
# = kärnten =
|
||||
# categories: Feste Kategorien sind für Werbung interessant
|
||||
# subEvents: List<Event>, konkrete Events mit allen Eigenschaften, An Event that is part of this event. For example, a conference event includes many presentations, each of which is a subEvent of the conference.
|
||||
# superEvent: siehe oben
|
||||
# eventSchedules: RepeatFrequency (wiederkehrende Beschreibung, keine konkreten Daten)
|
||||
# allDay: bool
|
||||
# status: Scheduled (Default), Cancelled, MovedOnline, Postponed, Rescheduled
|
||||
@ -263,7 +263,6 @@ class Event(db.Model, TrackableMixin):
|
||||
# attendanceMode: Offline, Online, Mixed
|
||||
# isAccessibleForFree: bool
|
||||
# typicalAgeRange: string (9-99)
|
||||
# Zusätzliche Organisationen oder Personen: composer, contributor, funder, organizer, sponsor
|
||||
|
||||
# (Multiple Events möglich, wiederholend oder frei, dann aber mit endzeit)
|
||||
# Facebook Limitations:
|
||||
|
||||
@ -33,6 +33,12 @@
|
||||
<div class="my-4">{{ render_image(event.photo_id) }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if event.category_id %}
|
||||
<div class="my-4">
|
||||
<div><i class="fa fa-fw fa-archive" data-toggle="tooltip" title="{{ _('Category') }}"></i> {{ _('Event_' + event.category.name) }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="my-4">{{ event.description }}</div>
|
||||
|
||||
{% if event.external_link or event.ticket_link %}
|
||||
|
||||
Binary file not shown.
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2020-06-19 15:08+0200\n"
|
||||
"POT-Creation-Date: 2020-06-23 15:12+0200\n"
|
||||
"PO-Revision-Date: 2020-06-07 18:51+0200\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language: de\n"
|
||||
@ -18,59 +18,144 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel 2.8.0\n"
|
||||
|
||||
#: app.py:869
|
||||
#: app.py:52
|
||||
msgid "Event_Art"
|
||||
msgstr "Kunst"
|
||||
|
||||
#: app.py:53
|
||||
msgid "Event_Book"
|
||||
msgstr "Literatur"
|
||||
|
||||
#: app.py:54
|
||||
msgid "Event_Movie"
|
||||
msgstr "Film"
|
||||
|
||||
#: app.py:55
|
||||
msgid "Event_Family"
|
||||
msgstr "Familie"
|
||||
|
||||
#: app.py:56
|
||||
msgid "Event_Festival"
|
||||
msgstr "Festival"
|
||||
|
||||
#: app.py:57
|
||||
msgid "Event_Religious"
|
||||
msgstr "Religion"
|
||||
|
||||
#: app.py:58
|
||||
msgid "Event_Shopping"
|
||||
msgstr "Shopping"
|
||||
|
||||
#: app.py:59
|
||||
msgid "Event_Comedy"
|
||||
msgstr "Comedy"
|
||||
|
||||
#: app.py:60
|
||||
msgid "Event_Music"
|
||||
msgstr "Musik"
|
||||
|
||||
#: app.py:61
|
||||
msgid "Event_Dance"
|
||||
msgstr "Tanz"
|
||||
|
||||
#: app.py:62
|
||||
msgid "Event_Nightlife"
|
||||
msgstr "Party"
|
||||
|
||||
#: app.py:63
|
||||
msgid "Event_Theater"
|
||||
msgstr "Theater"
|
||||
|
||||
#: app.py:64
|
||||
msgid "Event_Dining"
|
||||
msgstr "Essen"
|
||||
|
||||
#: app.py:65
|
||||
msgid "Event_Conference"
|
||||
msgstr "Konferenz"
|
||||
|
||||
#: app.py:66
|
||||
msgid "Event_Meetup"
|
||||
msgstr "Networking"
|
||||
|
||||
#: app.py:67
|
||||
msgid "Event_Fitness"
|
||||
msgstr "Fitness"
|
||||
|
||||
#: app.py:68
|
||||
msgid "Event_Sports"
|
||||
msgstr "Sport"
|
||||
|
||||
#: app.py:69
|
||||
msgid "Event_Other"
|
||||
msgstr "Sonstiges"
|
||||
|
||||
#: app.py:986
|
||||
msgid "Event successfully created"
|
||||
msgstr "Veranstaltung erfolgreich erstellt"
|
||||
|
||||
#: app.py:901
|
||||
#: app.py:1018
|
||||
msgid "Event suggestion successfully created"
|
||||
msgstr "Veranstaltungsvorschlag erfolgreich erstellt"
|
||||
|
||||
#: templates/_macros.html:74 templates/event/create.html:6
|
||||
#: templates/_macros.html:72 templates/event/create.html:6
|
||||
msgid "Create event"
|
||||
msgstr "Veranstaltung erstellen"
|
||||
|
||||
#: templates/_macros.html:76 templates/event_suggestion/create.html:6
|
||||
#: templates/_macros.html:74 templates/event_suggestion/create.html:6
|
||||
msgid "Suggest event"
|
||||
msgstr "Veranstaltung vorschlagen"
|
||||
|
||||
#: templates/_macros.html:82 templates/event_suggestion/list.html:3
|
||||
#: templates/_macros.html:80 templates/event_suggestion/list.html:3
|
||||
#: templates/event_suggestion/list.html:7
|
||||
msgid "Event suggestions"
|
||||
msgstr "Veranstaltungsvorschläge"
|
||||
|
||||
#: templates/_macros.html:95 templates/event.html:25
|
||||
#: templates/_macros.html:93 templates/event.html:25
|
||||
#: templates/event_suggestion/list.html:13
|
||||
#: templates/event_suggestion/read.html:18 templates/events.html:16
|
||||
msgid "Date"
|
||||
msgstr "Datum"
|
||||
|
||||
#: templates/_macros.html:96 templates/admin/admin_units.html:18
|
||||
#: templates/_macros.html:94 templates/admin/admin_units.html:18
|
||||
#: templates/admin_unit.html:45 templates/admin_unit.html:67
|
||||
#: templates/admin_units.html:13 templates/event_suggestion/list.html:14
|
||||
#: templates/events.html:17 templates/home.html:23 templates/home.html:45
|
||||
#: templates/organization.html:42 templates/organizations.html:13
|
||||
#: templates/profile.html:15 templates/profile.html:37
|
||||
#: templates/organization.html:58 templates/organizations.html:13
|
||||
#: templates/place/list.html:13 templates/profile.html:15
|
||||
#: templates/profile.html:37
|
||||
msgid "Name"
|
||||
msgstr "Name"
|
||||
|
||||
#: templates/_macros.html:97 templates/event.html:42
|
||||
#: templates/_macros.html:95 templates/event.html:52
|
||||
#: templates/event/create.html:23 templates/event_suggestion/list.html:15
|
||||
#: templates/events.html:18
|
||||
msgid "Host"
|
||||
msgstr "Veranstalter"
|
||||
|
||||
#: templates/_macros.html:98 templates/event.html:26
|
||||
#: templates/_macros.html:96 templates/_macros.html:154 templates/event.html:26
|
||||
#: templates/event_suggestion/list.html:16
|
||||
#: templates/event_suggestion/read.html:41 templates/events.html:19
|
||||
msgid "Location"
|
||||
msgstr "Ort"
|
||||
|
||||
#: templates/_macros.html:118
|
||||
#: templates/_macros.html:106 templates/event.html:28 templates/events.html:29
|
||||
msgid "Verified"
|
||||
msgstr "Verifiziert"
|
||||
|
||||
#: templates/_macros.html:119
|
||||
msgid "Show all events"
|
||||
msgstr "Alle Veranstaltungen anzeigen"
|
||||
|
||||
#: templates/admin_unit.html:14 templates/organization.html:14
|
||||
#: templates/_macros.html:135
|
||||
msgid "Show on Google Maps"
|
||||
msgstr "Auf Google Maps anzeigen"
|
||||
|
||||
#: templates/_macros.html:145
|
||||
msgid "Link"
|
||||
msgstr "Link"
|
||||
|
||||
#: templates/admin_unit.html:14 templates/organization.html:17
|
||||
msgid "Members"
|
||||
msgstr "Mitglieder"
|
||||
|
||||
@ -82,8 +167,7 @@ msgstr "Organisationen"
|
||||
|
||||
#: templates/admin_unit.html:25 templates/events.html:4 templates/events.html:8
|
||||
#: templates/home.html:12 templates/layout.html:58
|
||||
#: templates/organization.html:17 templates/organization.html:21
|
||||
#: templates/place/read.html:24
|
||||
#: templates/organization.html:21 templates/place/read.html:16
|
||||
msgid "Events"
|
||||
msgstr "Veranstaltungen"
|
||||
|
||||
@ -92,7 +176,7 @@ msgid "You are a member of this admin unit."
|
||||
msgstr "Du bist Mitglied dieser Verwaltungseinheit"
|
||||
|
||||
#: templates/admin_unit.html:46 templates/admin_unit.html:68
|
||||
#: templates/home.html:24 templates/home.html:46 templates/organization.html:43
|
||||
#: templates/home.html:24 templates/home.html:46 templates/organization.html:59
|
||||
#: templates/profile.html:16 templates/profile.html:38
|
||||
msgid "Roles"
|
||||
msgstr "Rollen"
|
||||
@ -112,13 +196,9 @@ msgstr "Diese Veranstaltung als nicht verifiziert markieren"
|
||||
msgid "Mark event as verified"
|
||||
msgstr "Diese Veranstaltung als verifiziert markieren"
|
||||
|
||||
#: templates/event.html:28 templates/events.html:29
|
||||
msgid "Verified"
|
||||
msgstr "Verifiziert"
|
||||
|
||||
#: templates/event.html:36
|
||||
msgid "Link"
|
||||
msgstr "Link"
|
||||
#: templates/event.html:38
|
||||
msgid "Category"
|
||||
msgstr "Kategorie"
|
||||
|
||||
#: templates/home.html:7
|
||||
msgid "Hi there!"
|
||||
@ -132,20 +212,29 @@ msgstr "Deine Verwaltungseinheiten"
|
||||
msgid "Your Organizations"
|
||||
msgstr "Deine Organisationen"
|
||||
|
||||
#: templates/layout.html:67 templates/profile.html:3
|
||||
#: templates/layout.html:59 templates/place/list.html:3
|
||||
#: templates/place/list.html:7
|
||||
msgid "Places"
|
||||
msgstr "Orte"
|
||||
|
||||
#: templates/layout.html:68 templates/profile.html:3
|
||||
msgid "Profile"
|
||||
msgstr "Profil"
|
||||
|
||||
#: templates/admin/admin.html:3 templates/admin/admin.html:9
|
||||
#: templates/admin/admin_units.html:9 templates/layout.html:70
|
||||
#: templates/admin/admin_units.html:9 templates/layout.html:71
|
||||
msgid "Admin"
|
||||
msgstr "Administration"
|
||||
|
||||
#: templates/layout.html:74
|
||||
#: templates/layout.html:75
|
||||
msgid "Logout"
|
||||
msgstr "Ausloggen"
|
||||
|
||||
#: templates/organization.html:32
|
||||
#: templates/organization.html:13 templates/place/read.html:13
|
||||
msgid "Info"
|
||||
msgstr "Info"
|
||||
|
||||
#: templates/organization.html:48
|
||||
msgid "You are a member of this organization."
|
||||
msgstr "Du bist Mitglied dieser Organisation"
|
||||
|
||||
@ -210,10 +299,6 @@ msgstr "Kontakt Name"
|
||||
msgid "Contact email"
|
||||
msgstr "Kontakt Email"
|
||||
|
||||
#: templates/place/read.html:18
|
||||
msgid "Show on Google Maps"
|
||||
msgstr "Auf Google Maps anzeigen"
|
||||
|
||||
#~ msgid "You"
|
||||
#~ msgstr "Du"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user