Commit e41fd563f3dde1c9558ab623526421b567748e67
1 parent
0e90afed
Exists in
master
cadastro de notificação
Showing
3 changed files
with
18 additions
and
10 deletions
Show diff stats
wscacicneo/model/notify.py
... | ... | @@ -133,7 +133,7 @@ class Notify(notify_base.metaclass): |
133 | 133 | Classe genérica de órgãos |
134 | 134 | """ |
135 | 135 | def __init__(self, **args): |
136 | - super(Orgao, self).__init__(**args) | |
136 | + super(Notify, self).__init__(**args) | |
137 | 137 | self.documentrest = notify_base.documentrest |
138 | 138 | |
139 | 139 | def notify_to_dict(self): | ... | ... |
wscacicneo/templates/notify_coleta.pt
... | ... | @@ -34,18 +34,17 @@ |
34 | 34 | <metal:content fill-slot="javascript"> |
35 | 35 | <script type="text/javascript"> |
36 | 36 | $('#enviar').click(function(){ |
37 | - alert('asdasdasd') | |
38 | 37 | var data = { |
39 | 38 | 'orgao' : $('#orgao').val(), |
40 | 39 | 'id_coleta' : $('#id_coleta').val(), |
41 | 40 | 'notify' : $('#notify').val(), |
42 | - 'status' : True | |
43 | - } | |
41 | + 'status' : 'True' | |
42 | + }; | |
44 | 43 | $.ajax({ |
45 | 44 | type: "POST", |
46 | 45 | url: "${request.route_url('root')}post_notify", |
47 | 46 | data: data, |
48 | - success: function(){ alert('asdasdasd') }, | |
47 | + success: function(){ alert('22222222') }, | |
49 | 48 | error: function(){ alert('Não foi desta vez Tente novamente mais tarde') }, |
50 | 49 | }); |
51 | 50 | }); | ... | ... |
wscacicneo/views.py
... | ... | @@ -14,6 +14,9 @@ from wscacicneo.model.orgao import Orgao |
14 | 14 | from wscacicneo.model.orgao import OrgaoBase |
15 | 15 | from wscacicneo.model.user import User |
16 | 16 | from wscacicneo.model.user import UserBase |
17 | +from wscacicneo.model.notify import Notify | |
18 | +from wscacicneo.model.notify import NotifyBase | |
19 | + | |
17 | 20 | from liblightbase.lbbase.struct import Base |
18 | 21 | from liblightbase.lbutils import conv |
19 | 22 | from liblightbase.lbrest.document import DocumentREST |
... | ... | @@ -345,11 +348,6 @@ def edituser(request): |
345 | 348 | 'senha' : search.results[0].senha |
346 | 349 | } |
347 | 350 | |
348 | -@view_config(route_name='post_notify') | |
349 | -def post_notify(request): | |
350 | - print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') | |
351 | - return { } | |
352 | - | |
353 | 351 | @view_config(route_name='put_user') |
354 | 352 | def put_user(request): |
355 | 353 | """ |
... | ... | @@ -512,4 +510,15 @@ def logout(request): |
512 | 510 | return HTTPFound(location = request.route_url('login'), |
513 | 511 | headers = headers) |
514 | 512 | |
513 | +@view_config(route_name='post_notify') | |
514 | +def post_notify(request): | |
515 | + requests = request.params | |
516 | + notify_obj = Notify( | |
517 | + orgao = requests['orgao'], | |
518 | + id_coleta = requests['id_coleta'], | |
519 | + notify = requests['notify'], | |
520 | + status = requests['status'] | |
521 | + ) | |
522 | + results = notify_obj.create_notify() | |
523 | + return Response(str(results)) | |
515 | 524 | ... | ... |