Newer
Older
__copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.conf.urls.static import static
from django.urls import include, path, register_converter
from scipost import views as scipost_views
from organizations.views import OrganizationListView
from affiliates.converters import Crossref_DOI_converter
from colleges.converters import CollegeSlugConverter
from comments.converters import (
CommentDOILabelConverter, AuthorReplyDOILabelConverter
)
from common.converters import (
FourDigitYearConverter, TwoDigitMonthConverter, TwoDigitDayConverter
)
from journals.converters import (
JournalDOILabelConverter,
IssueDOILabelConverter,
PublicationDOILabelConverter
)
from ontology.converters import (
AcademicFieldSlugConverter, SpecialtySlugConverter
)
from submissions.converters import (
IdentifierWithoutVersionNumberConverter, IdentifierConverter,
ReportDOILabelConverter
)
######################################
# Register all custom converters here:
######################################
# affiliates
register_converter(Crossref_DOI_converter, 'doi')
# colleges
register_converter(CollegeSlugConverter, 'college')
# comments
register_converter(CommentDOILabelConverter, 'comment_doi_label')
register_converter(AuthorReplyDOILabelConverter, 'author_reply_doi_label')
# common
register_converter(UnicodeSlugConverter, 'slug')
register_converter(FourDigitYearConverter, 'YYYY')
register_converter(TwoDigitMonthConverter, 'MM')
register_converter(TwoDigitDayConverter, 'DD')
register_converter(JournalDOILabelConverter, 'journal_doi_label')
register_converter(IssueDOILabelConverter, 'issue_doi_label')
register_converter(PublicationDOILabelConverter, 'publication_doi_label')
# ontology
register_converter(AcademicFieldSlugConverter, 'acad_field')
register_converter(SpecialtySlugConverter, 'specialty')
register_converter(IdentifierWithoutVersionNumberConverter, 'identifier_wo_vn_nr')
register_converter(IdentifierConverter, 'identifier')
register_converter(ReportDOILabelConverter, 'report_doi_label')
######################################
# End of custom converter registration
######################################
# Disable admin login view which is essentially a 2FA workaround.
admin.site.login = login_required(admin.site.login)
path(
'o/',
include('oauth2_provider.urls', namespace='oauth2_provider')
),
path(
'sitemap.xml',
scipost_views.sitemap_xml,
name='sitemap_xml'
),
path(
'admin/doc/',
include('django.contrib.admindocs.urls')
),
path(
'admin/',
admin.site.urls
),
path(
'affiliates/',
include('affiliates.urls', namespace='affiliates')
),
path(
'api/',
include('api.urls', namespace='api')
),
include('apimail.urls', namespace='apimail')
),
path(
'10.21468/<journal_doi_label:doi_label>/',
include('journals.urls.journal', namespace="prefixed_journal")
),
path(
'<journal_doi_label:doi_label>/',
include('journals.urls.journal', namespace="journal")
),
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
path(
'',
include('scipost.urls', namespace="scipost")
),
path(
'careers/',
include('careers.urls', namespace="careers")
),
path(
'colleges/',
include('colleges.urls', namespace="colleges")
),
path(
'commentaries/',
include('commentaries.urls', namespace="commentaries")
),
path(
'commentary/',
include('commentaries.urls', namespace="_commentaries")
),
path(
'comments/',
include('comments.urls', namespace="comments")
),
path(
'forums/',
include('forums.urls', namespace="forums")
),
path(
'funders/',
include('funders.urls', namespace="funders")
),
path(
'finances/',
include('finances.urls', namespace="finances")
),
path(
'guides/',
include('guides.urls', namespace="guides")
),
path(
'helpdesk/',
include('helpdesk.urls', namespace="helpdesk")
),
path(
'invitations/',
include('invitations.urls', namespace="invitations")
),
path(
'journals/',
include('journals.urls.general', namespace="journals")
),
path(
'mailing_list/',
include('mailing_lists.urls', namespace="mailing_lists")
),
path(
'markup/',
include('markup.urls', namespace='markup')
),
path(
'submissions/',
include('submissions.urls', namespace="submissions")
),
path(
'submission/',
include('submissions.urls', namespace="_submissions")
),
path(
'theses/',
include('theses.urls', namespace="theses")
),
path(
'thesis/',
include('theses.urls', namespace="_theses")
),
path(
'mails/',
include('mails.urls', namespace="mails")
),
path(
'news/',
include('news.urls', namespace="news")
),
path(
'ontology/',
include('ontology.urls', namespace="ontology")
),
path(
'organizations/',
include('organizations.urls', namespace="organizations")
),
path(
'petitions/',
include('petitions.urls', namespace="petitions")
),
path(
'preprints/',
include('preprints.urls', namespace="preprints")
),
path(
'proceedings/',
include('proceedings.urls', namespace="proceedings")
),
path(
'production/',
include('production.urls', namespace="production")
),
path(
'profiles/',
include('profiles.urls', namespace="profiles")
),
path(
'security/',
include('security.urls', namespace="security")
),
path(
'series/', include('series.urls', namespace="series")
),
path(
'sponsors/',
include('sponsors.urls', namespace="sponsors")
),
path(
'stats/',
include('stats.urls', namespace="stats")
),
if settings.DEBUG:
import debug_toolbar
urlpatterns += [path('__debug__/', include(debug_toolbar.urls))]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)