def get(self, event_code): interested_list = EventsInterestedModel.get_all_interested_event_code(event_code) EventsModel.change_new_interest(event_code, 'N') return { 'interested_list': interested_list }
def post(self): data = self.parser.parse_args() counter = str(EventsModel.get_counter(1)) event_code = "event-" + counter file = data['file'] if file is not None: if file.filename == '': return {'message': 'The uploaded file has no filename'} if file and self.allowed_file(file.filename): filename = secure_filename(file.filename) file_name_list = filename.split('.') new_file_name = os.path.normpath(os.path.join(self.UPLOAD_FOLDER_SUBMISSIONS_PATH, event_code + '.' + file_name_list[len(file_name_list)-1])) file.save(new_file_name) event = EventsModel(event_code, data['event_name'], data['event_description'], data['start_date'], data['end_date'], data['start_time'], data['end_time'], data['venue'], new_file_name, data['organiser_code'], 'N') event.save_to_db() else: event = EventsModel(event_code, data['event_name'], data['event_description'], data['start_date'], data['end_date'], data['start_time'], data['end_time'], data['venue'], None, data['organiser_code'], 'N') event.save_to_db() return { 'message': 'Event registration successful' }, 201
def post(self): data = self.parser.parse_args() event_interest = EventsInterestedModel(data['event_code'], data['roll_no']) event_interest.save_to_db() EventsModel.change_new_interest(data['event_code'], 'Y') return { 'message': 'Your interest has been recorded to the database. The event organiser will ' 'be notified of the same' }
def get(self, id): event = EventsModel.find_by_event_id(id) if event: return event.json() return {'message': 'Event not found.'}, 404
def patch(self, event_name): event = EventsModel.find_by_name(event_name) data = PatchLocation.parser.parse_args() if event: event.longitude = data['longitude'] event.latitude = data['latitude'] event.save_to_db() return event.json()
def get(self, roll_no): interested_list = EventsInterestedModel.get_all_interested_roll_no(roll_no) for interest in interested_list: event = EventsModel.find_by_event_code(interest['event_code']) interest['event_name'] = event.event_name interest['start_date'] = event.start_date interest['end_date'] = event.end_time return { 'interested_list': interested_list }
def get(self, event_code): event = EventsModel.find_by_event_code(event_code) filename = event.file_path if filename is None: return {'message': 'this event has no file'} else: file_list = filename.split('.') file_dictionary = { 'filename': filename } return send_file(file_dictionary['filename'])
def post(self, business_id): business = BusinessModel.find_by_id(business_id) if business: data = Event.parser.parse_args() else: return {'message': 'business does not exist'}, 404 if EventsModel.find_by_name(data['event_name']): return { 'message': "An event with name '{}' already exists.".format( data['event_name']) }, 400 event = EventsModel(data['event_name'], data['name'], business_id, data['description'], data['address'], data['cityname'], data['postcode'], data['event_type'], data['date'], data['doorsopen'], data['doorsclose'], data['minage'], data['entryprice'], data['url'], data['longitude'], data['latitude']) try: event.save_to_db() except: return {"message": "An error occurred inserting the event."}, 500 return event.json(), 201
def get(self): events_object_list = EventsModel.get_all_events() events_dictionary = { 'events': [] } for event in events_object_list: dictionary = { 'event_code': event.event_code, 'event_name': event.event_name, 'event_description': event.event_description, 'start_date': event.start_date, 'end_date': event.end_date, 'start_time': event.start_time, 'end_time': event.end_time, 'organiser_code': event.organiser_code, 'new_interest': event.new_interest } events_dictionary['events'].append(dictionary) return events_dictionary
def patch(self, event_name): data = Event.parser.parse_args() event = EventsModel.find_by_name(name) if event: event.event_name = data['event_name'] event.name = data['name'] event.address = data['address'] event.cityname = data['cityname'] event.postcode = data['address'] event.description = data['description'] event.event_type = data['event_type'] event.date = data['date'] event.doorsopen = data['doorsopen'] event.doorsclose = data['doorsclose'] event.minage = data['minage'] event.entryprice = data['entryprice'] event.url = data['url'] event.save_to_db() return event.json()
def delete(self, id): event = EventsModel.find_by_event_id(id) if event: event.delete_from_db() return {'message': 'Event deleted.'} return {'message': 'Event not found.'}, 404
def get(self, event_code): event = EventsModel.find_by_event_code(event_code) return event.json()
import ConfigParser from os.path import expanduser import re import time from pygeocoder import Geocoder from libs import KKTIX from h4_scripts.Facebook import Facebook, Graph from models.group_websites import GroupWebsitesModel from models.group_facebook_id import GroupFacebookIDModel from models.events import EventsModel from models.places import PlacesModel group_websites_model = GroupWebsitesModel() group_facebook_id_model = GroupFacebookIDModel() events_model = EventsModel() places_model = PlacesModel() config_file = expanduser("~") + '/.opensourcefeeds.cfg' config = ConfigParser.SafeConfigParser() config.read(config_file) # meetup = Meetup(config.get('MEETUP', 'key')) facebook = Facebook() facebook.login(config.get('FACEBOOK', 'username'), config.get('FACEBOOK', 'password')) token = facebook.get_token() facebook_graph = Graph(token) # def parse_meetup_group_urlname(url):
import ConfigParser from os.path import expanduser import re import time from libs import KKTIX from libs import Accupass from libs.Meetup import Meetup from h4_scripts.Facebook import Facebook, Graph from models.group_facebook_id import GroupFacebookIDModel from models.events import EventsModel from models.group_websites import GroupWebsitesModel group_facebook_id_model = GroupFacebookIDModel() events_model = EventsModel() group_websites_model = GroupWebsitesModel() from helpers import facebook_helper config_file = expanduser("~") + '/.opensourcefeeds.cfg' config = ConfigParser.SafeConfigParser() config.read(config_file) meetup = Meetup(config.get('MEETUP', 'key')) facebook = Facebook() facebook.login(config.get('FACEBOOK', 'username'), config.get('FACEBOOK', 'password')) token = facebook.get_token() facebook_graph = Graph(token)
def delete(self, event_name): event = EventsModel.find_by_name(event_name) if event: event.delete_from_db() return {'message': 'Event deleted.'} return {'message': 'Event not found.'}, 404
def get(self, event_name): event = EventsModel.find_by_name(event_name) if event: return event.json() return {'message': '`Event` not found'}, 404
def get(self, business_id): events = EventsModel.find_by_id(business_id) return {'events': list(map(lambda x: x.json(), events))}