Esempio n. 1
0
                    RedirectToSearch, RedirectFloorListToSearch,
                    RedirectToMepFromEPID)

urlpatterns = patterns('memopol.meps.views',
    # those view are *very* expansive. we cache them in RAM for a week
    url(r'^names/$', MEPList.as_view(), name='index_names'),
    url(r'^inactive/$', MEPList.as_view(active=False), name='index_inactive'),
    url(r'^score/$', MEPList.as_view(queryset=MEP.objects.filter(active=True).exclude(total_score__isnull=True).order_by('position'), score_listing=True), name='scores'),

    url(r'^opinion/$', ListView.as_view(queryset=Opinion.with_meps_count().order_by('-_date').select_related('_author')), name='index_opinions'),
    url(r'^opinion/(?P<pk>[0-9]+)/$', MEPsFromView.as_view(model=Opinion, template_name="meps/opinion_detail.html"), name='index_by_opinions'),
    url(r'^organization/$', ListView.as_view(queryset=Organization.with_meps_count()), name='index_organizations'),
    url(r'^organization/(?P<pk>[0-9]+)/$', MEPsFromView.as_view(model=Organization, organization_role=True), name='index_by_organization'),
    url(r'^country/$', ListView.as_view(queryset=Country.with_meps_count()), name='index_countries'),
    url(r'^country/(?P<value>[a-zA-Z][a-zA-Z])/$', RedirectToSearch.as_view(filter="country"), name='index_by_country'),
    url(r'^group/$', ListView.as_view(queryset=Group.ordered_by_meps_count()), name='index_groups'),
    url(r'^group/(?P<value>[a-zA-Z/-]+)/$', RedirectToSearch.as_view(filter="group"), name='index_by_group'),
    url(r'^committee/$', ListView.as_view(queryset=Committee.ordered_by_meps_count()), name='index_committees'),
    url(r'^committee/(?P<value>[A-Z]+)/$', RedirectToSearch.as_view(filter="committees"), name='index_by_committee'),
    url(r'^delegation/$', ListView.as_view(queryset=Delegation.with_meps_count()), name='index_delegations'),
    url(r'^delegation/(?P<value>[0-9]+)/$', RedirectToSearch.as_view(filter="delegations"), name='index_by_delegation'),
    url(r'^party/$', ListView.as_view(queryset=LocalParty.with_meps_count().order_by('country').select_related('country')), name='index_parties'),
    url(r'^party/(?P<pk>[0-9]+)-(?P<slugified_name>[0-9a-z\-]*)/$', PartyView.as_view(),  name='index_by_party'),
    url(r'^floor/$', ListView.as_view(queryset=Building.objects.order_by('postcode')), name='index_floor'),
    url(r'^floor/brussels/(?P<building>\w+)/(?P<floor>\w+)/$', RedirectFloorListToSearch.as_view(city="bxl"), name='bxl_floor'),
    url(r'^floor/strasbourg/(?P<building>\w+)/(?P<floor>\w+)/$', RedirectFloorListToSearch.as_view(city="stg"), name='stg_floor'),

    url(r'^vote/', include('memopol.meps_votes.urls', namespace="votes", app_name="meps_votes")),

    url(r'^votes/$', lambda request: redirect(reverse("meps:votes:index_votes"))),
Esempio n. 2
0
     name="index_opinions",
 ),
 url(
     r"^opinion/(?P<pk>[0-9]+)/$",
     MEPsFromView.as_view(model=Opinion, template_name="meps/opinion_detail.html"),
     name="index_by_opinions",
 ),
 url(r"^organization/$", ListView.as_view(queryset=Organization.with_meps_count()), name="index_organizations"),
 url(
     r"^organization/(?P<pk>[0-9]+)/$",
     MEPsFromView.as_view(model=Organization, organization_role=True),
     name="index_by_organization",
 ),
 url(r"^country/$", ListView.as_view(queryset=Country.with_meps_count()), name="index_countries"),
 url(r"^country/(?P<value>[a-zA-Z][a-zA-Z])/$", RedirectToSearch.as_view(filter="country"), name="index_by_country"),
 url(r"^group/$", ListView.as_view(queryset=Group.ordered_by_meps_count()), name="index_groups"),
 url(r"^group/(?P<value>[a-zA-Z/-]+)/$", RedirectToSearch.as_view(filter="group"), name="index_by_group"),
 url(r"^committee/$", ListView.as_view(queryset=Committee.ordered_by_meps_count()), name="index_committees"),
 url(r"^committee/(?P<value>[A-Z]+)/$", RedirectToSearch.as_view(filter="committees"), name="index_by_committee"),
 url(r"^delegation/$", ListView.as_view(queryset=Delegation.with_meps_count()), name="index_delegations"),
 url(r"^delegation/(?P<value>[0-9]+)/$", RedirectToSearch.as_view(filter="delegations"), name="index_by_delegation"),
 url(
     r"^party/$",
     ListView.as_view(queryset=LocalParty.with_meps_count().order_by("country").select_related("country")),
     name="index_parties",
 ),
 url(r"^party/(?P<pk>[0-9]+)-(?P<slugified_name>[0-9a-z\-]*)/$", PartyView.as_view(), name="index_by_party"),
 url(r"^floor/$", ListView.as_view(queryset=Building.objects.order_by("postcode")), name="index_floor"),
 url(
     r"^floor/brussels/(?P<building>\w+)/(?P<floor>\w+)/$",
     RedirectFloorListToSearch.as_view(city="bxl"),
Esempio n. 3
0
def build_menu():
    return {
        'menus': [{
            'id': 'countries_menu',
            'name': 'Country',
            'content': ({
                "url": "country:%s is_active:1" % country.code,
                "display": country.name,
                "sprite": "sprite-country_small-%s" % country.code} for country in Country.objects.all().order_by("name")),
            'flyout_class': 'four',
        },
        {
            'id': 'groups_menu',
            'name': 'Political group',
            'content': ({
                "url": "group:%s is_active:1" % group.abbreviation,
                "display": group.name,
                "sprite": "sprite-eu_group-%s" % group.abbreviation.replace("/", "")} for group in Group.ordered_by_meps_count()),
            'flyout_class': 'twelve',
        },
        {
            'id': 'committees_menu',
            'name': 'Committees',
            'content': ({
                "url": "committees:%s is_active:1" % committee.abbreviation,
                "code": committee.abbreviation,
                "display": committee.name} for committee in Committee.ordered_by_meps_count()),
            'flyout_class': 'twelve',
        },
        ]
    }