Skip to content

Commit

Permalink
[fix] Make base classes able to init normally.
Browse files Browse the repository at this point in the history
  • Loading branch information
KemoPanzah committed Jun 1, 2023
1 parent ca8c023 commit 82b23ab
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions README_DE.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Folgende Felder sind derzeit in decore Base nutzbar und werden vom Frontend ausg
```mermaid
graph
A[Base] --> B[View]
A --> Y[Function]
B --> Z[Action]
B --> C[Dialog]
C --> D[Widget]
Expand Down
26 changes: 15 additions & 11 deletions decore_base/decore.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,21 @@ def wrapper(func):

def base(self, p_icon=None, p_title=None, p_desc=None, p_model=Decore_model):
def wrapper(cls):
Base = type(cls.__name__, (cls, Decore_base), {})
t_base = Base()
t_base.id = cls.__name__
t_base.icon = p_icon
t_base.title = p_title
t_base.desc = p_desc
t_base.doc = cls.__doc__
t_base.model = p_model.register()
t_base.field_s = p_model.field_s
t_base.rel_field_s = p_model.rel_field_s
t_base.schema = p_model.build_schema()
class Base(cls, Decore_base):
def __init__(self):
# cls.__init__(self)
Decore_base.__init__(self)
#TODO doppelt gemoppelte attribute aus decore_base oder decore_object entfernen
self.id = cls.__name__
self.icon = p_icon
self.title = p_title
self.desc = p_desc
self.doc = cls.__doc__
self.model = p_model.register()
self.field_s = p_model.field_s
self.rel_field_s = p_model.rel_field_s
self.schema = p_model.build_schema()
t_base = type(cls.__name__, (Base,), {})()
self.pool.register(t_base)
return wrapper

Expand Down
4 changes: 3 additions & 1 deletion decore_base/sample/bases/global_management_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
from random import randrange

@decore.base(p_title='Global Management', p_icon='mdi-account-supervisor-circle-outline')
class Global_management_base(object):
class Global_management_base:
def __init__(self):
self.supertest = 'supertest'

@decore.function(p_type='init')
def query_tester(self):
Expand Down

0 comments on commit 82b23ab

Please sign in to comment.