| Home | Trees | Indices | Help |
|---|
|
|
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 Modul strony wprowadzajacej dane.
21
22 Obiekt obsluguje strone umozliwiajaca wprowadzenie nowych danych.
23
24 Obiekt Generujacy
25 =================
26
27 L{ajango.generator.views.input}
28 """
29
30 from __future__ import print_function
31 from ajango.site.sites import SiteBase
32 from ajango.database.inputs import input_factory
33 from ajango.database.inputs import InputManager
34 from ajango.database.query import DataCreate
35
37 """ Klasa strony wprowadzania danych. """
39 self.inputs = InputManager()
40 self.table = ""
41 self.models = None
42 SiteBase.__init__(self, ob)
56 """ Sprawdzenie czy dostepne sa dane dla obecnego widoku. """
57 try:
58 return (self.request.method == 'POST' and
59 self.request.POST['view_id'] == ("view_%d" % self.view_id))
60 except KeyError:
61 return False
63 """ Wprowadzenie informacji do bazy danych. """
64 data = DataCreate(self.table)
65 data.set_models(self.models)
66 data.create_from_post(post)
67 data.save()
69 """ Buduje dane dla strony. """
70 data = []
71 self.data['result'] = True
72 if self._is_form_available():
73 if self.inputs.is_valid(self.request.POST):
74 self.send_data(self.request.POST)
75 self.inputs.set_data(self.request.POST)
76 for elem in self.inputs.get_inputs():
77 data.append(elem.get_data())
78 self.data['tabledata'] = data
79
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Thu Oct 20 21:01:52 2016 | http://epydoc.sourceforge.net |