Event: Fehlende Properties hinzugefügt

This commit is contained in:
Daniel Grams 2020-10-18 12:19:12 +02:00
parent 32a1b6dc4d
commit 69f8560e63
6 changed files with 76 additions and 0 deletions

View File

@ -56,6 +56,10 @@ class BaseEventForm(FlaskForm):
accessible_for_free = BooleanField(lazy_gettext('Accessible for free'), validators=[Optional()])
age_from = IntegerField(lazy_gettext('Typical Age from'), validators=[Optional()])
age_to = IntegerField(lazy_gettext('Typical Age to'), validators=[Optional()])
registration_required = BooleanField(lazy_gettext('Registration required'), validators=[Optional()])
booked_up = BooleanField(lazy_gettext('Booked up'), validators=[Optional()])
expected_participants = IntegerField(lazy_gettext('Expected number of participants'), validators=[Optional()])
price_info = TextAreaField(lazy_gettext('Price info'), validators=[Optional()])
target_group_origin = SelectField(lazy_gettext('Target group origin'), coerce=int, choices=[
(int(EventTargetGroupOrigin.both), lazy_gettext('EventTargetGroupOrigin.both')),

View File

@ -0,0 +1,46 @@
"""empty message
Revision ID: 0a282a331e35
Revises: da63ba1d58b1
Create Date: 2020-10-18 11:55:12.315808
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
import db
# revision identifiers, used by Alembic.
revision = '0a282a331e35'
down_revision = 'da63ba1d58b1'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
#op.drop_table('spatial_ref_sys')
op.add_column('event', sa.Column('booked_up', sa.Boolean(), nullable=True))
op.add_column('event', sa.Column('expected_participants', sa.Integer(), nullable=True))
op.add_column('event', sa.Column('price_info', sa.UnicodeText(), nullable=True))
op.add_column('event', sa.Column('registration_required', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('event', 'registration_required')
op.drop_column('event', 'price_info')
op.drop_column('event', 'expected_participants')
op.drop_column('event', 'booked_up')
op.create_table('spatial_ref_sys',
sa.Column('srid', sa.INTEGER(), autoincrement=False, nullable=False),
sa.Column('auth_name', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
sa.Column('auth_srid', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('srtext', sa.VARCHAR(length=2048), autoincrement=False, nullable=True),
sa.Column('proj4text', sa.VARCHAR(length=2048), autoincrement=False, nullable=True),
sa.CheckConstraint('(srid > 0) AND (srid <= 998999)', name='spatial_ref_sys_srid_check'),
sa.PrimaryKeyConstraint('srid', name='spatial_ref_sys_pkey')
)
# ### end Alembic commands ###

View File

@ -338,6 +338,11 @@ class Event(db.Model, TrackableMixin):
rejection_resaon = Column(IntegerEnum(EventRejectionReason))
rating = Column(Integer())
registration_required = Column(Boolean())
booked_up = Column(Boolean())
expected_participants = Column(Integer())
price_info = Column(UnicodeText())
@hybrid_property
def verified(self):
return self.review_status == EventReviewStatus.verified

View File

@ -161,6 +161,15 @@
{% endif %}
{% endmacro %}
{% macro render_int_prop(prop, icon = None, label_key = None) %}
{% if prop %}
<div>
{% if icon %}<i class="fa fa-fw {{ icon }}" data-toggle="tooltip" title="{{ _(label_key) }}"></i>{% endif %}
{{ prop }}
</div>
{% endif %}
{% endmacro %}
{% macro render_bool_prop(prop, icon, label_key) %}
{% if prop %}
<div>
@ -334,6 +343,7 @@
<div class="my-4">{{ event.description }}</div>
<div class="mt-4">
{{ render_string_prop(event.price_info, 'fa-euro-sign', 'Price info') }}
{{ render_link_prop(event.external_link) }}
{{ render_link_prop(event.ticket_link) }}
{% if event.category_id %}
@ -345,6 +355,9 @@
{{ render_range_prop(event.age_from, event.age_to, 'fa-people-arrows', 'Typical Age range') }}
{{ render_enum_prop(event.target_group_origin, 'fa-users', 'Target group origin') }}
{{ render_enum_prop(event.attendance_mode, 'fa-mouse-pointer', 'Attendance mode') }}
{{ render_bool_prop(event.registration_required, 'fa-list', 'Registration required') }}
{{ render_bool_prop(event.booked_up, 'fa-square-full', 'Booked up') }}
{{ render_int_prop(event.expected_participants, 'fa-users', 'Expected number of participants') }}
</div>
</div>
</div>

View File

@ -40,6 +40,7 @@ $( function() {
<div class="card-body">
{{ render_field_with_errors(form.name) }}
{{ render_field_with_errors(form.description) }}
{{ render_field_with_errors(form.price_info) }}
</div>
</div>
@ -115,6 +116,7 @@ $( function() {
{{ render_field_with_errors(form.kid_friendly, style="width: fit-content; flex: initial;") }}
{{ render_field_with_errors(form.age_from) }}
{{ render_field_with_errors(form.age_to) }}
{{ render_field_with_errors(form.expected_participants) }}
</div>
</div>
@ -131,6 +133,8 @@ $( function() {
{{ render_field_with_errors(form.tags) }}
{{ render_field_with_errors(form.attendance_mode, class="autocomplete w-100") }}
{{ render_field_with_errors(form.accessible_for_free, style="width: fit-content; flex: initial;") }}
{{ render_field_with_errors(form.registration_required, style="width: fit-content; flex: initial;") }}
{{ render_field_with_errors(form.booked_up, style="width: fit-content; flex: initial;") }}
</div>
</div>

View File

@ -17,6 +17,7 @@
<div class="card-body">
{{ render_field_with_errors(form.name) }}
{{ render_field_with_errors(form.description) }}
{{ render_field_with_errors(form.price_info) }}
</div>
</div>
@ -68,6 +69,7 @@
{{ render_field_with_errors(form.kid_friendly, style="width: fit-content; flex: initial;") }}
{{ render_field_with_errors(form.age_from) }}
{{ render_field_with_errors(form.age_to) }}
{{ render_field_with_errors(form.expected_participants) }}
</div>
</div>
@ -84,6 +86,8 @@
{{ render_field_with_errors(form.tags) }}
{{ render_field_with_errors(form.attendance_mode, class="autocomplete w-100") }}
{{ render_field_with_errors(form.accessible_for_free, style="width: fit-content; flex: initial;") }}
{{ render_field_with_errors(form.registration_required, style="width: fit-content; flex: initial;") }}
{{ render_field_with_errors(form.booked_up, style="width: fit-content; flex: initial;") }}
</div>
</div>