Skip to content

Commit 909bd83

Browse files
uds5501abhinavk96
authored andcommitted
Adding is-featured in events model and schema (fossasia#5563)
* Adding is-featured in events model and schema * Adding migration file * Changing `is_featured` default value * Setting `nullable` attribute to `True`
1 parent 4489a95 commit 909bd83

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

app/api/schema/events.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def validate_timezone(self, data, original_data):
118118
refund_policy = fields.String(dump_only=True,
119119
default='All sales are final. No refunds shall be issued in any case.')
120120
is_stripe_linked = fields.Boolean(dump_only=True, allow_none=True, default=False)
121+
is_featured = fields.Bool(default=False)
121122

122123
tickets = Relationship(attribute='tickets',
123124
self_view='v1.event_ticket',

app/models/event.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class Event(SoftDeletionModel):
4848
ends_at = db.Column(db.DateTime(timezone=True), nullable=False)
4949
timezone = db.Column(db.String, nullable=False, default="UTC")
5050
is_event_online = db.Column(db.Boolean, default=False)
51+
is_featured = db.Column(db.Boolean, default=False)
5152
latitude = db.Column(db.Float)
5253
longitude = db.Column(db.Float)
5354
location_name = db.Column(db.String)
@@ -215,6 +216,7 @@ def __init__(self,
215216
discount_code_id=None,
216217
onsite_details=None,
217218
is_tax_enabled=None,
219+
is_featured=False,
218220
is_sponsors_enabled=None,
219221
stripe_authorization=None,
220222
tax=None,
@@ -282,6 +284,7 @@ def __init__(self,
282284
self.order_expiry_time = order_expiry_time
283285
self.refund_policy = refund_policy
284286
self.is_stripe_linked = is_stripe_linked
287+
self.is_featured = is_featured
285288

286289
def __repr__(self):
287290
return '<Event %r>' % self.name

migrations/versions/498b78507b64_.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""empty message
2+
3+
Revision ID: 498b78507b64
4+
Revises: e3caa0f2a16c
5+
Create Date: 2019-01-31 14:35:08.791562
6+
7+
"""
8+
9+
from alembic import op
10+
import sqlalchemy as sa
11+
12+
13+
# revision identifiers, used by Alembic.
14+
revision = '498b78507b64'
15+
down_revision = 'e3caa0f2a16c'
16+
17+
18+
def upgrade():
19+
op.add_column(u'events',sa.Column('is_featured', sa.Boolean(), nullable=False))
20+
21+
22+
def downgrade():
23+
op.drop_column(u'events', 'is_featured')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy