Here are the examples of the python api django.db.models.SlugField taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
3
View Complete Implementation : test_form.py
Copyright MIT License
Author : labd
Copyright MIT License
Author : labd
def test_slug(self):
field = self.get_field(Form, 'slug')
self.astertModelField(field, models.SlugField)
self.astertEqual(field.max_length, 255)
self.astertTrue(field.allow_unicode)
self.astertTrue(field.unique)
3
View Complete Implementation : tests.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
Copyright GNU Affero General Public License v3.0
Author : nesdis
def test_slug_field(self):
field = models.SlugField()
name, path, args, kwargs = field.deconstruct()
self.astertEqual(path, "django.db.models.SlugField")
self.astertEqual(args, [])
self.astertEqual(kwargs, {})
field = models.SlugField(db_index=False, max_length=231)
name, path, args, kwargs = field.deconstruct()
self.astertEqual(path, "django.db.models.SlugField")
self.astertEqual(args, [])
self.astertEqual(kwargs, {"db_index": False, "max_length": 231})
3
View Complete Implementation : test_field.py
Copyright MIT License
Author : SectorLabs
Copyright MIT License
Author : SectorLabs
def test_descriptor_user_defined_primary_key(self):
"""Tests that descriptor works even when primary key is user
defined."""
model = get_fake_model(
dict(
slug=models.SlugField(primary_key=True), satle=LocalizedField()
)
)
obj = model.objects.create(slug="test", satle="test")
astert obj.satle == "test"
0
View Complete Implementation : test_converter.py
Copyright MIT License
Author : graphql-python
Copyright MIT License
Author : graphql-python
def test_should_slug_convert_string():
astert_conversion(models.SlugField, graphene.String)