Skip to content

Commit

Permalink
Merge pull request #103 from xavierdutreilh/fix-all-removedindjango19…
Browse files Browse the repository at this point in the history
…warnings

Fix all RemovedInDjango19Warning messages. Fixes #101
  • Loading branch information
AndrewIngram committed Jun 15, 2015
2 parents dd794ef + ae59089 commit be4ba48
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
8 changes: 7 additions & 1 deletion extra_views/generic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
from django.contrib.contenttypes.generic import generic_inlineformset_factory, BaseGenericInlineFormSet
import django

if django.VERSION < (1, 8):
from django.contrib.contenttypes.generic import generic_inlineformset_factory, BaseGenericInlineFormSet
else:
from django.contrib.contenttypes.forms import generic_inlineformset_factory, BaseGenericInlineFormSet

from extra_views.formsets import BaseInlineFormSetMixin, InlineFormSetMixin, BaseInlineFormSetView, InlineFormSetView


Expand Down
9 changes: 7 additions & 2 deletions extra_views/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
from django.utils.timezone import now
except ImportError:
now = datetime.datetime.now
import django
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic

if django.VERSION < (1, 8):
from django.contrib.contenttypes.generic import GenericForeignKey
else:
from django.contrib.contenttypes.fields import GenericForeignKey

STATUS_CHOICES = (
(0, 'Placed'),
Expand Down Expand Up @@ -38,7 +43,7 @@ class Tag(models.Model):
name = models.CharField(max_length=255)
content_type = models.ForeignKey(ContentType, null=True)
object_id = models.PositiveIntegerField(null=True)
content_object = generic.GenericForeignKey('content_type', 'object_id')
content_object = GenericForeignKey('content_type', 'object_id')

def __unicode__(self):
return self.name
Expand Down
6 changes: 5 additions & 1 deletion extra_views/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
from django.core.exceptions import ImproperlyConfigured
from django.forms import ValidationError
from django.test import TransactionTestCase
from django.utils.unittest import expectedFailure

if django.VERSION < (1, 8):
from django.utils.unittest import expectedFailure
else:
from unittest import expectedFailure

from .models import Item, Order, Tag, Event

Expand Down

0 comments on commit be4ba48

Please sign in to comment.