-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new proxies, methods and properties for getting OCD metadata
- Loading branch information
Showing
13 changed files
with
222 additions
and
41 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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Base class for proxies to OCD models. | ||
""" | ||
import textwrap | ||
|
||
|
||
class OCDProxyModelMixin(object): | ||
""" | ||
Properties and methods shared by all OCD proxy models. | ||
""" | ||
@property | ||
def model(self): | ||
""" | ||
Returns the model class that is being proxied. | ||
""" | ||
return self.__class__.__bases__[0] | ||
|
||
@property | ||
def doc(self): | ||
""" | ||
Returns doc string of the model corresponding to the ProcessedDataFile. | ||
""" | ||
if self.model.__doc__.startswith(self.model._meta.object_name): | ||
return '' | ||
return textwrap.dedent(self.model.__doc__).strip() | ||
|
||
@property | ||
def klass_group(): | ||
""" | ||
Return the model's group. | ||
""" | ||
return "CCDC" | ||
|
||
def get_field_list(self): | ||
""" | ||
Return all the fields on the model as a list. | ||
""" | ||
return self.model._meta.fields |
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
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
Oops, something went wrong.