Showing
1 changed file
with
3 additions
and
5 deletions
@@ -69,12 +69,10 @@ class PagoViewSets(mixins.CreateModelMixin, | @@ -69,12 +69,10 @@ class PagoViewSets(mixins.CreateModelMixin, | ||
69 | 69 | ||
70 | def perform_create(self, serializer): | 70 | def perform_create(self, serializer): |
71 | try: | 71 | try: |
72 | - edicto = Edicto.objects.get(estado='aprobado') | ||
73 | - precio_admi = Precio.objects.latest('id') | ||
74 | - precio = Precio.objects.get(id=precio_admi.id) | 72 | + edicto = Edicto.objects.get(estado='pendiente_de_pago') |
73 | + precio = Precio.objects.latest('id') | ||
75 | monto = calculadora(edicto, precio) | 74 | monto = calculadora(edicto, precio) |
76 | - usuario_actual = self.request.user | ||
77 | - if edicto.usuario != usuario_actual: | 75 | + if edicto.usuario != self.request.user: |
78 | raise UsuarioNoAutorizado | 76 | raise UsuarioNoAutorizado |
79 | serializer.validated_data['monto'] = monto | 77 | serializer.validated_data['monto'] = monto |
80 | serializer.validated_data['edicto'] = edicto | 78 | serializer.validated_data['edicto'] = edicto |
-
Please register or login to post a comment