mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #12663 -- Formalized the Model._meta API for retrieving fields.
Thanks to Russell Keith-Magee for mentoring this Google Summer of Code 2014 project and everyone else who helped with the patch!
This commit is contained in:
committed by
Tim Graham
parent
749d23251b
commit
fb48eb0581
@@ -8,6 +8,11 @@ except ImportError:
|
||||
Image = None
|
||||
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db.models.fields.related import (
|
||||
ForeignObject, ForeignKey, ManyToManyField, OneToOneField,
|
||||
)
|
||||
from django.db import models
|
||||
from django.db.models.fields.files import ImageFieldFile, ImageField
|
||||
from django.utils import six
|
||||
@@ -295,6 +300,52 @@ if Image:
|
||||
height_field='headshot_height',
|
||||
width_field='headshot_width')
|
||||
|
||||
|
||||
class AllFieldsModel(models.Model):
|
||||
big_integer = models.BigIntegerField()
|
||||
binary = models.BinaryField()
|
||||
boolean = models.BooleanField(default=False)
|
||||
char = models.CharField(max_length=10)
|
||||
csv = models.CommaSeparatedIntegerField(max_length=10)
|
||||
date = models.DateField()
|
||||
datetime = models.DateTimeField()
|
||||
decimal = models.DecimalField(decimal_places=2, max_digits=2)
|
||||
duration = models.DurationField()
|
||||
email = models.EmailField()
|
||||
file_path = models.FilePathField()
|
||||
floatf = models.FloatField()
|
||||
integer = models.IntegerField()
|
||||
ip_address = models.IPAddressField()
|
||||
generic_ip = models.GenericIPAddressField()
|
||||
null_boolean = models.NullBooleanField()
|
||||
positive_integer = models.PositiveIntegerField()
|
||||
positive_small_integer = models.PositiveSmallIntegerField()
|
||||
slug = models.SlugField()
|
||||
small_integer = models.SmallIntegerField()
|
||||
text = models.TextField()
|
||||
time = models.TimeField()
|
||||
url = models.URLField()
|
||||
uuid = models.UUIDField()
|
||||
|
||||
fo = ForeignObject(
|
||||
'self',
|
||||
from_fields=['abstract_non_concrete_id'],
|
||||
to_fields=['id'],
|
||||
related_name='reverse'
|
||||
)
|
||||
fk = ForeignKey(
|
||||
'self',
|
||||
related_name='reverse2'
|
||||
)
|
||||
m2m = ManyToManyField('self')
|
||||
oto = OneToOneField('self')
|
||||
|
||||
object_id = models.PositiveIntegerField()
|
||||
content_type = models.ForeignKey(ContentType)
|
||||
gfk = GenericForeignKey()
|
||||
gr = GenericRelation(DataModel)
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user