Commit b69b4008 authored by Aymeric Augustin's avatar Aymeric Augustin
Browse files

Removed usage of a global variable.

parent f88ad710
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import os
import datetime
import itertools
import os
import tempfile

from django.core.files.storage import FileSystemStorage
@@ -10,6 +11,10 @@ from django.db import models
from django.utils.encoding import python_2_unicode_compatible


callable_default_counter = itertools.count()
callable_default = lambda: next(callable_default_counter)


temp_storage_location = tempfile.mkdtemp(dir=os.environ['DJANGO_TEST_TEMP_DIR'])
temp_storage = FileSystemStorage(location=temp_storage_location)

@@ -18,15 +23,6 @@ class BoundaryModel(models.Model):
    positive_integer = models.PositiveIntegerField(null=True, blank=True)


callable_default_value = 0


def callable_default():
    global callable_default_value
    callable_default_value = callable_default_value + 1
    return callable_default_value


class Defaults(models.Model):
    name = models.CharField(max_length=255, default='class default value')
    def_date = models.DateField(default=datetime.date(1980, 1, 1))