Package ajango :: Package generator :: Package views :: Module raport
[hide private]
[frames] | no frames]

Source Code for Module ajango.generator.views.raport

 1  ########################################################################### 
 2  #                                                                         # 
 3  #  Copyright (C) 2016  Rafal Kobel <rafyco1@gmail.com>                    # 
 4  #                                                                         # 
 5  #  This program is free software: you can redistribute it and/or modify   # 
 6  #  it under the terms of the GNU General Public License as published by   # 
 7  #  the Free Software Foundation, either version 3 of the License, or      # 
 8  #  (at your option) any later version.                                    # 
 9  #                                                                         # 
10  #  This program is distributed in the hope that it will be useful,        # 
11  #  but WITHOUT ANY WARRANTY; without even the implied warranty of         # 
12  #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the           # 
13  #  GNU General Public License for more details.                           # 
14  #                                                                         # 
15  #  You should have received a copy of the GNU General Public License      # 
16  #  along with this program.  If not, see <http://www.gnu.org/licenses/>.  # 
17  #                                                                         # 
18  ########################################################################### 
19  """ 
20  Obiekt generujacy raport. 
21   
22  Obiekt generuje strone raportu. 
23   
24  Dostepne znaczniki 
25  ================== 
26   
27      1. B{QUERY} - Zapytanie o dane. L{wiecej <ajango.database.query>}. 
28      2. B{COLUMN} - Kolumna z danymi L{wiecej <ajango.database.columns>}. 
29      3. B{TEMPLATE} - Ustatienie pliku I{HTML} z szablonem widoku raportu. 
30          - I{src} - nazwa pliku. 
31      4. B{LIST} - Ustawienie trybu listy 
32          - I{value} - I{True} jesli tryb listy ma byc wlaczony lub I{False} wpw. 
33   
34  Generowany obiekt 
35  ================= 
36   
37  L{ajango.site.sites.raport} 
38  """ 
39   
40  from django.core.management.base    import CommandError 
41  from ajango.generator.views.list import View as List 
42   
43 -class View(List):
44 """ Klasa widoku wyswietlajacego raport. """
45 - def __init__(self, xmldoc, importRenderer, app):
46 self.add_permited(["TEMPLATE", "LIST"]) 47 self.template_src = "" 48 self.list_mode = False 49 List.__init__(self, xmldoc, importRenderer, app)
50 - def init(self):
51 """ Metoda inicjalizujaca. """ 52 List.init(self) 53 self.type = "raport"
54 - def check(self, name, xmldoc_elem):
55 """ Oczytanie nodow wewnetrznych. """ 56 if List.check(self, name, xmldoc_elem): 57 return True 58 if name.upper() == "TEMPLATE": 59 self.template_src = xmldoc_elem.getAttribute("src") 60 return True 61 if name.upper() == "LIST": 62 value = xmldoc_elem.getAttribute("value") 63 if value.upper() == "FALSE": 64 self.list_mode = False 65 elif value.upper() == "TRUE": 66 self.list_mode = True 67 else: 68 raise CommandError("List node cannot have %r value" % value) 69 return True 70 return False
71 - def execute(self, view, view_name="view"):
72 """ Wykonanie zadan obiektu. """ 73 self.add_line("%s.set_template(%r)" % (view_name, self.template_src)) 74 value = "False" 75 if self.list_mode: 76 value = "True" 77 self.add_line("%s.set_list_mode(%s)" % (view_name, value)) 78 List.execute(self, view, view_name)
79 - def is_display_in_menu(self):
80 """ Informacja na temat widocznosci w menu glownym aplikacji. """ 81 return self.list_mode
82