-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Load resources with get_class and register model field resolver in __init__ * Add inheritable resources that allow the usage of get_class * Add the 'Resource' suffis to all resources, as right now its confusing to work with * More suffixes * New major release because breaking changes * Load all resources now with get_class * Load more things with get_classes. Remove '_' prefix from some files names, as they're not just used internally. Rename inheritable resources to same odin name, as this is just what should be used for oscar resources if you want them to be able to be subclassed. * Load ModelMapping & ParentProductResource with get_class too * fix modelmapping import --------- Co-authored-by: Joey Jurjens <joey@highbiza.nl>
- Loading branch information
1 parent
500c596
commit 3dafbd5
Showing
20 changed files
with
354 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
"""Mappings between odin and django auth models.""" | ||
from oscar.core.loading import get_model | ||
|
||
from .. import resources | ||
from ._common import OscarBaseMapping | ||
from oscar.core.loading import get_model, get_class | ||
|
||
__all__ = ("UserToResource",) | ||
|
||
UserModel = get_model("auth", "User") | ||
|
||
# mappings | ||
OscarBaseMapping = get_class("oscar_odin.mappings.common", "OscarBaseMapping") | ||
|
||
# resources | ||
UserResource = get_class("oscar_odin.resources.auth", "UserResource") | ||
|
||
|
||
class UserToResource(OscarBaseMapping): | ||
"""Mapping from user model to resource.""" | ||
|
||
from_obj = UserModel | ||
to_obj = resources.auth.User | ||
to_obj = UserResource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.