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,7 +133,7 @@ class Notify(notify_base.metaclass): | ||
133 | Classe genérica de órgãos | 133 | Classe genérica de órgãos |
134 | """ | 134 | """ |
135 | def __init__(self, **args): | 135 | def __init__(self, **args): |
136 | - super(Orgao, self).__init__(**args) | 136 | + super(Notify, self).__init__(**args) |
137 | self.documentrest = notify_base.documentrest | 137 | self.documentrest = notify_base.documentrest |
138 | 138 | ||
139 | def notify_to_dict(self): | 139 | def notify_to_dict(self): |
wscacicneo/templates/notify_coleta.pt
@@ -34,18 +34,17 @@ | @@ -34,18 +34,17 @@ | ||
34 | <metal:content fill-slot="javascript"> | 34 | <metal:content fill-slot="javascript"> |
35 | <script type="text/javascript"> | 35 | <script type="text/javascript"> |
36 | $('#enviar').click(function(){ | 36 | $('#enviar').click(function(){ |
37 | - alert('asdasdasd') | ||
38 | var data = { | 37 | var data = { |
39 | 'orgao' : $('#orgao').val(), | 38 | 'orgao' : $('#orgao').val(), |
40 | 'id_coleta' : $('#id_coleta').val(), | 39 | 'id_coleta' : $('#id_coleta').val(), |
41 | 'notify' : $('#notify').val(), | 40 | 'notify' : $('#notify').val(), |
42 | - 'status' : True | ||
43 | - } | 41 | + 'status' : 'True' |
42 | + }; | ||
44 | $.ajax({ | 43 | $.ajax({ |
45 | type: "POST", | 44 | type: "POST", |
46 | url: "${request.route_url('root')}post_notify", | 45 | url: "${request.route_url('root')}post_notify", |
47 | data: data, | 46 | data: data, |
48 | - success: function(){ alert('asdasdasd') }, | 47 | + success: function(){ alert('22222222') }, |
49 | error: function(){ alert('Não foi desta vez Tente novamente mais tarde') }, | 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,6 +14,9 @@ from wscacicneo.model.orgao import Orgao | ||
14 | from wscacicneo.model.orgao import OrgaoBase | 14 | from wscacicneo.model.orgao import OrgaoBase |
15 | from wscacicneo.model.user import User | 15 | from wscacicneo.model.user import User |
16 | from wscacicneo.model.user import UserBase | 16 | from wscacicneo.model.user import UserBase |
17 | +from wscacicneo.model.notify import Notify | ||
18 | +from wscacicneo.model.notify import NotifyBase | ||
19 | + | ||
17 | from liblightbase.lbbase.struct import Base | 20 | from liblightbase.lbbase.struct import Base |
18 | from liblightbase.lbutils import conv | 21 | from liblightbase.lbutils import conv |
19 | from liblightbase.lbrest.document import DocumentREST | 22 | from liblightbase.lbrest.document import DocumentREST |
@@ -345,11 +348,6 @@ def edituser(request): | @@ -345,11 +348,6 @@ def edituser(request): | ||
345 | 'senha' : search.results[0].senha | 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 | @view_config(route_name='put_user') | 351 | @view_config(route_name='put_user') |
354 | def put_user(request): | 352 | def put_user(request): |
355 | """ | 353 | """ |
@@ -512,4 +510,15 @@ def logout(request): | @@ -512,4 +510,15 @@ def logout(request): | ||
512 | return HTTPFound(location = request.route_url('login'), | 510 | return HTTPFound(location = request.route_url('login'), |
513 | headers = headers) | 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 |