misc: remove compatibility code for old django versions (#74247) #40
|
@ -1,6 +1,5 @@
|
|||
import json
|
||||
|
||||
import django
|
||||
from django.conf import settings
|
||||
|
||||
from combo.utils import requests
|
||||
|
@ -73,13 +72,7 @@ def update_available_statistics():
|
|||
statistics_to_create.append(stat)
|
||||
|
||||
Statistic.objects.bulk_create(statistics_to_create)
|
||||
if django.VERSION < (2, 2, 0):
|
||||
for statistic in statistics_to_update.values():
|
||||
Statistic.objects.filter(pk=statistic.pk).update(
|
||||
**{field: getattr(statistic, field) for field in update_fields}
|
||||
)
|
||||
else:
|
||||
Statistic.objects.bulk_update(statistics_to_update.values(), update_fields)
|
||||
Statistic.objects.bulk_update(statistics_to_update.values(), update_fields)
|
||||
|
||||
available_stats = Statistic.objects.filter(available=True)
|
||||
for stat in results:
|
||||
|
|
|
@ -16,16 +16,10 @@
|
|||
|
||||
# Decorating URL includes, <https://djangosnippets.org/snippets/2532/>
|
||||
|
||||
import django
|
||||
from django.contrib.auth.decorators import user_passes_test
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.db.models import Q
|
||||
|
||||
if django.VERSION < (2, 0, 0):
|
||||
from django.urls.resolvers import RegexURLPattern as URLPattern # pylint: disable=no-name-in-module
|
||||
from django.urls.resolvers import RegexURLResolver as URLResolver # pylint: disable=no-name-in-module
|
||||
else:
|
||||
from django.urls.resolvers import URLPattern, URLResolver
|
||||
from django.urls.resolvers import URLPattern, URLResolver
|
||||
|
||||
|
||||
class DecoratedURLPattern(URLPattern):
|
||||
|
|
Loading…
Reference in New Issue