nested_admin.tests.two_deep package¶
Submodules¶
nested_admin.tests.two_deep.admin module¶
-
class
SortableWithExtraChildInline
(*args, **kwargs)[source]¶ Bases:
nested_admin.nested.NestedStackedInline
-
extra
= 2¶
-
inline_classes
= ('collapse', 'open')¶
-
media
¶
-
model
¶ alias of
nested_admin.tests.two_deep.models.SortableWithExtraChild
-
sortable_excludes
= ['foo']¶
-
sortable_field_name
= 'position'¶
-
-
class
SortableWithExtraRootAdmin
(model, admin_site)[source]¶ Bases:
nested_admin.nested.NestedModelAdmin
-
inlines
= [<class 'nested_admin.tests.two_deep.admin.SortableWithExtraChildInline'>]¶
-
media
¶
-
-
class
StackedGroupAdmin
(model, admin_site)[source]¶ Bases:
nested_admin.nested.NestedModelAdmin
-
inlines
= [<class 'nested_admin.tests.two_deep.admin.StackedSectionInline'>]¶
-
media
¶
-
-
class
StackedItemInline
(*args, **kwargs)[source]¶ Bases:
nested_admin.nested.NestedStackedInline
-
extra
= 0¶
-
inline_classes
= ('collapse', 'open')¶
-
media
¶
-
model
¶
-
sortable_field_name
= 'position'¶
-
-
class
StackedSectionInline
(*args, **kwargs)[source]¶ Bases:
nested_admin.nested.NestedStackedInline
-
extra
= 0¶
-
inline_classes
= ('collapse', 'open')¶
-
inlines
= [<class 'nested_admin.tests.two_deep.admin.StackedItemInline'>]¶
-
media
¶
-
model
¶
-
sortable_field_name
= 'position'¶
-
-
class
TabularGroupAdmin
(model, admin_site)[source]¶ Bases:
nested_admin.nested.NestedModelAdmin
-
inlines
= [<class 'nested_admin.tests.two_deep.admin.TabularSectionInline'>]¶
-
media
¶
-
-
class
TabularItemInline
(*args, **kwargs)[source]¶ Bases:
nested_admin.nested.NestedTabularInline
-
extra
= 0¶
-
media
¶
-
model
¶
-
sortable_field_name
= 'position'¶
-
nested_admin.tests.two_deep.models module¶
-
class
GroupAbstract
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
-
slug
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
-
class
ItemAbstract
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
-
name
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
position
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
-
class
SectionAbstract
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
-
position
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
slug
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
-
class
SortableWithExtraChild
(id, slug, root, position, foo)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
foo
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
position
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
root
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
root_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
slug
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
SortableWithExtraRoot
(id, slug)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
slug
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
sortablewithextrachild_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
exception
-
class
StackedGroup
(id, slug)[source]¶ Bases:
nested_admin.tests.two_deep.models.GroupAbstract
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
section_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
exception
-
class
StackedItem
(id, name, position, section, upload)[source]¶ Bases:
nested_admin.tests.two_deep.models.ItemAbstract
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
section
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
section_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
upload
¶ The descriptor for the file attribute on the model instance. Returns a FieldFile when accessed so you can do stuff like:
>>> from myapp.models import MyModel >>> instance = MyModel.objects.get(pk=1) >>> instance.file.size
Assigns a file object on assignment so you can do:
>>> with open('/path/to/hello.world', 'r') as f: ... instance.file = File(f)
-
exception
-
class
StackedSection
(id, slug, position, group)[source]¶ Bases:
nested_admin.tests.two_deep.models.SectionAbstract
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
group
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
group_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
item_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
objects
= <django.db.models.manager.Manager object>¶
-
exception
-
class
TabularGroup
(id, slug)[source]¶ Bases:
nested_admin.tests.two_deep.models.GroupAbstract
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
section_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
exception
-
class
TabularItem
(id, name, position, section)[source]¶ Bases:
nested_admin.tests.two_deep.models.ItemAbstract
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
objects
= <django.db.models.manager.Manager object>¶
-
section
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
section_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
TabularSection
(id, slug, position, group)[source]¶ Bases:
nested_admin.tests.two_deep.models.SectionAbstract
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
group
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
group_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
item_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
objects
= <django.db.models.manager.Manager object>¶
-
exception
nested_admin.tests.two_deep.tests module¶
-
class
InlineAdminTestCaseMixin
[source]¶ Bases:
object
-
test_add_remove_items_in_new_section_dragging_existing_items
()[source]¶ Tests for a regression that could be reproduced with the following steps:
- Begin with one section, with at least one item in it.
- Create a new section
- Create three items in the new section
- Remove the first of the new items
- Drag the first of the existing items into the first position in the new section.
6. Remove the second item in the new section 8. Save
- Expected outcome:
- The dragged item from the existing section should have been moved to the new section.
- Outcome with bug:
- The item has not moved.
-
test_delete_item_undelete_section
()[source]¶ Test that, if an item is deleted, then the section is deleted, and then the section is undeleted, that the item stays deleted.
-
test_drag_first_item_to_new_section
()[source]¶ Test dragging the first of several items in a pre-existing section into a newly created section.
-
test_drag_first_item_to_new_section_after_removing_item
()[source]¶ Test dragging the first of several items in a pre-existing section into a newly created section after having added two items and then removing one of those items.
-
test_drag_item_create_invalid_new_item_then_drag_back_after_validation_error_removing_invalid_item
()[source]¶ Tests regression of a scenario after encountering a validation error.
- Steps to reproduce:
- Begin with at least two items in each section
- Drag one of the items from the first section into the second
- Create an invalid item in the first section
- Save, encounter a validation error
- Drag the invalid item back to the first group
- Remove the invalid item
- Save, get a 500 Internal Server Error
-
-
class
TestSortablesWithExtra
(methodName='runTest')[source]¶ Bases:
nested_admin.tests.base.BaseNestedAdminTestCase
-
nested_models
= (<class 'nested_admin.tests.two_deep.models.SortableWithExtraChild'>,)¶
-
root_model
¶ alias of
nested_admin.tests.two_deep.models.SortableWithExtraRoot
-
-
class
TestStackedInlineAdmin
(methodName='runTest')[source]¶ Bases:
nested_admin.tests.two_deep.tests.InlineAdminTestCaseMixin
,nested_admin.tests.base.BaseNestedAdminTestCase
-
nested_models
= (<class 'nested_admin.tests.two_deep.models.StackedSection'>, <class 'nested_admin.tests.two_deep.models.StackedItem'>)¶
-
root_model
¶
-
-
class
TestTabularInlineAdmin
(methodName='runTest')[source]¶ Bases:
nested_admin.tests.two_deep.tests.InlineAdminTestCaseMixin
,nested_admin.tests.base.BaseNestedAdminTestCase
-
nested_models
= (<class 'nested_admin.tests.two_deep.models.TabularSection'>, <class 'nested_admin.tests.two_deep.models.TabularItem'>)¶
-
root_model
¶
-