Skip to content

Commit

Permalink
Merge pull request #80 from heyman/fix-django-version-parsing
Browse files Browse the repository at this point in the history
Better parsing of Django’s version. Fixes Django 1.10 incompatibility.
  • Loading branch information
valdergallo committed Sep 21, 2016
2 parents 8850e9f + 3d55955 commit ae05eb1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions django_dynamic_fixture/django_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""
Module to wrap dirty stuff of django core.
"""
import re
from distutils.version import StrictVersion

import django
Expand All @@ -18,8 +19,8 @@


def django_greater_than(version):
# Slice to avoid StrictVersion errors with versions like 1.8c1
DJANGO_VERSION = django.get_version()[0:3]
# Avoid StrictVersion errors with versions like 1.8c1
DJANGO_VERSION = re.match(r"\d\.\d\d?", django.get_version()).group(0)
return StrictVersion(DJANGO_VERSION) >= StrictVersion(version)

# Apps
Expand Down

0 comments on commit ae05eb1

Please sign in to comment.