New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
APD-246 - [BE] migrate project to work under Django master branch #13
Conversation
This also provides backwards compatibility with Django 1.8, 1.9, 1.10, 1.11a1
ydcommon/views.py
Outdated
@@ -2,7 +2,11 @@ | |||
from django.views.generic import TemplateView | |||
from django.conf import settings | |||
from django.contrib.admin.views.decorators import staff_member_required | |||
from django.core.urlresolvers import reverse | |||
try: | |||
from django.urls import reverse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recall my comment in Demo project? This one should be done as file and imported from there, even in demo.
@@ -1,3 +1,2 @@ | |||
Django>=1.8.7, <1.9 # rq.filter: >=1.8.7,< 1.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No Django at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good one. Probably pip complains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is because pip complains while running tests under tox.
'ydcommon.views.qunit_view', | ||
name='qunit'), | ||
) | ||
urlpatterns = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to PR but @jacoor are we using it all? Maybe time for cleanup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until we decide to use some FE CMS this has to stay.
tox.ini
Outdated
py34-django18, | ||
py35-django18, | ||
py36-django18, | ||
{py27,py34,py35}-django18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge all (py 27-35) to 1 line.
py36 separate.
tox.ini
Outdated
py34: python3.4 | ||
py35: python3.5 | ||
py36: python3.6 | ||
py27: python2.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you sort it?
tox.ini
Outdated
{py27,py34,py35}-django19 | ||
{py27,py34,py35,py36}-django110 | ||
# add django1.11 after release | ||
{py34,py35,py36}-django{master} | ||
|
||
[testenv] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add option for master to allow fail.
dest='xml_output', | ||
help='Render as XML'), | ||
) | ||
class Command(BaseCommand): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test it? This command is not working since Django 1.8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed by @poxip
@@ -1,7 +1,6 @@ | |||
import sys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacoor do we use it at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until we decide to use some FE CMS this has to stay.
@@ -3,11 +3,10 @@ | |||
import re |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacoor do we use it at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until we decide to use some FE CMS this has to stay.
ydcommon/views.py
Outdated
@@ -13,7 +17,7 @@ class QunitTestsView(TemplateView): | |||
def get_context_data(self, **kwargs): | |||
context = super(QunitTestsView, self).get_context_data(**kwargs) | |||
if not kwargs['path'] or kwargs['path'] == 'index': | |||
for template_dir in settings.TEMPLATE_DIRS: | |||
for template_dir in settings.TEMPLATES[0]['DIRS']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check both versions.
.travis.yml
Outdated
@@ -7,6 +7,8 @@ python: | |||
|
|||
env: | |||
- DJANGO="django>=1.8,<1.9" | |||
- DJANGO="django>=1.9,<1.10" | |||
- DJANGO="django>=1.10,<1.11" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing master version.
Maybe convert it to tox-travis version eg. https://github.com/ArabellaTech/drf_tweaks/blob/master/.travis.yml
data = RequestContext(request) | ||
for template_dir in settings.TEMPLATE_DIRS: | ||
data = RequestContext(request).dicts[0] | ||
for template_dir in settings.TEMPLATES[0]['DIRS']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for new Django, we should support both versions.
ydcommon/views.py
Outdated
@@ -13,7 +13,11 @@ class QunitTestsView(TemplateView): | |||
def get_context_data(self, **kwargs): | |||
context = super(QunitTestsView, self).get_context_data(**kwargs) | |||
if not kwargs['path'] or kwargs['path'] == 'index': | |||
for template_dir in settings.TEMPLATE_DIRS: | |||
template_dirs = ( | |||
list(getattr(settings, 'TEMPLATES', [{'DIRS': []}])[0]['DIRS']) + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it not break for old way? There won't be 0 key.
1 similar comment
@poxip Still missing changes for templates dir. |
@remik Yes, I know that, I just didn't have the time yesterday to get everything done (doing it today tho) ;) |
This also provides backwards compatibility with Django 1.8, 1.9, 1.10, 1.11a1