politikorama/app/routes.py

32 lines
1015 B
Python

# encoding: utf-8
from app import admin
from app.controller.admin import admin_routes
from app.controller.api.country import CountriesApi, CountryApi
from app.controller.api.representative import RepresentativesApi, RepresentativeApi
from app.controller.core import Core
from app.controller.representative import Representative
from app.controller.stance import Stance
# Adding admin endpoints
for route in admin_routes:
admin.add_view(route[0](name=route[1], endpoint=route[2], category=route[3]))
# Listing normal endpoints
routes = [
("/", Core.as_view("home")),
("/about", Core.as_view("about")),
("/who", Core.as_view("who")),
("/representative/<int:representative_id>", Representative.as_view("view")),
("/stance/add", Stance.as_view("add")),
]
# Listing API endpoints
apis = [
('/api/country', CountriesApi),
('/api/country/<country_id>', CountryApi),
('/api/representative', RepresentativesApi),
('/api/representative/<representative_id>', RepresentativeApi),
]