Skip to content
This repository has been archived by the owner on Oct 1, 2022. It is now read-only.

Update to suport Django 1.10 #56

Closed
wants to merge 4 commits into from

Conversation

kliver
Copy link
Contributor

@kliver kliver commented Nov 6, 2016

Django 1.10 uses natural key for sites, so pk needs to be removed from SITE_DUMP
Using call_command instead of execute to avoid 'no_color' KeyError
prefix param in url not supported on Django1.10

I usually not do PR, most likely is wrong, but maybe someone can improve it.

@coveralls
Copy link

coveralls commented Nov 6, 2016

Coverage Status

Coverage decreased (-1.0%) to 99.0% when pulling f21b8ce on kliver:django-1.10-support into a7d86b3 on semente:master.

Copy link
Owner

@semente semente left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it but I've suggested some code styling changes. What do you think?

Also test coverage decreased 1%, would be great if we let it at 100%.

from django.db.utils import DEFAULT_DB_ALIAS
from django.http import HttpResponse
from django.utils.six import StringIO
from smuggler import settings
import django
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put the import statement on top. I would also suggest a line space between from smuggler... and from django... * stuff.

That is a recommendation from PEP 8:

Imports should be grouped in the following order:

  1. standard library imports
  2. related third party imports
  3. local application/library specific imports
  4. You should put a blank line between each group of imports.

The same applies to the changes at file tests/test_app/tests/test_dump.py.

@@ -30,15 +33,21 @@ def serialize_to_response(app_labels=None, exclude=None, response=None,
error_stream = StringIO()
dumpdata = DumpData()
dumpdata.style = no_style()
dumpdata.execute(*app_labels, **{
args = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would name it kwargs instead args. The same applies at the similar change below.

extra_url_kwargs = {'prefix': 'admin'} \
if StrictVersion(django.get_version()) < StrictVersion('1.7')\
else\
{}
Copy link
Owner

@semente semente Nov 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like to avoid the use of \. But in this particular case, I recommend use inlines only when it can fit in one line. My recommendation is to use the following code:

if StrictVersion(django.get_version()) < StrictVersion('1.7'):
    extra_url_kwargs = {'prefix': 'admin'}
else:
    extra_url_kwargs = {}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, I would rename the variable extra_url_kwargs to login_url_kwargs.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, we drop support to Django < 1.7 so we don't need it actually.

Removed code required only on Django < 1.7.
@coveralls
Copy link

coveralls commented Nov 6, 2016

Coverage Status

Coverage decreased (-1.0%) to 99.0% when pulling 5c231bd on kliver:django-1.10-support into a7d86b3 on semente:master.

@kliver
Copy link
Contributor Author

kliver commented Nov 6, 2016

Ok great suggestions, as i said first time doing this PR thing so thank you for the tips. About coverage thing, i don't know exactly how to fix it. If condition is evaluated under an specific environment?

@coveralls
Copy link

coveralls commented Nov 6, 2016

Coverage Status

Coverage decreased (-1.0%) to 99.0% when pulling 6dd7a0f on kliver:django-1.10-support into a7d86b3 on semente:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.0%) to 99.0% when pulling 6dd7a0f on kliver:django-1.10-support into a7d86b3 on semente:master.

@semente
Copy link
Owner

semente commented Nov 6, 2016

Thank you very much, @kliver! You did a great job! Tomorrow I will release version 0.8. :)

About the coverage, I have no idea too. I don't think you've added code that is not being tested by our current test cases. Don't worry about it, it looks like an old issue (see #52).

@jaap3 any inputs?

@coveralls
Copy link

coveralls commented Nov 6, 2016

Coverage Status

Coverage decreased (-1.0%) to 99.0% when pulling 9338ada on kliver:django-1.10-support into a7d86b3 on semente:master.

@jaap3
Copy link
Collaborator

jaap3 commented Nov 8, 2016

Thank you! I've manually merged your fix (with some changes) 6b85d4e

I then had to fix my changes in 366e89e and c0d4c4c because my simplified tox.ini was broken.

@jaap3 jaap3 closed this Nov 8, 2016
@jaap3
Copy link
Collaborator

jaap3 commented Nov 8, 2016

@semente coverage remains at 100% and travis now also tests Django 1.10. Will you prepare a release?

@semente
Copy link
Owner

semente commented Nov 8, 2016

@jaap3 perfect! I will release it today.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants