Merge lp:~widelands-dev/widelands-website/mv_main_files into lp:widelands-website
- mv_main_files
- Merge into trunk
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 531 | ||||||||
Proposed branch: | lp:~widelands-dev/widelands-website/mv_main_files | ||||||||
Merge into: | lp:widelands-website | ||||||||
Diff against target: |
1003 lines (+139/-140) 34 files modified
README.txt (+43/-39) mainpage/settings.py (+3/-3) mainpage/sitemap_urls.py (+1/-2) mainpage/templatetags/wl_markdown.py (+9/-9) mainpage/urls.py (+2/-2) mainpage/utest/test_wl_markdown.py (+2/-2) mainpage/views.py (+6/-6) mainpage/wlwebsite_wsgi.py (+1/-1) manage.py (+1/-1) news/models.py (+0/-1) privacy_policy/views.py (+1/-1) threadedcomments/views.py (+1/-1) widelandslib/make_flow_diagram.py (+2/-2) widelandslib/tribe.py (+3/-3) wiki/forms.py (+3/-2) wiki/templates/wiki/backlinks.html (+2/-1) wiki/urls.py (+13/-13) wiki/views.py (+2/-2) wlggz/migrations/0001_initial.py (+1/-1) wlggz/models.py (+1/-3) wlhelp/management/commands/update_help.py (+12/-12) wlhelp/management/commands/update_help_pdf.py (+5/-5) wlhelp/views.py (+0/-2) wlimages/models.py (+2/-2) wlmaps/forms.py (+4/-5) wlmaps/tests/test_views.py (+0/-2) wlmaps/views.py (+4/-3) wlprofile/forms.py (+1/-1) wlprofile/migrations/0001_initial.py (+1/-1) wlprofile/models.py (+2/-2) wlprofile/templatetags/custom_date.py (+3/-3) wlscheduling/templates/wlscheduling/other-users.html (+3/-2) wlscreens/models.py (+3/-3) wlscreens/tests/test_models.py (+2/-2) |
||||||||
To merge this branch: | bzr merge lp:~widelands-dev/widelands-website/mv_main_files | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
GunChleoc | Approve | ||
Review via email: mp+365634@code.launchpad.net |
Commit message
Moved main files into folder mainpage
Description of the change
Python3 is more restrictive with relative imports. Moving the mainfiles into the directory 'mainpage' is made to perform this.
In python terms: The folder widelands (containing manage.py) will no longer be a 'package'. Running manage.py will call anything inside the package 'mainpage' and thus relative imports will work again.
This reflects also the initial structure of a django project, like shown here: https:/
Running the 2to3 script (for porting python2 to python3 code) produces less faulty code in regard to imports after this change.
I have also moved the privacy template to his origin (privacy_policy).
Should be tested on alpha.
- 534. By kaputtnik
-
removed superfluous comment
kaputtnik (franku) wrote : | # |
GunChleoc (gunchleoc) wrote : | # |
Tested and working :)
Just 1 small nit for the English language.
- 535. By kaputtnik
-
addressed code review; fixed missing static templatetags
kaputtnik (franku) wrote : | # |
Thanks, all fixed, also the smiley thing(s).
I'll do the merge eventually this evening.
kaputtnik (franku) wrote : | # |
This is merged and deployed. Now we can definitely work on porting to python3 :)
I had to change the init-file to let gunicorn find the moved file wlwebsite_wsgi.py
Preview Diff
1 | === modified file 'README.txt' |
2 | --- README.txt 2018-12-30 11:45:03 +0000 |
3 | +++ README.txt 2019-04-08 05:56:42 +0000 |
4 | @@ -57,6 +57,7 @@ |
5 | |
6 | This will take a while. If no errors are shown we should be fine. |
7 | |
8 | + |
9 | Setting up the website |
10 | ====================== |
11 | |
12 | @@ -68,8 +69,8 @@ |
13 | those files and modify them to your needs - most likely everything works |
14 | directly, but you might want to edit the bd variable in local_settings.py:: |
15 | |
16 | - $ ln -s local_urls.py.sample local_urls.py |
17 | - $ ln -s local_settings.py.sample local_settings.py |
18 | + $ ln -s local_urls.py.sample mainpage/local_urls.py |
19 | + $ ln -s local_settings.py.sample mainpage/local_settings.py |
20 | |
21 | Setting up the database |
22 | ----------------------- |
23 | @@ -125,60 +126,63 @@ |
24 | See also https://docs.djangoproject.com/en/dev/ref/django-admin/#examples-of-using-different-ports-and-addresses |
25 | for further details. |
26 | |
27 | + |
28 | Dependencies between website and widelands source code |
29 | ====================================================== |
30 | |
31 | -Some parts of the website need access to the source code of widelands: |
32 | - |
33 | -* Online help/Encyclopedia |
34 | -* Possibility to upload a map onto the local website |
35 | -* Source code documentation |
36 | - |
37 | -You will need the widelands source code for this, see |
38 | +Some parts of the website need access to the source code of widelands, other |
39 | +parts need some widelands executables. |
40 | + |
41 | +Source code only |
42 | +---------------- |
43 | + |
44 | +The documentation is made out of the source code. To get a copy, see: |
45 | |
46 | https://wl.widelands.org/wiki/BzrPrimer/ |
47 | |
48 | After the source code is downloaded, adjust the path of |
49 | |
50 | -WIDELANDS_SVN_DIR |
51 | - |
52 | -in local_settings.py to the path where the widelands source code is found. |
53 | - |
54 | -Setting up the online help / encyclopedia |
55 | ------------------------------------------ |
56 | - |
57 | -You will need graphviz to generate the graphs for the online help. On Ubuntu run: |
58 | +WIDELANDS_SVN_DIR = '/path/to/widelands/trunk' |
59 | + |
60 | +in mainpage/local_settings.py to the path where the widelands source code can be |
61 | +found. Then run: |
62 | + |
63 | + $ ./manage.py create_docs |
64 | + |
65 | +After finishing without errors, type localhost:8000/documentation/index.html |
66 | +in your browsers addressbar or click on "Development -> Documentation". |
67 | + |
68 | +Widelands executables |
69 | +--------------------- |
70 | + |
71 | +Widelands executables are needed to: |
72 | + |
73 | +* Upload maps to the website |
74 | +* Create the Encylopdia |
75 | + |
76 | +Either install widelands as a program to your operating system, or create the |
77 | +binaries by compiling the source code. If you want to compile, run: |
78 | + |
79 | + $ ./compile.sh -r |
80 | + |
81 | +inside of the WIDELANDS_SVN_DIR to create a release build. |
82 | + |
83 | +Uploading maps should work now. |
84 | + |
85 | +Creating the encyclopdia needs graphviz to generate the graphs. On Ubuntu run: |
86 | |
87 | $ sudo apt-get install graphviz |
88 | |
89 | -To generate the online help database switch to your local environment and run: |
90 | +To generate the online help switch to your local environment and run: |
91 | |
92 | $ ./manage.py update_help |
93 | |
94 | -After that you can create the overview pdf files with |
95 | +Now you can create the economy graphs: |
96 | |
97 | $ ./manage.py update_help_pdf |
98 | |
99 | -Setting up widelands source code documentation |
100 | ----------------------------------------------- |
101 | - |
102 | -There is a small helper script to get the documenation. Be sure |
103 | -you have set WIDELANDS_SVN_DIR set in local_settings.py. Run: |
104 | - |
105 | - $ ./manage.py create_docs |
106 | - |
107 | -After finishing without errors, type localhost:8000/documentation/index.html |
108 | -in your browsers addressbar or click on "Development -> Documentation". |
109 | - |
110 | - |
111 | -Uploading a map to the local website |
112 | ------------------------------------- |
113 | - |
114 | -Compile the widelands binaries by using the compile.sh script |
115 | - |
116 | - $ ./compile.sh |
117 | - |
118 | -Now you should be able to upload a map onto your local website. |
119 | +You can access the encyclopdia by clicking on 'The Game -> Encyclopedia' now. |
120 | + |
121 | |
122 | Contact |
123 | ======= |
124 | |
125 | === removed file '__init__.py' |
126 | === renamed file 'mainpage/urls.py' => 'mainpage/mainpage_urls.py' |
127 | === renamed file 'online_users_middleware.py' => 'mainpage/online_users_middleware.py' |
128 | === renamed file 'settings.py' => 'mainpage/settings.py' |
129 | --- settings.py 2019-03-04 17:53:53 +0000 |
130 | +++ mainpage/settings.py 2019-04-08 05:56:42 +0000 |
131 | @@ -3,7 +3,7 @@ |
132 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) |
133 | import os |
134 | |
135 | -BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
136 | +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
137 | DEBUG = True |
138 | |
139 | ADMINS = ( |
140 | @@ -68,7 +68,7 @@ |
141 | # Make this unique, and don't share it with anybody. |
142 | SECRET_KEY = '#*bc7*q0-br42fc&6l^x@zzk&(=-#gr!)fn@t30n54n05jkqcu' |
143 | |
144 | -ROOT_URLCONF = 'urls' |
145 | +ROOT_URLCONF = 'mainpage.urls' |
146 | |
147 | # List of finder classes that know how to find static files in |
148 | # various locations. |
149 | @@ -132,7 +132,7 @@ |
150 | |
151 | # Foreign middleware |
152 | 'dj_pagination.middleware.PaginationMiddleware', |
153 | - 'online_users_middleware.OnlineNowMiddleware', |
154 | + 'mainpage.online_users_middleware.OnlineNowMiddleware', |
155 | ] |
156 | |
157 | TEMPLATES = [ |
158 | |
159 | === renamed file 'sitemap_urls.py' => 'mainpage/sitemap_urls.py' |
160 | --- sitemap_urls.py 2018-03-21 21:10:46 +0000 |
161 | +++ mainpage/sitemap_urls.py 2019-04-08 05:56:42 +0000 |
162 | @@ -1,6 +1,5 @@ |
163 | -from django.conf.urls import * |
164 | +from django.conf.urls import url |
165 | |
166 | -from mainpage.views import mainpage |
167 | from django.contrib.sitemaps.views import sitemap |
168 | from static_sitemap import StaticViewSitemap |
169 | from wiki.sitemap import * |
170 | |
171 | === renamed file 'static_sitemap.py' => 'mainpage/static_sitemap.py' |
172 | === modified file 'mainpage/templatetags/wl_markdown.py' |
173 | --- mainpage/templatetags/wl_markdown.py 2018-11-30 14:31:47 +0000 |
174 | +++ mainpage/templatetags/wl_markdown.py 2019-04-08 05:56:42 +0000 |
175 | @@ -13,7 +13,7 @@ |
176 | from django.conf import settings |
177 | from django.utils.encoding import smart_str, force_unicode |
178 | from django.utils.safestring import mark_safe |
179 | -from settings import BLEACH_ALLOWED_TAGS, BLEACH_ALLOWED_ATTRIBUTES |
180 | +from django.conf import settings |
181 | from markdownextensions.semanticwikilinks.mdx_semanticwikilinks import SemanticWikiLinkExtension |
182 | |
183 | # Try to get a not so fully broken markdown module |
184 | @@ -38,17 +38,17 @@ |
185 | |
186 | # We will also need the site domain |
187 | from django.contrib.sites.models import Site |
188 | -from settings import SITE_ID, SMILEYS, SMILEY_DIR |
189 | +from django.conf import settings |
190 | |
191 | try: |
192 | - _domain = Site.objects.get(pk=SITE_ID).domain |
193 | + _domain = Site.objects.get(pk=settings.SITE_ID).domain |
194 | except: |
195 | _domain = '' |
196 | |
197 | # Getting local domain lists |
198 | try: |
199 | - from settings import LOCAL_DOMAINS as _LOCAL_DOMAINS |
200 | - LOCAL_DOMAINS = [_domain] + _LOCAL_DOMAINS |
201 | + from django.conf import settings |
202 | + LOCAL_DOMAINS = [_domain] + settings.LOCAL_DOMAINS |
203 | except ImportError: |
204 | LOCAL_DOMAINS = [_domain] |
205 | |
206 | @@ -76,12 +76,12 @@ |
207 | |
208 | for i, word in enumerate(words): |
209 | smiley = '' |
210 | - for sc, img in SMILEYS: |
211 | + for sc, img in settings.SMILEYS: |
212 | if word == sc: |
213 | smiley = img |
214 | if smiley: |
215 | img_tag = BeautifulSoup(features='lxml').new_tag('img') |
216 | - img_tag['src'] = '{}{}'.format(SMILEY_DIR, smiley) |
217 | + img_tag['src'] = '{}{}'.format(settings.SMILEY_DIR, smiley) |
218 | img_tag['alt'] = smiley |
219 | tmp_content.append(img_tag) |
220 | # apply a space after the smiley |
221 | @@ -204,7 +204,7 @@ |
222 | if bs4_string.parent.name.lower() == 'code': |
223 | return False |
224 | |
225 | - for sc in SMILEYS: |
226 | + for sc in settings.SMILEYS: |
227 | if sc[0] in bs4_string: |
228 | return True |
229 | return False |
230 | @@ -223,7 +223,7 @@ |
231 | # Sanitize posts from potencial untrusted users (Forum/Wiki/Maps) |
232 | if 'bleachit' in args: |
233 | html = mark_safe(bleach.clean( |
234 | - html, tags=BLEACH_ALLOWED_TAGS, attributes=BLEACH_ALLOWED_ATTRIBUTES)) |
235 | + html, tags=settings.BLEACH_ALLOWED_TAGS, attributes=settings.BLEACH_ALLOWED_ATTRIBUTES)) |
236 | |
237 | # Prepare the html and apply smileys and classes. |
238 | # BeautifulSoup objects are all references, so changing a variable |
239 | |
240 | === renamed file 'urls.py' => 'mainpage/urls.py' |
241 | --- urls.py 2019-03-16 10:11:05 +0000 |
242 | +++ mainpage/urls.py 2019-04-08 05:56:42 +0000 |
243 | @@ -13,7 +13,7 @@ |
244 | |
245 | urlpatterns = [ |
246 | # Creating a sitemap.xml |
247 | - url(r'^sitemap\.xml/', include('sitemap_urls')), |
248 | + url(r'^sitemap\.xml/', include('mainpage.sitemap_urls')), |
249 | # Static view of robots.txt |
250 | url(r'^robots\.txt/', TemplateView.as_view(template_name='robots.txt', content_type="text/plain")), |
251 | |
252 | @@ -45,7 +45,7 @@ |
253 | url(r'^forum/', include('pybb.urls')), |
254 | |
255 | # WL specific: |
256 | - url(r'^', include('mainpage.urls')), |
257 | + url(r'^', include('mainpage.mainpage_urls')), |
258 | url(r'^help/(?P<path>.*)', RedirectView.as_view(url='/encyclopedia/%(path)s', |
259 | permanent=True)), # to not break old links |
260 | url(r'^encyclopedia/', include('wlhelp.urls')), |
261 | |
262 | === modified file 'mainpage/utest/test_wl_markdown.py' |
263 | --- mainpage/utest/test_wl_markdown.py 2016-12-13 18:28:51 +0000 |
264 | +++ mainpage/utest/test_wl_markdown.py 2019-04-08 05:56:42 +0000 |
265 | @@ -17,9 +17,9 @@ |
266 | import unittest |
267 | from wiki.models import Article |
268 | from django.contrib.sites.models import Site |
269 | -from settings import SITE_ID |
270 | +from django.conf import settings |
271 | from django.test import TestCase as DBTestCase |
272 | -_domain = Site.objects.get(pk=SITE_ID).domain |
273 | +_domain = Site.objects.get(pk=settings.SITE_ID).domain |
274 | |
275 | from templatetags.wl_markdown import do_wl_markdown |
276 | |
277 | |
278 | === modified file 'mainpage/views.py' |
279 | --- mainpage/views.py 2019-02-09 14:50:47 +0000 |
280 | +++ mainpage/views.py 2019-04-08 05:56:42 +0000 |
281 | @@ -1,4 +1,4 @@ |
282 | -from settings import WIDELANDS_SVN_DIR, INQUIRY_RECIPIENTS |
283 | +from django.conf import settings |
284 | from templatetags.wl_markdown import do_wl_markdown |
285 | from operator import itemgetter |
286 | from django.core.mail import send_mail |
287 | @@ -33,7 +33,7 @@ |
288 | |
289 | # get email addresses which are in form of ('name','email'), |
290 | recipients = [] |
291 | - for recipient in INQUIRY_RECIPIENTS: |
292 | + for recipient in settings.INQUIRY_RECIPIENTS: |
293 | recipients.append(recipient[1]) |
294 | |
295 | send_mail(subject, message, sender, |
296 | @@ -46,7 +46,7 @@ |
297 | |
298 | return render(request, 'mainpage/legal_notice.html', { |
299 | 'form': form, |
300 | - 'inquiry_recipients': INQUIRY_RECIPIENTS, |
301 | + 'inquiry_recipients': settings.INQUIRY_RECIPIENTS, |
302 | }) |
303 | |
304 | |
305 | @@ -67,7 +67,7 @@ |
306 | txt = '[TOC]\n\n' |
307 | transl_files = [] |
308 | transl_list = [] |
309 | - path = os.path.normpath(WIDELANDS_SVN_DIR + 'data/i18n/locales/') |
310 | + path = os.path.normpath(settings.WIDELANDS_SVN_DIR + 'data/i18n/locales/') |
311 | try: |
312 | transl_files = os.listdir(path) |
313 | if transl_files: |
314 | @@ -100,7 +100,7 @@ |
315 | # Get other developers, put in the translators list |
316 | # at given position and prepare all for wl_markdown |
317 | try: |
318 | - with open(WIDELANDS_SVN_DIR + 'data/txts/developers.json', 'r') as f: |
319 | + with open(settings.WIDELANDS_SVN_DIR + 'data/txts/developers.json', 'r') as f: |
320 | json_data = json.load(f)['developers'] |
321 | |
322 | for head in json_data: |
323 | @@ -145,7 +145,7 @@ |
324 | This replaces the wiki changelog |
325 | |
326 | """ |
327 | - data = codecs.open(WIDELANDS_SVN_DIR + 'ChangeLog', encoding='utf-8', mode='r').read() |
328 | + data = codecs.open(settings.WIDELANDS_SVN_DIR + 'ChangeLog', encoding='utf-8', mode='r').read() |
329 | return render(request, 'mainpage/changelog.html', |
330 | {'changelog': data}, |
331 | ) |
332 | |
333 | === renamed file 'wl_utils.py' => 'mainpage/wl_utils.py' |
334 | === renamed file 'wlwebsite_wsgi.py' => 'mainpage/wlwebsite_wsgi.py' |
335 | --- wlwebsite_wsgi.py 2016-12-13 18:28:51 +0000 |
336 | +++ mainpage/wlwebsite_wsgi.py 2019-04-08 05:56:42 +0000 |
337 | @@ -22,7 +22,7 @@ |
338 | sys.path.append(code_directory) |
339 | sys.path.append(os.path.join(code_directory, 'widelands')) |
340 | |
341 | -os.environ['DJANGO_SETTINGS_MODULE'] = 'widelands.settings' |
342 | +os.environ['DJANGO_SETTINGS_MODULE'] = 'mainpage.settings' |
343 | |
344 | if os.path.exists('/usr/games'): |
345 | os.environ['PATH'] += ':/usr/games' |
346 | |
347 | === modified file 'manage.py' |
348 | --- manage.py 2016-12-13 18:28:51 +0000 |
349 | +++ manage.py 2019-04-08 05:56:42 +0000 |
350 | @@ -3,7 +3,7 @@ |
351 | import sys |
352 | |
353 | if __name__ == '__main__': |
354 | - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings') |
355 | + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mainpage.settings') |
356 | |
357 | from django.core.management import execute_from_command_line |
358 | |
359 | |
360 | === modified file 'news/models.py' |
361 | --- news/models.py 2018-04-08 14:40:17 +0000 |
362 | +++ news/models.py 2019-04-08 05:56:42 +0000 |
363 | @@ -6,7 +6,6 @@ |
364 | from news.managers import PublicManager |
365 | from django.urls import reverse |
366 | import datetime |
367 | -import settings |
368 | import tagging |
369 | |
370 | |
371 | |
372 | === added directory 'privacy_policy/templates' |
373 | === added directory 'privacy_policy/templates/privacy_policy' |
374 | === renamed file 'mainpage/templates/mainpage/privacy_policy.html' => 'privacy_policy/templates/privacy_policy/privacy_policy.html' |
375 | === modified file 'privacy_policy/views.py' |
376 | --- privacy_policy/views.py 2019-02-09 19:57:06 +0000 |
377 | +++ privacy_policy/views.py 2019-04-08 05:56:42 +0000 |
378 | @@ -43,4 +43,4 @@ |
379 | 'cur_lang': current_lang, |
380 | } |
381 | |
382 | - return render(request, 'mainpage/privacy_policy.html', context) |
383 | + return render(request, 'privacy_policy/privacy_policy.html', context) |
384 | |
385 | === modified file 'threadedcomments/views.py' |
386 | --- threadedcomments/views.py 2018-10-10 18:02:55 +0000 |
387 | +++ threadedcomments/views.py 2019-04-08 05:56:42 +0000 |
388 | @@ -8,7 +8,7 @@ |
389 | from threadedcomments.forms import ThreadedCommentForm |
390 | from threadedcomments.models import ThreadedComment, DEFAULT_MAX_COMMENT_LENGTH |
391 | from threadedcomments.utils import JSONResponse, XMLResponse |
392 | -from wl_utils import get_real_ip |
393 | +from mainpage.wl_utils import get_real_ip |
394 | |
395 | |
396 | def _adjust_max_comment_length(form, field_name='comment'): |
397 | |
398 | === modified file 'widelandslib/make_flow_diagram.py' |
399 | --- widelandslib/make_flow_diagram.py 2016-12-13 18:28:51 +0000 |
400 | +++ widelandslib/make_flow_diagram.py 2019-04-08 05:56:42 +0000 |
401 | @@ -3,7 +3,7 @@ |
402 | |
403 | import pydot as d |
404 | |
405 | -from settings import MEDIA_ROOT |
406 | +from django.conf import settings |
407 | from widelandslib.tribe import * |
408 | |
409 | from os import makedirs, path |
410 | @@ -182,7 +182,7 @@ |
411 | global tdir |
412 | tdir = mkdtemp(prefix='widelands-help') |
413 | |
414 | - json_directory = path.normpath(MEDIA_ROOT + '/map_object_info') |
415 | + json_directory = path.normpath(settings.MEDIA_ROOT + '/map_object_info') |
416 | tribeinfo_file = open(path.normpath( |
417 | json_directory + '/tribe_' + tribe_name + '.json'), 'r') |
418 | tribeinfo = json.load(tribeinfo_file) |
419 | |
420 | === modified file 'widelandslib/tribe.py' |
421 | --- widelandslib/tribe.py 2016-12-13 18:28:51 +0000 |
422 | +++ widelandslib/tribe.py 2019-04-08 05:56:42 +0000 |
423 | @@ -4,8 +4,8 @@ |
424 | import os.path as p |
425 | import json |
426 | try: |
427 | - from settings import WIDELANDS_SVN_DIR |
428 | - basedir = WIDELANDS_SVN_DIR |
429 | + from django.conf import settings |
430 | + basedir = settings.WIDELANDS_SVN_DIR |
431 | except: |
432 | basedir = p.join(p.dirname(__file__), p.pardir, p.pardir) |
433 | |
434 | @@ -20,7 +20,7 @@ |
435 | |
436 | @property |
437 | def image(self): |
438 | - return p.abspath(p.join(WIDELANDS_SVN_DIR, 'data', self._json['icon'])) |
439 | + return p.abspath(p.join(settings.WIDELANDS_SVN_DIR, 'data', self._json['icon'])) |
440 | |
441 | |
442 | class Ware(BaseDescr): |
443 | |
444 | === renamed file 'diff_match_patch.py' => 'wiki/diff_match_patch.py' |
445 | === modified file 'wiki/forms.py' |
446 | --- wiki/forms.py 2018-09-18 06:42:18 +0000 |
447 | +++ wiki/forms.py 2019-04-08 05:56:42 +0000 |
448 | @@ -7,14 +7,15 @@ |
449 | |
450 | from wiki.models import Article |
451 | from wiki.models import ChangeSet |
452 | -from settings import WIKI_WORD_RE |
453 | +from django.conf import settings |
454 | + |
455 | try: |
456 | from notification import models as notification |
457 | except: |
458 | notification = None |
459 | |
460 | |
461 | -wikiword_pattern = re.compile('^' + WIKI_WORD_RE + '$') |
462 | +wikiword_pattern = re.compile('^' + settings.WIKI_WORD_RE + '$') |
463 | |
464 | |
465 | class ArticleForm(forms.ModelForm): |
466 | |
467 | === modified file 'wiki/templates/wiki/backlinks.html' |
468 | --- wiki/templates/wiki/backlinks.html 2018-06-03 15:33:37 +0000 |
469 | +++ wiki/templates/wiki/backlinks.html 2019-04-08 05:56:42 +0000 |
470 | @@ -1,6 +1,7 @@ |
471 | {% extends 'wiki/base.html' %} |
472 | {% load wiki_extras %} |
473 | {% load i18n %} |
474 | +{% load static %} |
475 | |
476 | {% block title %} |
477 | {{ name }} - Backlinks - {{block.super}} |
478 | @@ -36,7 +37,7 @@ |
479 | {% endif %} |
480 | {% else %} |
481 | <p><span class="errormessage">Every Wikipage must be linked from at least one another page.</span> |
482 | - Please link it <img src="/wlmedia/img/smileys/face-smile.png" alt="face-smile.png"> See <a href="/wiki/WikiSyntax/#links">Wiki Syntax</a> for help.</p></p> |
483 | + Please link it <img src="{% static 'img/smileys/face-smile.png' %}" alt="face-smile.png"> See <a href="/wiki/WikiSyntax/#links">Wiki Syntax</a> for help.</p></p> |
484 | {% endif %} |
485 | </div> |
486 | {% endblock %} |
487 | |
488 | === modified file 'wiki/urls.py' |
489 | --- wiki/urls.py 2017-02-24 20:12:28 +0000 |
490 | +++ wiki/urls.py 2019-04-08 05:56:42 +0000 |
491 | @@ -3,7 +3,7 @@ |
492 | from django.conf.urls import * |
493 | from django.http import HttpResponseRedirect |
494 | from wiki import views, models |
495 | -from settings import WIKI_URL_RE |
496 | +from django.conf import settings |
497 | from django.views.generic import RedirectView |
498 | from wiki.feeds import RssHistoryFeed, AtomHistoryFeed, RssArticleHistoryFeed, AtomArticleHistoryFeed |
499 | |
500 | @@ -25,38 +25,38 @@ |
501 | # Feeds |
502 | url(r'^feeds/rss/$', RssHistoryFeed(), name='wiki_history_feed_rss'), |
503 | url(r'^feeds/atom/$', AtomHistoryFeed(), name='wiki_history_feed_atom'), |
504 | - url(r'^(?P<title>' + WIKI_URL_RE + r')/feeds/rss/$', RssArticleHistoryFeed(), |
505 | + url(r'^(?P<title>' + settings.WIKI_URL_RE + r')/feeds/rss/$', RssArticleHistoryFeed(), |
506 | name='wiki_article_history_feed_rss'), |
507 | - url(r'^(?P<title>' + WIKI_URL_RE + r')/feeds/atom/$', AtomArticleHistoryFeed(), |
508 | + url(r'^(?P<title>' + settings.WIKI_URL_RE + r')/feeds/atom/$', AtomArticleHistoryFeed(), |
509 | name='wiki_article_history_feed_atom'), |
510 | |
511 | - url(r'^(?P<title>' + WIKI_URL_RE + r')/$', |
512 | + url(r'^(?P<title>' + settings.WIKI_URL_RE + r')/$', |
513 | views.view_article, name='wiki_article'), |
514 | |
515 | - url(r'^(?P<title>' + WIKI_URL_RE + r')/(?P<revision>\d+)/$', |
516 | + url(r'^(?P<title>' + settings.WIKI_URL_RE + r')/(?P<revision>\d+)/$', |
517 | views.view_article, name='wiki_article_revision'), |
518 | |
519 | - url(r'^edit/(?P<title>' + WIKI_URL_RE + r')/$', |
520 | + url(r'^edit/(?P<title>' + settings.WIKI_URL_RE + r')/$', |
521 | views.edit_article, name='wiki_edit'), |
522 | |
523 | - url(r'observe/(?P<title>' + WIKI_URL_RE + r')/$', |
524 | + url(r'observe/(?P<title>' + settings.WIKI_URL_RE + r')/$', |
525 | views.observe_article, name='wiki_observe'), |
526 | |
527 | - url(r'observe/(?P<title>' + WIKI_URL_RE + r')/stop/$', views.stop_observing_article, |
528 | + url(r'observe/(?P<title>' + settings.WIKI_URL_RE + r')/stop/$', views.stop_observing_article, |
529 | name='wiki_stop_observing'), |
530 | |
531 | - url(r'^history/(?P<title>' + WIKI_URL_RE + r')/$', |
532 | + url(r'^history/(?P<title>' + settings.WIKI_URL_RE + r')/$', |
533 | views.article_history, name='wiki_article_history'), |
534 | |
535 | - url(r'^history/(?P<title>' + WIKI_URL_RE + r')/changeset/(?P<revision>\d+)/$', views.view_changeset, |
536 | + url(r'^history/(?P<title>' + settings.WIKI_URL_RE + r')/changeset/(?P<revision>\d+)/$', views.view_changeset, |
537 | name='wiki_changeset',), |
538 | |
539 | - url(r'^history/(?P<title>' + WIKI_URL_RE + r')/changeset/(?P<revision_from>\d+)/(?P<revision>\d+)/$', views.view_changeset, |
540 | + url(r'^history/(?P<title>' + settings.WIKI_URL_RE + r')/changeset/(?P<revision_from>\d+)/(?P<revision>\d+)/$', views.view_changeset, |
541 | name='wiki_changeset_compare',), |
542 | |
543 | - url(r'^history/(?P<title>' + WIKI_URL_RE + r')/revert/$', views.revert_to_revision, |
544 | + url(r'^history/(?P<title>' + settings.WIKI_URL_RE + r')/revert/$', views.revert_to_revision, |
545 | name='wiki_revert_to_revision'), |
546 | |
547 | - url(r'^backlinks/(?P<title>' + WIKI_URL_RE + r')/$', views.backlinks, |
548 | + url(r'^backlinks/(?P<title>' + settings.WIKI_URL_RE + r')/$', views.backlinks, |
549 | name='backlinks'), |
550 | ] |
551 | |
552 | === modified file 'wiki/views.py' |
553 | --- wiki/views.py 2018-12-31 10:36:13 +0000 |
554 | +++ wiki/views.py 2019-04-08 05:56:42 +0000 |
555 | @@ -20,8 +20,8 @@ |
556 | from mainpage.templatetags.wl_markdown import do_wl_markdown |
557 | from markdownextensions.semanticwikilinks.mdx_semanticwikilinks import WIKILINK_RE |
558 | |
559 | -from wl_utils import get_real_ip |
560 | -from wl_utils import get_valid_cache_key |
561 | +from mainpage.wl_utils import get_real_ip |
562 | +from mainpage.wl_utils import get_valid_cache_key |
563 | |
564 | import re |
565 | import urllib |
566 | |
567 | === modified file 'wlggz/migrations/0001_initial.py' |
568 | --- wlggz/migrations/0001_initial.py 2016-12-13 18:28:51 +0000 |
569 | +++ wlggz/migrations/0001_initial.py 2019-04-08 05:56:42 +0000 |
570 | @@ -3,7 +3,7 @@ |
571 | |
572 | from django.db import models, migrations |
573 | from django.conf import settings |
574 | -import wl_utils |
575 | +import mainpage.wl_utils as wl_utils |
576 | |
577 | |
578 | class Migration(migrations.Migration): |
579 | |
580 | === modified file 'wlggz/models.py' |
581 | --- wlggz/models.py 2016-12-13 18:28:51 +0000 |
582 | +++ wlggz/models.py 2019-04-08 05:56:42 +0000 |
583 | @@ -9,12 +9,10 @@ |
584 | |
585 | from django.db import models |
586 | from django.contrib.auth.models import User |
587 | -from wl_utils import AutoOneToOneField |
588 | +from mainpage.wl_utils import AutoOneToOneField |
589 | from django.utils.translation import ugettext_lazy as _ |
590 | from pybb.models import Post |
591 | |
592 | -import settings |
593 | - |
594 | |
595 | class GGZAuth(models.Model): |
596 | user = AutoOneToOneField( |
597 | |
598 | === modified file 'wlhelp/management/commands/update_help.py' |
599 | --- wlhelp/management/commands/update_help.py 2018-03-24 09:22:11 +0000 |
600 | +++ wlhelp/management/commands/update_help.py 2019-04-08 05:56:42 +0000 |
601 | @@ -26,7 +26,7 @@ |
602 | import subprocess |
603 | import collections |
604 | |
605 | -from settings import MEDIA_ROOT, WIDELANDS_SVN_DIR, MEDIA_URL |
606 | +from django.conf import settings |
607 | |
608 | from widelandslib.tribe import * |
609 | from widelandslib.make_flow_diagram import make_all_subgraphs |
610 | @@ -45,8 +45,8 @@ |
611 | self._delete_old_media_dir( |
612 | name) # You can deactivate this line if you don't need to clean house. |
613 | |
614 | - base_directory = os.path.normpath(WIDELANDS_SVN_DIR + '/data') |
615 | - json_directory = os.path.normpath(MEDIA_ROOT + '/map_object_info') |
616 | + base_directory = os.path.normpath(settings.WIDELANDS_SVN_DIR + '/data') |
617 | + json_directory = os.path.normpath(settings.MEDIA_ROOT + '/map_object_info') |
618 | |
619 | tribeinfo_file = open(os.path.normpath( |
620 | json_directory + '/tribe_' + name + '.json'), 'r') |
621 | @@ -59,7 +59,7 @@ |
622 | self._to.descr = tribeinfo['tooltip'] |
623 | # copy icon |
624 | dn = os.path.normpath('%s/wlhelp/img/%s/' % |
625 | - (MEDIA_ROOT, tribeinfo['name'])) |
626 | + (settings.MEDIA_ROOT, tribeinfo['name'])) |
627 | try: |
628 | os.makedirs(dn) |
629 | except OSError, o: |
630 | @@ -69,7 +69,7 @@ |
631 | file = os.path.normpath(base_directory + '/' + tribeinfo['icon']) |
632 | shutil.copy(file, new_name) |
633 | self._to.icon_url = path.normpath( |
634 | - '%s/%s' % (MEDIA_URL, new_name[len(MEDIA_ROOT):])) |
635 | + '%s/%s' % (settings.MEDIA_URL, new_name[len(settings.MEDIA_ROOT):])) |
636 | self._to.save() |
637 | |
638 | def parse(self, tribename, base_directory, json_directory): |
639 | @@ -117,7 +117,7 @@ |
640 | |
641 | print('Deleting old media files...') |
642 | sdir = os.path.normpath(os.path.join( |
643 | - MEDIA_ROOT, 'wlhelp/img', tribename)) |
644 | + settings.MEDIA_ROOT, 'wlhelp/img', tribename)) |
645 | if os.path.exists(sdir): |
646 | shutil.rmtree(sdir) |
647 | |
648 | @@ -144,7 +144,7 @@ |
649 | |
650 | """ |
651 | dn = os.path.normpath('%s/wlhelp/img/%s/%s/' % |
652 | - (MEDIA_ROOT, self._to.name, name)) |
653 | + (settings.MEDIA_ROOT, self._to.name, name)) |
654 | try: |
655 | os.makedirs(dn) |
656 | except OSError, o: |
657 | @@ -153,7 +153,7 @@ |
658 | new_name = path.join(dn, fname) |
659 | shutil.copy(file, new_name) |
660 | |
661 | - return '%s%s' % (MEDIA_URL, new_name[len(MEDIA_ROOT):]) |
662 | + return '%s%s' % (settings.MEDIA_URL, new_name[len(settings.MEDIA_ROOT):]) |
663 | |
664 | def _parse_workers(self, base_directory, workersinfo): |
665 | """Put the workers into the database.""" |
666 | @@ -283,9 +283,9 @@ |
667 | help =\ |
668 | '''Regenerates and parses the json files in a current checkout. ''' |
669 | |
670 | - def handle(self, directory=os.path.normpath(WIDELANDS_SVN_DIR + '/data'), **kwargs): |
671 | + def handle(self, directory=os.path.normpath(settings.WIDELANDS_SVN_DIR + '/data'), **kwargs): |
672 | |
673 | - json_directory = os.path.normpath(MEDIA_ROOT + '/map_object_info') |
674 | + json_directory = os.path.normpath(settings.MEDIA_ROOT + '/map_object_info') |
675 | |
676 | if not os.path.exists(json_directory): |
677 | os.makedirs(json_directory) |
678 | @@ -295,7 +295,7 @@ |
679 | # First, we make sure that JSON files have been generated. |
680 | current_dir = os.path.dirname(os.path.realpath(__file__)) |
681 | is_json_valid = False |
682 | - os.chdir(WIDELANDS_SVN_DIR) |
683 | + os.chdir(settings.WIDELANDS_SVN_DIR) |
684 | try: |
685 | subprocess.check_call( |
686 | [os.path.normpath('wl_map_object_info'), json_directory]) |
687 | @@ -306,7 +306,7 @@ |
688 | |
689 | # Now we validate that they are indeed JSON files (syntax check only) |
690 | validator_script = os.path.normpath( |
691 | - WIDELANDS_SVN_DIR + '/utils/validate_json.py') |
692 | + settings.WIDELANDS_SVN_DIR + '/utils/validate_json.py') |
693 | if not os.path.isfile(validator_script): |
694 | print("Wrong path for 'utils/validate_json.py': " + |
695 | validator_script + ' does not exist!') |
696 | |
697 | === modified file 'wlhelp/management/commands/update_help_pdf.py' |
698 | --- wlhelp/management/commands/update_help_pdf.py 2016-07-02 12:38:06 +0000 |
699 | +++ wlhelp/management/commands/update_help_pdf.py 2019-04-08 05:56:42 +0000 |
700 | @@ -1,7 +1,7 @@ |
701 | from ...models import Tribe as TribeModel |
702 | |
703 | from django.core.management.base import BaseCommand, CommandError |
704 | -from settings import MEDIA_ROOT, WIDELANDS_SVN_DIR, MEDIA_URL |
705 | +from django.conf import settings |
706 | |
707 | import os |
708 | import shutil |
709 | @@ -17,7 +17,7 @@ |
710 | help =\ |
711 | """Update the overview pdfs of all tribes in a current checkout""" |
712 | |
713 | - def handle(self, json_directory=os.path.normpath(MEDIA_ROOT + '/map_object_info'), **kwargs): |
714 | + def handle(self, json_directory=os.path.normpath(settings.MEDIA_ROOT + '/map_object_info'), **kwargs): |
715 | source_file = open(os.path.normpath( |
716 | json_directory + '/tribes.json'), 'r') |
717 | tribesinfo = json.load(source_file) |
718 | @@ -31,7 +31,7 @@ |
719 | pdffile = path.join(gdir, tribename + '.pdf') |
720 | giffile = path.join(gdir, tribename + '.gif') |
721 | |
722 | - targetdir = path.normpath(path.join(MEDIA_ROOT, 'wlhelp', |
723 | + targetdir = path.normpath(path.join(settings.MEDIA_ROOT, 'wlhelp', |
724 | 'network_graphs', tribename)) |
725 | |
726 | try: |
727 | @@ -45,9 +45,9 @@ |
728 | tribe = Tribe.objects.get(name=tribename) |
729 | if tribe: |
730 | tribe.network_pdf_url = path.normpath( |
731 | - '%s/%s/%s' % (MEDIA_URL, targetdir[len(MEDIA_ROOT):], tribename + '.pdf')) |
732 | + '%s/%s/%s' % (settings.MEDIA_URL, targetdir[len(settings.MEDIA_ROOT):], tribename + '.pdf')) |
733 | tribe.network_gif_url = path.normpath( |
734 | - '%s/%s/%s' % (MEDIA_URL, targetdir[len(MEDIA_ROOT):], tribename + '.gif')) |
735 | + '%s/%s/%s' % (settings.MEDIA_URL, targetdir[len(settings.MEDIA_ROOT):], tribename + '.gif')) |
736 | tribe.save() |
737 | else: |
738 | print 'Could not set tribe urls' |
739 | |
740 | === modified file 'wlhelp/views.py' |
741 | --- wlhelp/views.py 2018-03-09 12:12:02 +0000 |
742 | +++ wlhelp/views.py 2019-04-08 05:56:42 +0000 |
743 | @@ -3,8 +3,6 @@ |
744 | from django.http import HttpResponse |
745 | from .models import Worker, Ware, Building, Tribe |
746 | |
747 | -from settings import WIDELANDS_SVN_DIR, MEDIA_ROOT |
748 | - |
749 | |
750 | def index(request): |
751 | tribes = Tribe.objects.all().order_by('displayname') |
752 | |
753 | === modified file 'wlimages/models.py' |
754 | --- wlimages/models.py 2018-10-03 20:25:05 +0000 |
755 | +++ wlimages/models.py 2019-04-08 05:56:42 +0000 |
756 | @@ -6,7 +6,7 @@ |
757 | from django.utils.translation import ugettext_lazy as _ |
758 | from django.db import IntegrityError |
759 | from datetime import datetime |
760 | -from settings import MEDIA_ROOT, MEDIA_URL |
761 | +from django.conf import settings |
762 | from django.core.files.storage import FileSystemStorage |
763 | |
764 | |
765 | @@ -39,7 +39,7 @@ |
766 | safe_filename = storage.get_valid_name(image.name) |
767 | im = self.create(content_type=content_type, object_id=object_id, |
768 | user=user, revision=1, name=image.name) |
769 | - path = '%swlimages/%s' % (MEDIA_ROOT, safe_filename) |
770 | + path = '%swlimages/%s' % (settings.MEDIA_ROOT, safe_filename) |
771 | |
772 | destination = open(path, 'wb') |
773 | for chunk in image.chunks(): |
774 | |
775 | === modified file 'wlmaps/forms.py' |
776 | --- wlmaps/forms.py 2017-03-07 16:02:24 +0000 |
777 | +++ wlmaps/forms.py 2019-04-08 05:56:42 +0000 |
778 | @@ -7,11 +7,10 @@ |
779 | from django import forms |
780 | from django.forms import ModelForm |
781 | from django.core.files.storage import default_storage |
782 | +from django.conf import settings |
783 | |
784 | -from settings import MEDIA_ROOT |
785 | from wlmaps.models import Map |
786 | import os |
787 | -from settings import WIDELANDS_SVN_DIR |
788 | |
789 | class UploadMapForm(ModelForm): |
790 | """ |
791 | @@ -46,7 +45,7 @@ |
792 | try: |
793 | # Try to make a safe filename |
794 | safe_name = default_storage.get_valid_name(mem_file_obj.name) |
795 | - file_path = MEDIA_ROOT + 'wlmaps/maps/' + safe_name |
796 | + file_path = settings.MEDIA_ROOT + 'wlmaps/maps/' + safe_name |
797 | saved_file = default_storage.save(file_path, mem_file_obj) |
798 | except UnicodeEncodeError: |
799 | self._errors['file'] = self.error_class( |
800 | @@ -57,7 +56,7 @@ |
801 | try: |
802 | # call map info tool to generate minimap and json info file |
803 | old_cwd = os.getcwd() |
804 | - os.chdir(WIDELANDS_SVN_DIR) |
805 | + os.chdir(settings.WIDELANDS_SVN_DIR) |
806 | check_call(['wl_map_info', saved_file]) |
807 | |
808 | # TODO(shevonar): delete file because it will be saved again when |
809 | @@ -90,7 +89,7 @@ |
810 | |
811 | # mapinfo["minimap"] is an absolute path. |
812 | # We partition it to get the correct file path |
813 | - minimap_path = mapinfo['minimap'].partition(MEDIA_ROOT)[2] |
814 | + minimap_path = mapinfo['minimap'].partition(settings.MEDIA_ROOT)[2] |
815 | self.instance.minimap = '/' + minimap_path |
816 | |
817 | # the json file is no longer needed |
818 | |
819 | === modified file 'wlmaps/tests/test_views.py' |
820 | --- wlmaps/tests/test_views.py 2018-11-18 17:22:39 +0000 |
821 | +++ wlmaps/tests/test_views.py 2019-04-08 05:56:42 +0000 |
822 | @@ -11,8 +11,6 @@ |
823 | |
824 | import os |
825 | |
826 | -from settings import MEDIA_ROOT |
827 | - |
828 | elven_forests = os.path.dirname(__file__) + '/data/Elven Forests.wmf' |
829 | |
830 | ########### |
831 | |
832 | === modified file 'wlmaps/views.py' |
833 | --- wlmaps/views.py 2018-11-18 17:22:39 +0000 |
834 | +++ wlmaps/views.py 2019-04-08 05:56:42 +0000 |
835 | @@ -7,9 +7,10 @@ |
836 | from django.contrib.auth.decorators import login_required |
837 | from django.http import HttpResponseRedirect, HttpResponseNotAllowed, HttpResponse, HttpResponseBadRequest |
838 | from django.urls import reverse |
839 | +from django.conf import settings |
840 | import models |
841 | -from settings import MAPS_PER_PAGE |
842 | -from wl_utils import get_real_ip |
843 | + |
844 | +from mainpage.wl_utils import get_real_ip |
845 | import os |
846 | |
847 | |
848 | @@ -20,7 +21,7 @@ |
849 | maps = models.Map.objects.all() |
850 | return render(request, 'wlmaps/index.html', |
851 | {'maps': maps, |
852 | - 'maps_per_page': MAPS_PER_PAGE, |
853 | + 'maps_per_page': settings.MAPS_PER_PAGE, |
854 | }) |
855 | |
856 | |
857 | |
858 | === modified file 'wlprofile/forms.py' |
859 | --- wlprofile/forms.py 2016-12-13 18:28:51 +0000 |
860 | +++ wlprofile/forms.py 2019-04-08 05:56:42 +0000 |
861 | @@ -9,7 +9,7 @@ |
862 | from django import forms |
863 | from models import Profile |
864 | |
865 | -import settings |
866 | +from django.conf import settings |
867 | import re |
868 | |
869 | |
870 | |
871 | === modified file 'wlprofile/migrations/0001_initial.py' |
872 | --- wlprofile/migrations/0001_initial.py 2016-12-13 18:28:51 +0000 |
873 | +++ wlprofile/migrations/0001_initial.py 2019-04-08 05:56:42 +0000 |
874 | @@ -3,7 +3,7 @@ |
875 | |
876 | from django.db import models, migrations |
877 | from django.conf import settings |
878 | -import wl_utils |
879 | +import mainpage.wl_utils as wl_utils |
880 | import wlprofile.fields |
881 | |
882 | |
883 | |
884 | === modified file 'wlprofile/models.py' |
885 | --- wlprofile/models.py 2018-12-21 09:50:32 +0000 |
886 | +++ wlprofile/models.py 2019-04-08 05:56:42 +0000 |
887 | @@ -1,11 +1,11 @@ |
888 | from django.db import models |
889 | from django.contrib.auth.models import User |
890 | from fields import ExtendedImageField |
891 | -from wl_utils import AutoOneToOneField |
892 | +from mainpage.wl_utils import AutoOneToOneField |
893 | from django.utils.translation import ugettext_lazy as _ |
894 | from pybb.models import Post |
895 | |
896 | -import settings |
897 | +from django.conf import settings |
898 | |
899 | TZ_CHOICES = [(float(x[0]), x[1]) for x in ( |
900 | (-12, '-12'), (-11, '-11'), (-10, '-10'), (-9.5, '-09.5'), (-9, '-09'), |
901 | |
902 | === modified file 'wlprofile/templatetags/custom_date.py' |
903 | --- wlprofile/templatetags/custom_date.py 2018-04-08 14:40:17 +0000 |
904 | +++ wlprofile/templatetags/custom_date.py 2019-04-08 05:56:42 +0000 |
905 | @@ -18,7 +18,7 @@ |
906 | from django.contrib.auth.models import User |
907 | import re |
908 | from datetime import date as ddate, tzinfo, timedelta, datetime |
909 | -from settings import DEFAULT_TIME_ZONE, DEFAULT_TIME_DISPLAY |
910 | +from django.conf import settings |
911 | |
912 | register = template.Library() |
913 | |
914 | @@ -132,12 +132,12 @@ |
915 | """If this user is logged in, return his representation, otherwise, return |
916 | a sane default.""" |
917 | if not user.is_authenticated: |
918 | - return do_custom_date(DEFAULT_TIME_DISPLAY, date, float(DEFAULT_TIME_ZONE)) |
919 | + return do_custom_date(settings.DEFAULT_TIME_DISPLAY, date, float(settings.DEFAULT_TIME_ZONE)) |
920 | try: |
921 | userprofile = User.objects.get(username=user).wlprofile |
922 | return do_custom_date(userprofile.time_display, date, userprofile.time_zone) |
923 | except ObjectDoesNotExist: |
924 | - return do_custom_date(DEFAULT_TIME_DISPLAY, date, float(DEFAULT_TIME_ZONE)) |
925 | + return do_custom_date(settings.DEFAULT_TIME_DISPLAY, date, float(settings.DEFAULT_TIME_ZONE)) |
926 | |
927 | custom_date.is_safe = False |
928 | |
929 | |
930 | === modified file 'wlscheduling/templates/wlscheduling/other-users.html' |
931 | --- wlscheduling/templates/wlscheduling/other-users.html 2018-02-16 15:38:34 +0000 |
932 | +++ wlscheduling/templates/wlscheduling/other-users.html 2019-04-08 05:56:42 +0000 |
933 | @@ -1,8 +1,9 @@ |
934 | +{% load static %} |
935 | <div id="other-user-template" class="other-user-div" hidden="hidden"> |
936 | <div class="title"> |
937 | <p></p> |
938 | <button> |
939 | - <img src="/wlmedia/forum/img/send_pm.png" alt="" class="middle"><span class="middle">Send PM</span> |
940 | + <img src="{% static 'forum/img/send_pm.png'%}" alt="" class="middle"><span class="middle">Send PM</span> |
941 | </button> |
942 | </div> |
943 | <div class="other-days-container"></div> |
944 | @@ -21,4 +22,4 @@ |
945 | {% include "wlscheduling/clock-svg.html" %} |
946 | </div> |
947 | </div> |
948 | -</div> |
949 | \ No newline at end of file |
950 | +</div> |
951 | |
952 | === modified file 'wlscreens/models.py' |
953 | --- wlscreens/models.py 2018-04-08 16:23:55 +0000 |
954 | +++ wlscreens/models.py 2019-04-08 05:56:42 +0000 |
955 | @@ -7,7 +7,7 @@ |
956 | from django.core.files.uploadedfile import SimpleUploadedFile, UploadedFile |
957 | from django.core.files.storage import FileSystemStorage |
958 | import os |
959 | -from settings import THUMBNAIL_SIZE, MEDIA_ROOT |
960 | +from django.conf import settings |
961 | from django.urls import reverse |
962 | |
963 | |
964 | @@ -21,7 +21,7 @@ |
965 | # If the filename already exists, remove it as if it was a true file |
966 | # system |
967 | if self.exists(name): |
968 | - os.remove(os.path.join(MEDIA_ROOT, name)) |
969 | + os.remove(os.path.join(settings.MEDIA_ROOT, name)) |
970 | return name |
971 | |
972 | |
973 | @@ -80,7 +80,7 @@ |
974 | if image.mode not in ('L', 'RGB'): |
975 | image = image.convert('RGB') |
976 | |
977 | - image.thumbnail(THUMBNAIL_SIZE, Image.ANTIALIAS) |
978 | + image.thumbnail(settings.THUMBNAIL_SIZE, Image.ANTIALIAS) |
979 | |
980 | # Save the thumbnail |
981 | temp_handle = StringIO() |
982 | |
983 | === modified file 'wlscreens/tests/test_models.py' |
984 | --- wlscreens/tests/test_models.py 2016-12-13 18:28:51 +0000 |
985 | +++ wlscreens/tests/test_models.py 2019-04-08 05:56:42 +0000 |
986 | @@ -9,7 +9,7 @@ |
987 | # Last Modified: $Date$ |
988 | # |
989 | |
990 | -from settings import THUMBNAIL_SIZE |
991 | +from django.conf import settings |
992 | from django.test import TestCase as DjangoTest |
993 | from django.db import IntegrityError |
994 | from django.core.files.uploadedfile import SimpleUploadedFile |
995 | @@ -71,7 +71,7 @@ |
996 | screenshot=self.img, |
997 | comment='This rockz!') |
998 | self.assertEqual(i.pk, 1) |
999 | - self.assertEqual(i.thumbnail.width, THUMBNAIL_SIZE[0]) |
1000 | + self.assertEqual(i.thumbnail.width, settings.THUMBNAIL_SIZE[0]) |
1001 | |
1002 | |
1003 | class TestScreenshot(_ScreenshotBase): |
Looks like it works fine on alpha.