From f7cc572b5741ef1133f816d5bbf9d572e85bff34 Mon Sep 17 00:00:00 2001 From: Kiran Jonnalagadda Date: Wed, 10 Apr 2024 15:59:23 +0530 Subject: [PATCH] Fix compatibility with Coaster --- get-twitter.py | 3 +-- hasjob/views/admin_filterset.py | 5 +++-- hasjob/views/campaign.py | 6 ++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/get-twitter.py b/get-twitter.py index f90ac1ac0..ca4292c79 100755 --- a/get-twitter.py +++ b/get-twitter.py @@ -6,9 +6,8 @@ import tweepy -from hasjob import app, init_for +from hasjob import app -init_for('dev') auth = tweepy.OAuthHandler( app.config['TWITTER_CONSUMER_KEY'], app.config['TWITTER_CONSUMER_SECRET'] ) diff --git a/hasjob/views/admin_filterset.py b/hasjob/views/admin_filterset.py index 789b41ad0..458ecf0ab 100644 --- a/hasjob/views/admin_filterset.py +++ b/hasjob/views/admin_filterset.py @@ -10,8 +10,9 @@ @route('/f') -class AdminFiltersetView(UrlForView, ModelView): - model = Filterset +class AdminFiltersetView(UrlForView, ModelView[Filterset]): + + route_model_map = {'name': 'name'} def loader(self, name=None): if name: diff --git a/hasjob/views/campaign.py b/hasjob/views/campaign.py index 4f5604aaf..151f264a7 100644 --- a/hasjob/views/campaign.py +++ b/hasjob/views/campaign.py @@ -172,9 +172,8 @@ def wrapper(self, *args, **kwargs): @route('/admin/campaign/') -class AdminCampaignView(UrlForView, InstanceLoader, ModelView): +class AdminCampaignView(UrlForView, InstanceLoader, ModelView[Campaign]): __decorators__ = [lastuser.requires_permission('siteadmin'), campaign_current_tab] - model = Campaign route_model_map = {'campaign': 'name'} @classmethodproperty @@ -410,12 +409,11 @@ def view_counts(self): @route('/admin/campaign//') -class AdminCampaignActionView(UrlForView, InstanceLoader, ModelView): +class AdminCampaignActionView(UrlForView, InstanceLoader, ModelView[CampaignAction]): __decorators__ = [ lastuser.requires_permission('siteadmin'), campaign_action_current_tab, ] - model = CampaignAction route_model_map = {'action': 'name', 'campaign': 'parent.name'} @classmethodproperty