mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
- flake8 & black fixes
This commit is contained in:
parent
a5bec48ab4
commit
1be3ecf90a
@ -118,7 +118,8 @@ class ModelBase(type):
|
||||
else:
|
||||
new_attrs[obj_name] = obj
|
||||
new_class = super_new(cls, name, bases, new_attrs, **kwargs)
|
||||
# update contributable_attrs with any such attributes added to new_class - these came from __init_subclass__
|
||||
# update contributable_attrs with any such attributes added to new_class.
|
||||
# any such attributes came from user-defined __init_subclass__ on new_class
|
||||
for obj_name, obj in dict(vars(new_class)).items():
|
||||
if _has_contribute_to_class(obj):
|
||||
contributable_attrs[obj_name] = obj
|
||||
|
@ -255,17 +255,17 @@ class ModelInheritanceTests(TestCase):
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
def __init_subclass__(cls, author_model_cls, **kwargs):
|
||||
def __init_subclass__(cls, author_cls, **kwargs):
|
||||
super().__init_subclass__(**kwargs)
|
||||
cls.author = models.ForeignKey(author_model_cls, on_delete = models.CASCADE)
|
||||
cls.author = models.ForeignKey(author_cls, on_delete=models.CASCADE)
|
||||
|
||||
class Author(models.Model):
|
||||
name = models.CharField(max_length = 256, unique = True)
|
||||
name = models.CharField(max_length=256, unique=True)
|
||||
|
||||
class Book(BaseBookModel, author_model_cls = Author):
|
||||
class Book(BaseBookModel, author_cls=Author):
|
||||
pass
|
||||
|
||||
self.assertIsInstance(Book._meta.get_field('author'), models.ForeignKey)
|
||||
self.assertIsInstance(Book._meta.get_field("author"), models.ForeignKey)
|
||||
|
||||
@isolate_apps("model_inheritance")
|
||||
def test_set_name(self):
|
||||
|
Loading…
Reference in New Issue
Block a user