Merge lp:~milo/linaro-ci-dashboard/textfield-loop into lp:linaro-ci-dashboard
Status: | Merged |
---|---|
Approved by: | Stevan Radaković |
Approved revision: | 34 |
Merged at revision: | 34 |
Proposed branch: | lp:~milo/linaro-ci-dashboard/textfield-loop |
Merge into: | lp:linaro-ci-dashboard |
Diff against target: | 0 lines |
To merge this branch: | bzr merge lp:~milo/linaro-ci-dashboard/textfield-loop |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stevan Radaković | Approve | ||
Review via email:
|
Description of the change
Here there is the implementation of a generic text-field loop and AndroidTextFiel
I added a new model inside 'frontend/models' called TextFieldLoop, that is the generic model inheriting from Loop. AndroidTextFiel
In AndroidTextFiel
WRT this last point, at the moment I added some other methods in order to achieve class instantiation starting from a string. They are not used for now, and are in for review.
What 'can_chain_with' returns is a list of tuples, tuples defined in the 'loop_reference' file inside 'frontend/models/'. Each tuple consists of: (VISIBLE_NAME, MODULE_PATH.CLASS). There is an additional class, always in 'frontend/models/' called LoopFactory, with a static method, that from a string returns the corresponding class (this is a class object, it is not the real object, that needs to be instantiated later). These are just ideas on how to possibly implement this. I do not really like the part about hardcoding the module path, but at the moment I couldn't find another solution.
Hmmm, before addressing other stuff I'd like to discuss your loop_reference logic. chainable( self): get(type= [self.get_ child_object( ).can_chain_ with()] )
I don't understand the purpose of it nor why would we need the paths to our models.
The only usage of the can_chain_with method is to (in the end) get all the loops which are 'chainable' to the specific loop.
If can_chain_with returns the class names only in a simple list (we can track 'all' our class names in settings or separate class like you already have, but this is not really needed), then in a method we talked about (i.e. get_all_chainable) we would just query all loops with that specific types:
i.e.
def get_all_
loops = Loop.objects.
where get_all_chainable is part of the Loop model.
I may be missing something here but I rly don't see the need of having class paths.