diff --git a/forms/event.py b/forms/event.py index 13a32d2..45d9778 100644 --- a/forms/event.py +++ b/forms/event.py @@ -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')), diff --git a/migrations/versions/0a282a331e35_.py b/migrations/versions/0a282a331e35_.py new file mode 100644 index 0000000..a90c863 --- /dev/null +++ b/migrations/versions/0a282a331e35_.py @@ -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 ### diff --git a/models.py b/models.py index 7deec0b..a511d71 100644 --- a/models.py +++ b/models.py @@ -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 diff --git a/templates/_macros.html b/templates/_macros.html index 197f7f5..7611084 100644 --- a/templates/_macros.html +++ b/templates/_macros.html @@ -161,6 +161,15 @@ {% endif %} {% endmacro %} +{% macro render_int_prop(prop, icon = None, label_key = None) %} +{% if prop %} +