← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands-website/move_minimaps into lp:widelands-website

 

'upload_to' was mandatory before Django 1.7, so it is a leftover of the old Django version. We could omit this option, but it is used to get the property of the url attribute, see the link and explanation below:

https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.FileField.upload_to

os.path.join is good except for the minimap: The plan is to change this path in a later branch to make it more "Django like": minimap is a file field and such fields have an automatic "url" property. The url property is used in templates, f.e. (second curly braces)

http://bazaar.launchpad.net/~widelands-dev/widelands-website/trunk/view/head:/templates/wlmaps/index.html#L25

-> src="{{ MEDIA_URL }}{{ map.minimap.url }}"

If we omit the leading slash in field minimap (making it "wlmaps/minimaps" instead of "/wlmaps/minimaps/") we could also omit the "{{ MEDIA_URL }}" in the template, because it is then joined with the MEDIA_ROOT setting automatically by Django. As i understand this join is used only if 'upload_to' is set (see the first link above). But i am not sure though... i have to test this :-)
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/move_minimaps/+merge/303493
Your team Widelands Developers is subscribed to branch lp:widelands-website.


References