djadapter¶
This module provides a adapter for django to use in your tools
On import django will be setup to work. This might take 1-5 seconds! From there on you have access to the database. If we are testing, this means the env var JUKEBOX_TESTING is set, then the import will create a test database automatically! Creating a test db will set the env var ‘TEST_DB’ to the name of the test db, so we can destroy it later.
The djadapter has shotcuts to the manger objects for each model. To make a query, use these managers. See the documentation of Managers, Retrieving objects and QuerySets. Just instead of <Model>.objects use a manager of djadapter as shortcut.
For example to query projects use:
from jukeboxcore import djadapter
djadapter.projects.all() # returns a QuerySet that can be used similar to a list
djadapter.projects.get(name='Some Project') # returns an instance of project if
# there is one but only one project with this name
djadapter.projects.filter(semester='SS14') # returns only projects of the summer semester 2014
- jukeboxcore.djadapter.setup_testdatabase()[source]¶
Create test database
We have to do some setup manually. manage.py test does that usually. Writes the db in the env var TEST_DB. This can be torn down afterwards.
- jukeboxcore.djadapter.GLOBAL_NAME = 'Global'¶
Name for global shots and sequences
- jukeboxcore.djadapter.RNDSEQ_NAME = 'RnD'¶
Name for the rnd sequence
- jukeboxcore.djadapter.DEFAULT_ASSETTYPES = ['prop', 'char', 'loc']¶
Tuples with name and description for the default assettypes that should always be available.
- jukeboxcore.djadapter.DEFAULT_DEPARTMENTS = [('Modeling', 'mod', 100, True), ('Shading', 'shd', 200, True), ('Rigging', 'rig', 300, True), ('Animation', 'ani', 100, False), ('Fx', 'fx', 200, False), ('Lighting', 'lgt', 300, False), ('Rendering', 'rdr', 400, False), ('Compositing', 'comp', 500, False), ('Grading', 'grd', 600, False)]¶
Tuples with name, short, ordervalue and assetflag for the default departments. Asset flag indicates if it is a department for assets or for shots. Every project will get these departments by default.
- jukeboxcore.djadapter.RELEASETYPES = {'release': 'release', 'work': 'work', 'handoff': 'handoff'}¶
Releasetype values for the different releasetypes
the values consist of tuples with the actual name and a description.
- jukeboxcore.djadapter.FILETYPES = {'mayamainscene': 'mayamainscene'}¶
A dict for file types that can be used in a TaskFile
the values are the actual data that gets stored in the database.
Explanations:
mayamainscene: probably the most common for maya scenes. these are the usual release and workfiles maybe even a handoff file, if it does not need a direct subfolder. Main scenes hold the main information, not just extracted parts. If you export shader or maybe some blendshapes in a scene, do not use this one.
- jukeboxcore.djadapter.projects = <django.db.models.manager.Manager object at 0x00000000082F1CC0>¶
The Project manager. Use it to query the database for projects.
- jukeboxcore.djadapter.atypes = <django.db.models.manager.Manager object at 0x00000000082FE630>¶
The Atype manager. Use it to query the database for atypes.
- jukeboxcore.djadapter.sequences = <django.db.models.manager.Manager object at 0x00000000082FEA58>¶
The Sequence manager. Use it to query the database for sequences.
- jukeboxcore.djadapter.departments = <django.db.models.manager.Manager object at 0x000000000830E4E0>¶
The Department manager. Use it to query the database for departments.
- jukeboxcore.djadapter.tasks = <django.db.models.manager.Manager object at 0x000000000831B1D0>¶
The Task manager. Use it to query the database for tasks.
- jukeboxcore.djadapter.assets = <django.db.models.manager.Manager object at 0x000000000831BC50>¶
The Asset manager. Use it to query the database for assets.
- jukeboxcore.djadapter.shots = <django.db.models.manager.Manager object at 0x00000000083A8B00>¶
The Shot manager. Use it to query the database for shots.
- jukeboxcore.djadapter.softwares = <django.db.models.manager.Manager object at 0x00000000083A8E10>¶
The Software manager. Use it to query the database for softwares.
- jukeboxcore.djadapter.files = <django.db.models.manager.Manager object at 0x00000000083B3908>¶
The File manager. Use it to query the database for files.
- jukeboxcore.djadapter.taskfiles = <django.db.models.manager.Manager object at 0x00000000083B3F28>¶
The Taskfile manager. Use it to query the database for taskfiles.
- jukeboxcore.djadapter.users = <django.contrib.auth.models.UserManager object at 0x000000000825FA20>¶
The user manager. Use it to query the database for users.
- jukeboxcore.djadapter.notes = <django.db.models.manager.Manager object at 0x00000000083B3320>¶
The note manager. Use it to query the database for notes.