1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Removed usage of a global variable.

This commit is contained in:
Aymeric Augustin 2014-11-18 21:52:26 +01:00
parent f88ad710fa
commit b69b4008d1

View File

@ -1,8 +1,9 @@
# -*- 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))