class Change( models.Model): class Meta: verbose_name = _("Change") verbose_name_plural = _("Changes") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'audyty' ordering = ['id'] softlab_id = models.CharField('Softabl ID', null=False, blank=False, editable=True, max_length=64) asseco_id = models.CharField('Asseco ID', null=False, blank=False, editable=True, max_length=64) helpdesk_id = models.CharField('HelpDesk ID', null=False, blank=False, editable=True, max_length=64) description = models.CharField('Description', null=False, blank=False, editable=True, max_length=64) author = models.CharField('Author', null=False, blank=False, editable=True, max_length=64) test_ver = models.CharField('Version of test', null=False, blank=False, editable=True, max_length=64) test_exists = ext_models.NullBooleanField('Test exists', null=True, blank=True, editable=True, default=False,) tested = ext_models.NullBooleanField('Tested', null=True, blank=True, editable=True, default=False,) published = ext_models.NullBooleanField('Published', null=True, blank=True, editable=True, default=False,) create_date = models.DateField('Creating date', null=True, blank=True, editable=True, ) pub_date = models.DateField('Date of publication', null=True, blank=True, editable=True, )
class AgreementDoc(models.Model): class Meta: verbose_name = _("Agreement document") verbose_name_plural = _("Agreement documents") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'crh' ordering = ['id'] name = models.CharField('Name', null=False, blank=False, editable=True, max_length=64) data = models.TextField( 'Data', null=True, blank=True, editable=False, ) obligatory = ext_models.NullBooleanField( 'Obligatory', null=False, blank=False, editable=True, )
class CommonGroupDef(BaseObject): class Meta: verbose_name = _("Common group definition") verbose_name_plural = _("Common groups definition") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'schreports' ordering = ['id'] on_new_elem_event = models.TextField( 'On new elemetn event', null=True, blank=True, editable=False, ) allowed_new_fields = models.TextField( 'Allowed new fields', null=True, blank=True, editable=False, ) main_group = ext_models.NullBooleanField( 'Main group', null=True, blank=True, editable=True, )
class TestForUser( models.Model): class Meta: verbose_name = _("Test for user") verbose_name_plural = _("Tests for user") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'audyty' ordering = ['id'] parent = ext_models.ForeignKey(Test, on_delete=models.CASCADE, null=False, blank=False, editable=True, verbose_name='Parent', ) username = models.CharField('None', null=False, blank=False, editable=True, max_length=64) send_date = models.DateTimeField('Date of sending', null=True, blank=True, editable=True, ) close_date = models.DateTimeField('Closing date', null=True, blank=True, editable=True, ) finished = ext_models.NullBooleanField('Finished', null=True, blank=True, editable=True, default=False,) ok = ext_models.NullBooleanField('OK', null=True, blank=True, editable=True, default=False,) closed = ext_models.NullBooleanField('Closed', null=True, blank=True, editable=True, default=False,)
class Test( models.Model): class Meta: verbose_name = _("Test") verbose_name_plural = _("Tests") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'audyty' ordering = ['id'] softlab_comment_id = models.CharField('Softlab comment id', null=True, blank=True, editable=True, max_length=64) changes = ext_models.ManyToManyField(Change, null=False, blank=False, editable=True, verbose_name='Changes', ) description = models.CharField('None', null=True, blank=True, editable=True, max_length=64) questions = models.TextField('Questions', null=True, blank=True, editable=False, ) sign_count = models.IntegerField('Sign count', null=True, blank=True, editable=True, ) finished = ext_models.NullBooleanField('Finished', null=True, blank=True, editable=True, default=False,) ok = ext_models.NullBooleanField('OK', null=True, blank=True, editable=True, default=False,) closed = ext_models.NullBooleanField('Closed', null=True, blank=True, editable=True, default=False,)
class DocType(models.Model): class Meta: verbose_name = _("Type of document") verbose_name_plural = _("Types of documents") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'schelements' ordering = ['id'] parent = ext_models.HiddenForeignKey( DocReg, on_delete=models.CASCADE, null=False, blank=False, editable=True, verbose_name='Parent', ) name = models.CharField('Name', null=False, blank=False, editable=True, max_length=16) description = models.CharField('Description', null=False, blank=False, editable=True, max_length=64) correction = ext_models.NullBooleanField( 'Correction', null=True, blank=True, editable=True, ) head_form = models.TextField( 'Head form', null=True, blank=True, editable=False, ) item_form = models.TextField( 'Item form', null=True, blank=True, editable=False, ) save_head_fun = models.TextField( 'Save head function', null=True, blank=True, editable=False, ) save_item_fun = models.TextField( 'Save item function', null=True, blank=True, editable=False, ) doctype_status = models.CharField('Status of document type', null=True, blank=True, editable=True, choices=doctype_status, max_length=1)
class AccountOperation(models.Model): class Meta: verbose_name = _("Account operation") verbose_name_plural = _("Account operations") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'schelements' ordering = ['id'] parent = ext_models.HiddenForeignKey( DocItem, on_delete=models.CASCADE, null=False, blank=False, editable=True, verbose_name='Parent', ) date = models.DateTimeField( 'Date', null=False, blank=False, editable=False, default=datetime.datetime.now, ) description = models.CharField('Description', null=False, blank=False, editable=True, max_length=255) payment = models.CharField('Name of payment', null=True, blank=True, editable=True, max_length=64) account_state = ext_models.ForeignKey(AccountState, on_delete=models.CASCADE, null=True, blank=True, editable=True, verbose_name='Account state', related_name='accountoper_set') sign = models.IntegerField( 'Sign - debit or credit', null=False, blank=False, editable=True, ) amount = models.DecimalField('Amount', null=False, blank=False, editable=True, max_digits=16, decimal_places=2) enabled = ext_models.NullBooleanField( 'Enabled', null=True, blank=True, editable=False, default=False, ) def get_account_state(self, account, element, period, target, classifier1=None, classifier2=None, classifier3=None, subcode="", aggregate=False): if type(account) == str: _account = Account.objects.filter(name=account)[0] else: _account = account if type(element) == str: _element = Element.objects.filter(name=element)[0] else: _element = element if type(target) == str: _target = OrgChartElem.objects.filter(code=target)[0] else: _target = target objs = AccountState.objects.filter(parent=_account, target=_target, classifier1value=classifier1, classifier2value=classifier2, classifier3value=classifier3, period=period, subcode=subcode, element=_element) if objs.count() > 0: return objs[0] else: obj = AccountState() obj.parent = _account obj.target = _target obj.classifier1value = classifier1 obj.classifier2value = classifier2 obj.classifier3value = classifier3 obj.period = period obj.subcode = subcode obj.element = _element obj.aggregate = aggregate obj.debit = 0 obj.credit = 0 obj.save() return obj def update_account_state(self, debit, credit): s = self.account_state account = s.parent for period in [s.period, '*']: for target in [s.target, None]: for subcode in [s.subcode, "*"]: state = self.get_account_state(account, s.element, period, target, subcode=subcode, aggregate=True) state.debit += debit state.credit += credit state.save() account = account.parent subcode = "*" while account: for period in [s.period, '*']: for target in [s.target, None]: state = self.get_account_state(account, s.element, period, target, subcode=subcode, aggregate=True) state.debit += debit state.credit += credit state.save() account = account.parent def confirm(self): ret = False with transaction.atomic(): self.refresh_from_db() if not self.enabled: self.enabled = True if self.sign > 0: self.update_account_state(0, self.amount) else: self.update_account_state(self.amount, 0) self.save() ret = True return ret def cancel_confirmation(self): ret = False with transaction.atomic(): self.refresh_from_db() if self.enabled: self.enabled = False if self.sign > 0: self.update_account_state(0, -1 * self.amount) else: self.update_account_state(-1 * self.amount, 0) self.save() ret = True return ret
class AccountState(models.Model): class Meta: verbose_name = _("State of account") verbose_name_plural = _("States of account") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'schelements' ordering = ['id'] parent = models.ForeignKey( Account, on_delete=models.CASCADE, null=False, blank=False, editable=True, verbose_name='Parent', ) target = models.ForeignKey( OrgChartElem, on_delete=models.CASCADE, null=True, blank=True, editable=True, verbose_name='Target', ) classifier1value = models.ForeignKey(Classifier, on_delete=models.CASCADE, null=True, blank=True, editable=True, verbose_name='Classifier 1 value', related_name='account_c1_set') classifier2value = models.ForeignKey(Classifier, on_delete=models.CASCADE, null=True, blank=True, editable=True, verbose_name='Classifier 2 value', related_name='account_c2_set') classifier3value = models.ForeignKey(Classifier, on_delete=models.CASCADE, null=True, blank=True, editable=True, verbose_name='Classifier 3 value', related_name='account_c3_set') period = models.CharField('Period', null=True, blank=True, editable=True, max_length=10) subcode = models.CharField('Subcode', null=True, blank=True, editable=True, max_length=16) element = models.ForeignKey( Element, on_delete=models.CASCADE, null=False, blank=False, editable=True, verbose_name='Element', ) debit = models.DecimalField('Debit', null=False, blank=False, editable=True, max_digits=16, decimal_places=2) credit = models.DecimalField('Credit', null=False, blank=False, editable=True, max_digits=16, decimal_places=2) aggregate = ext_models.NullBooleanField( 'Aggregate', null=False, blank=False, editable=True, default=False, )
class Account(TreeModel): class Meta: verbose_name = _("Account") verbose_name_plural = _("Account") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'schelements' ordering = ['id'] parent = ext_models.TreeForeignKey('self', on_delete=models.CASCADE, null=True, blank=True, related_name='children') parent = ext_models.TreeForeignKey( 'self', on_delete=models.CASCADE, null=True, blank=True, editable=True, verbose_name='Parent', ) type1 = models.CharField('Type 1', null=True, blank=True, editable=False, choices=account_type_choice_1, max_length=1) type2 = models.CharField('Type 2', null=True, blank=True, editable=True, choices=account_type_choice_2, max_length=1) name = models.CharField('Name', null=False, blank=False, editable=True, max_length=32) description = models.CharField('Description', null=False, blank=False, editable=True, max_length=256) root_classifier1 = ext_models.ForeignKey( Classifier, on_delete=models.CASCADE, null=True, blank=True, editable=True, verbose_name='Root classifier 1', related_name='baseaccount_rc1_set') root_classifier2 = ext_models.ForeignKey( Classifier, on_delete=models.CASCADE, null=True, blank=True, editable=True, verbose_name='Root classifier 2', related_name='baseaccount_rc2_set') root_classifier3 = ext_models.ForeignKey( Classifier, on_delete=models.CASCADE, null=True, blank=True, editable=True, verbose_name='Root classifier 3', related_name='baseaccount_rc3_set') enabled = ext_models.NullBooleanField( 'Enabled', null=False, blank=False, editable=True, default=True, ) def save(self, *args, **kwargs): if self.parent: self.parent.type1 = 'S' self.parent.save() self.type2 = self.parent.type2 self.type1 = 'A' super().save(*args, **kwargs) def __str__(self): x = self ret = self.name while (x.parent): x = x.parent ret = x.name + "/" + ret ret += ": " ret += self.description return ret
class Ad(models.Model): class Meta: verbose_name = _("AD") verbose_name_plural = _("AD") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'crh' ordering = ['id'] c = models.CharField('c', null=True, blank=True, editable=True, max_length=64) company = models.CharField('company', null=True, blank=True, editable=True, max_length=64) co = models.CharField('co', null=True, blank=True, editable=True, max_length=64) physicalDeliveryOfficeName = models.CharField('physicalDeliveryOfficeName', null=True, blank=True, editable=True, max_length=64) postalCode = models.CharField('postalCode', null=True, blank=True, editable=True, max_length=64) l = models.CharField('l', null=True, blank=True, editable=True, max_length=64) streetAddress = models.CharField('streetAddress', null=True, blank=True, editable=True, max_length=64) employeeID = models.CharField('employeeID', null=True, blank=True, editable=True, max_length=64) sAMAccountName = models.CharField('sAMAccountName', null=True, blank=True, editable=True, max_length=64) displayName = models.CharField('displayName', null=True, blank=True, editable=True, max_length=64) name = models.CharField('name', null=True, blank=True, editable=True, max_length=64) cn = models.CharField('cn', null=True, blank=True, editable=True, max_length=64) givenName = models.CharField('givenName', null=True, blank=True, editable=True, max_length=64) sn = models.CharField('sn', null=True, blank=True, editable=True, max_length=64) title = models.CharField('title', null=True, blank=True, editable=True, max_length=64) department = models.CharField('department', null=True, blank=True, editable=True, max_length=64) distinguishedName = models.CharField('distinguishedName', null=True, blank=True, editable=True, max_length=64) userPrincipalName = models.CharField('userPrincipalName', null=True, blank=True, editable=True, max_length=64) mail = models.CharField('mail', null=True, blank=True, editable=True, max_length=64) telephoneNumber = models.CharField('telephoneNumber', null=True, blank=True, editable=True, max_length=64) mobile = models.CharField('mobile', null=True, blank=True, editable=True, max_length=64) manager = models.CharField('manager', null=True, blank=True, editable=True, max_length=64) userAccountControl = models.CharField('userAccountControl', null=True, blank=True, editable=True, max_length=64) whenCreated = models.CharField('whenCreated', null=True, blank=True, editable=True, max_length=64) PwdLastSet = models.CharField('PwdLastSet', null=True, blank=True, editable=True, max_length=64) manager_name = models.CharField('manager_name', null=True, blank=True, editable=True, max_length=64) is_ok = ext_models.NullBooleanField( 'None', null=True, blank=True, editable=True, ) disabled = ext_models.NullBooleanField( 'Disabled', null=True, blank=True, editable=True, ) errors = models.CharField('Errors', null=True, blank=True, editable=True, max_length=256) active = ext_models.NullBooleanField( 'Active', null=False, blank=False, editable=True, )
class Page(JSONModel): class Meta: verbose_name = _("Page") verbose_name_plural = _("Page") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'schwiki' ordering = ['id'] subject = models.CharField('Subject', null=False, blank=False, editable=True, max_length=64) name = models.CharField('Name', null=False, blank=False, editable=True, max_length=64) description = models.CharField('Description', null=True, blank=True, editable=True, max_length=64) content_src = models.TextField( 'Content source', null=True, blank=True, editable=False, ) content = models.TextField( 'Content', null=True, blank=True, editable=False, ) base_template = models.CharField('Base template', null=True, blank=True, editable=True, max_length=64) rights_group = models.CharField('Rights group', null=True, blank=True, editable=True, max_length=64) menu = models.CharField('Menu', null=True, blank=True, editable=True, max_length=64) operator = models.CharField('Operator', null=True, blank=True, editable=False, max_length=64) update_time = models.DateTimeField( 'Update time', null=False, blank=False, editable=False, default=datetime.now, ) published = ext_models.NullBooleanField( 'Published', null=False, blank=False, editable=False, default=False, ) latest = ext_models.NullBooleanField( 'Latest', null=False, blank=False, editable=False, default=True, ) def save_from_request(self, request, view_type, param): if 'direct_save' in request.POST: super(Page, self).save() else: conf_list = WikiConf.objects.filter(subject=self.subject) conf_exists = False if len(conf_list) > 0: conf = conf_list[0] conf_exists = True if conf.backup_copies > 0: pages = Page.objects.filter( subject=self.subject, name=self.name).update(latest=False) obj_to_save = Page() obj_to_save.subject = self.subject obj_to_save.name = self.name obj_to_save.description = self.description obj_to_save.content_src = self.content_src obj_to_save.content = self.content obj_to_save.base_template = self.base_template obj_to_save.rights_group = self.rights_group obj_to_save.menu = self.menu obj_to_save.operator = self.operator obj_to_save.update_time = self.update_time obj_to_save.jsondata = self.jsondata obj_to_save.published = False obj_to_save.latest = True obj_to_save.operator = request.user.username obj_to_save.update_time = datetime.now() obj_to_save.save() pages = Page.objects.filter( subject=self.subject, name=self.name).order_by('update_time') if len(pages) > conf.backup_copies: to_delete_count = len(pages) - conf.backup_copies to_delete = [] for pos in pages: if not pos.published and not pos.latest: to_delete.append(pos) to_delete_count -= 1 if to_delete_count <= 0: break if to_delete: for pos2 in to_delete: pos2.delete() return self.operator = request.user.username self.update_time = datetime.now() self.latest = True if not conf_exists: self.published = True self.save() def save(self, *args, **kwargs): #if not self.id: super(Page, self).save(*args, **kwargs) if self.content_src: content = html_from_wiki(self, self.content_src + "\n\n\n ") else: content = "" self.content = content super(Page, self).save(*args, **kwargs) def transform_template_name(self, request, template_name): return "schwiki/edit_wiki_content.html" def get_form(self, view, request, form_class, adding): return None def get_page_for_wiki(self, wiki_str, user=None): wiki_word = wiki_from_str(wiki_str) return Page.get_page(user, self.subject, wiki_word) def get_href(self, path=None): return make_href(self.description if self.description else self.name, new_win=False, section=self.subject, path=path) @staticmethod def get_page(request_or_username, subject, name): if type(request_or_username) == str: username = request_or_username elif request_or_username.user: username = request_or_username.user.username else: username = None objs = None if username: objs = Page.objects.filter(subject=subject, name=name, operator=username, latest=True) if not objs or len(objs) == 0: objs = Page.objects.filter(subject=subject, name=name, published=True) if not objs or len(objs) == 0: objs = Page.objects.filter(subject=subject, name=name) if len(objs) > 0: return objs[0] else: return None def __str__(self): return self.name
class Employee(models.Model): class Meta: verbose_name = _("Employee") verbose_name_plural = _("Employees") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'config' ordering = ['id'] surname = models.CharField('Surname', null=False, blank=False, editable=True, max_length=64) name = models.CharField('Name', null=False, blank=False, editable=True, max_length=64) email = models.EmailField( 'Email', null=False, blank=False, editable=True, ) company = models.CharField('Company', null=True, blank=True, editable=True, choices=CompanyChoice, max_length=64) department = models.CharField('Department', null=True, blank=True, editable=True, max_length=64) location = models.CharField('Location', null=True, blank=True, editable=True, max_length=64) title = models.CharField('Title', null=True, blank=True, editable=True, max_length=64) external_id = models.CharField('External id', null=True, blank=True, editable=True, max_length=64) postalCode = models.CharField('Postal code', null=True, blank=True, editable=True, max_length=16) city = models.CharField('City', null=True, blank=True, editable=True, max_length=64) street = models.CharField('Street', null=True, blank=True, editable=True, max_length=64) telephoneNumber = models.CharField('Telephone number', null=True, blank=True, editable=True, max_length=32) mobile = models.CharField('Mobile telephone number', null=True, blank=True, editable=True, max_length=32) manager_name = models.CharField('Manager name', null=True, blank=True, editable=True, max_length=64) active = ext_models.NullBooleanField( 'Active', null=False, blank=False, editable=True, )
class SChTemplate( models.Model): class Meta: verbose_name = _("SChTemplate") verbose_name_plural = _("SChTemplate") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'schbuilder' ordering = ['id'] parent = ext_models.HiddenForeignKey(SChApp, on_delete=models.CASCADE, null=False, blank=False, editable=True, verbose_name='Parent', ) name = models.CharField('Name', null=False, blank=False, editable=True, max_length=255) direct_to_template = ext_models.NullBooleanField('Direct to template', null=True, blank=True, editable=True, ) url = models.CharField('Url', null=True, blank=True, editable=True, max_length=64) url_parm = models.CharField('Parameters passed to the template', null=True, blank=True, editable=True, max_length=128) template_code = models.TextField('Template code', null=True, blank=True, editable=False, ) static_files = models.ManyToManyField(SChStatic, null=True, blank=True, editable=True, verbose_name='Static files', ) tags_mount = models.CharField('Mount component tags', null=True, blank=True, editable=True, max_length=256) def get_url_name(self): if self.url and self.url!="": return self.url else: return self.name def get_url(self): if self.direct_to_template: url_name = self.get_url_name() app_name = self.parent.name template_name = self.name.lower().replace(' ','_')+".html" if self.url_parm: param = self.url_parm else: param = "" return "url(r'^%s', TemplateView.as_view(template_name='%s/%s'), {%s})" % (url_name, app_name, template_name, param ) else: return None def _get_table_fields(self, tables): ret=[] if len(tables)==1: table = tables[0] for pos in table.schfield_set.all(): ret.append(pos.name) if table.base_table and table.base_table != None: ret2 = self._get_table_fields(SChTable.objects.filter(name=table.base_table)) for pos in ret2: ret.append(pos) return ret def get_table_fields(self): return self._get_table_fields(self.parent.schtable_set.filter(parent=self.parent).filter(name=self.name)) def get_table_methods(self): ret=[] tables = self.parent.schtable_set.filter(parent=self.parent).filter(name=self.name) if len(tables)==1: table = tables[0] if table.table_code: for line in table.table_code.split('\n'): if line.startswith('def'): ret.append(line[4:]) return ret def get_django_filters(self): ret = [] django_engine = engines['django'].engine for pos in django_engine.template_builtins: for f in pos.filters: ret.append(f) return ret def get_django_tags(self): ret = [] django_engine = engines['django'].engine for pos in django_engine.template_builtins: for f in pos.tags: ret.append(f) return ret def get_blocks(self): ret=[] form_path = os.path.join(os.path.dirname(__file__)+"/../../../templates_src/form.ihtml") f = open(form_path, "rt") buf = f.read() f.close() for line in buf.split('\n'): if "%%" in line: ret.append(superstrip(line).replace(' ','')) return ret def get_template_widgets(self): return widgets def transform_template_name(self, request, template_name): if 'template_code/py/editor' in request.path: if template_name == 'schsys/db_field_edt.html': return 'schbuilder/db_field_edt_template.html' return template_name def __str__(self): return self.name
class SChAppSet( models.Model): class Meta: verbose_name = _("Application package") verbose_name_plural = _("Application packages") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'schbuilder' ordering = ['id'] name = models.CharField('Name', null=False, blank=False, editable=True, max_length=64) title = models.CharField('Title', null=False, blank=False, editable=True, max_length=255) ext_apps = models.CharField('Extern applications', null=True, blank=True, editable=True, max_length=4096) plugins = models.CharField('Plugins', null=True, blank=True, editable=True, max_length=4096) gui_type = models.CharField('Gui type', null=False, blank=False, editable=True, choices=Gui_CHOICES,max_length=32) gui_elements = models.CharField('Gui elements', null=True, blank=True, editable=True, max_length=1024) login_required = ext_models.NullBooleanField('Login required', null=True, blank=True, editable=True, default=False,) public = ext_models.NullBooleanField('Public', null=True, blank=True, editable=True, default=False,) main = ext_models.NullBooleanField('Main project', null=True, blank=True, editable=True, default=False,) start_page = models.CharField('Start page', null=True, blank=True, editable=True, max_length=255) user_app_template = models.TextField('User application template', null=True, blank=True, editable=False, ) app_main = models.TextField('Main application entrypoint', null=True, blank=True, editable=False, ) doc = models.TextField('Doc', null=True, blank=True, editable=False, ) desktop_gui_type = models.CharField('Gui type for pc web browser', null=False, blank=False, editable=True, default='auto',choices=HtmlGui_CHOICES,max_length=32) smartfon_gui_type = models.CharField('Gui type for smartfon', null=False, blank=False, editable=True, default='auto',choices=HtmlGui_CHOICES,max_length=32) tablet_gui_type = models.CharField('Gui type for tablet', null=False, blank=False, editable=True, default='auto',choices=HtmlGui_CHOICES,max_length=32) user_param = models.TextField('User parameter', null=True, blank=True, editable=True, ) custom_tags = models.TextField('Custom tags', null=True, blank=True, editable=True, ) readme_file = models.TextField('readme.txt', null=True, blank=True, editable=False, ) license_file = models.TextField('license.txt', null=True, blank=True, editable=False, ) install_file = models.TextField('install.ini', null=True, blank=True, editable=False, ) encoded_zip = models.TextField('Encoded zip file', null=True, blank=True, editable=False, ) def get_ext_apps(self, tab=None): if tab: ret = tab else: ret = [] if self.ext_apps: #if self.ext_apps == '*': # appset_list = SChAppSet.objects.all() # for pos in appset_list: # if pos.name == self.name or not pos.public: # continue # app_list = pos.schapp_set.all() # for pos2 in app_list: # name = pos.name+"."+pos2.name # if not name in ret: # ret.append(name) # return ret #else: l=self.ext_apps.split(',') else: return ret for a in l: if a !='': if not a in ret: ret.append(a) return ret def get_ext_apps_without_pack(self): ret = [] if self.ext_apps: l=self.ext_apps.split(',') for a in l: if a !='': if '.' in a: ret.append(a.split('.')[1]) else: ret.append(a) return ret def get_ext_modules(self): ret = [] if self.ext_apps: l=self.ext_apps.split(',') for a in l: elms=a.split('.') if len(elms)>1: module=elms[-2] ret.append(module) return ret def __str__(self): return self.name @classmethod def table_action(cls, list_view, request, data): return standard_table_action(cls, list_view, request, data, ['copy', 'paste'])
class SChFormField( models.Model): class Meta: verbose_name = _("Form field") verbose_name_plural = _("Form field") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'schbuilder' ordering = ['id'] parent = ext_models.HiddenForeignKey(SChForm, on_delete=models.CASCADE, null=False, blank=False, editable=True, verbose_name='Parent', ) name = models.CharField('Name', null=False, blank=False, editable=True, max_length=64) type = models.CharField('Type', null=False, blank=False, editable=True, choices=FormField_CHOICES,max_length=64) required = ext_models.NullBooleanField('Required', null=True, blank=True, editable=True, ) label = models.CharField('Label', null=False, blank=False, editable=True, max_length=64) initial = models.CharField('Initial', null=True, blank=True, editable=True, max_length=256) widget = models.CharField('Widget', null=True, blank=True, editable=True, max_length=64) help_text = models.CharField('Help text', null=True, blank=True, editable=True, max_length=256) error_messages = models.CharField('Error messages', null=True, blank=True, editable=True, max_length=64) param = models.CharField('Param', null=True, blank=True, editable=True, max_length=64) def init_new(self, request, view, param=None): if param: self.type=param defaults=self.get_field_defaults() defaults['type'] = param for key in defaults: setattr(self, key, defaults[key]) return defaults else: return None def as_declaration(self): if self.type == 'UserField': return self.param ret = "%s = forms.%s(label=_('%s'), required=%s, " % \ (self.name, self.type, self.label, self.required) if self.initial: ret+= "initial=%s," % self.initial if self.widget and len(self.widget)>0: ret+= "widget=%s," % self.widget if self.help_text and len(self.help_text)>0: ret+= "help_text=%s," % self.help_text if self.error_messages: ret+="error_messages=%s," % self.error_messages if self.param and len(self.param)>0: ret+= self.param ret += ")" return ret def get_field_defaults(self): ret = formfield_default.copy() if self.type in formfield_defaults: for key, value in formfield_defaults[self.type].items(): ret[key]=value return ret
class Raporty(models.Model): class Meta: verbose_name = _("Raporty") verbose_name_plural = _("Raporty") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'raporty' ordering = ['id'] name = models.CharField('Nazwa', null=False, blank=False, editable=True, max_length=64) description = models.CharField('Opis', null=True, blank=True, editable=True, max_length=128) simple = models.BooleanField( 'Jako załącznik', null=False, blank=False, editable=True, default=True, ) select = models.TextField( 'Select', null=False, blank=False, editable=True, ) columns = models.CharField('Kolumny', null=False, blank=False, editable=True, max_length=1024) header = models.CharField('Header', null=True, blank=True, editable=True, max_length=1024) footer = models.CharField('Footer', null=True, blank=True, editable=True, max_length=1024) okres = models.CharField('Okres powtarzania', null=False, blank=False, editable=True, choices=RapOkresChoice, max_length=1) narast = ext_models.NullBooleanField( 'Narastająco', null=True, blank=True, editable=True, ) mail = models.TextField( 'Mali do', null=True, blank=True, editable=True, ) typ = models.CharField('Typ raportu', null=True, blank=True, editable=True, choices=RapTypChoice, max_length=16) group = models.CharField('Grupa', null=True, blank=True, editable=True, max_length=64) rigth_group = models.CharField('Grupa uprawnień', null=True, blank=True, editable=True, max_length=64)
class qlik_klient(models.Model): class Meta: verbose_name = _("qlik_klient") verbose_name_plural = _("qlik_klient") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'qlikview' ordering = ['id'] FIRMA_ID = models.CharField('FIRMA_ID', null=False, blank=False, editable=False, max_length=16) LogoP = models.CharField('LogoP', null=True, blank=True, editable=True, max_length=16) NazwaP = models.CharField('NazwaP', null=True, blank=True, editable=True, max_length=128) Logo = models.CharField('Logo', null=False, blank=False, editable=False, max_length=16) Nazwa = models.CharField('Nazwa', null=False, blank=False, editable=False, max_length=128) Segment = models.CharField('Segment', null=True, blank=True, editable=False, max_length=64) Segment_2 = models.CharField('Segment_2', null=True, blank=True, editable=False, max_length=64) KlasABC = models.CharField('KlasABC', null=True, blank=True, editable=False, max_length=64) OsFizyczna = ext_models.NullBooleanField( 'OsFizyczna', null=True, blank=True, editable=True, ) KodP = models.CharField('KodP', null=True, blank=True, editable=True, max_length=16) Miasto = models.CharField('Miasto', null=True, blank=True, editable=True, max_length=128) Powiat = models.CharField('Powiat', null=True, blank=True, editable=True, max_length=64)
class PageObjectsConf(models.Model): class Meta: verbose_name = _("Page objects configurations") verbose_name_plural = _("Page objects configurations") default_permissions = ('add', 'change', 'delete', 'list') app_label = 'schwiki' ordering = ['id'] app = models.CharField('Application', null=False, blank=False, editable=True, max_length=32) name = models.CharField('Name', null=False, blank=False, editable=True, max_length=64) description = models.CharField('Description', null=True, blank=True, editable=True, max_length=128) inline_editing = ext_models.NullBooleanField( 'Inline editing', null=False, blank=False, editable=True, default=False, ) inline_wiki = ext_models.NullBooleanField( 'Inline wiki', null=False, blank=False, editable=True, default=False, ) edit_form = models.TextField( 'Edit form', null=True, blank=True, editable=False, ) load_fun = models.TextField( 'Load function', null=True, blank=True, editable=False, ) save_fun = models.TextField( 'Save function', null=True, blank=True, editable=False, ) view_dict = models.TextField( 'Get view dict function', null=True, blank=True, editable=False, ) doc = models.TextField( 'Documentaction', null=True, blank=True, editable=False, ) def __str__(self): return self.name