Skip to content

Commit

Permalink
Merge pull request #76 from fuegoaustral/fix/disable-transfer-button
Browse files Browse the repository at this point in the history
Fix disable transfer button
  • Loading branch information
guillermodoghel authored Nov 2, 2024
2 parents 941fc1c + f426d54 commit 559e9f4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions tickets/views/new_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
from django.core.exceptions import ValidationError
from django.core.validators import EmailValidator
from django.db import transaction
from django.http import HttpResponseNotAllowed, HttpResponseForbidden, HttpResponse, HttpResponseBadRequest, \
JsonResponse
from django.shortcuts import redirect
from django.urls import reverse
from django.utils import timezone

from tickets.models import NewTicket, NewTicketTransfer
from django.http import HttpResponseNotAllowed, HttpResponseForbidden, HttpResponse, HttpResponseBadRequest, \
JsonResponse
from utils.email import send_mail


Expand Down Expand Up @@ -172,6 +173,9 @@ def unassign_ticket(request, ticket_key):
if not ticket.event.transfer_period():
return HttpResponseBadRequest('')

if not ticket.event.transfers_enabled_until < timezone.now():
return HttpResponseBadRequest('')

ticket.volunteer_ranger = None
ticket.volunteer_transmutator = None
ticket.volunteer_umpalumpa = None
Expand Down
6 changes: 3 additions & 3 deletions user_profile/templates/mi_fuego/my_tickets/my_ticket.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% extends 'mi_fuego/my_tickets/index.html' %}
{% load static %}
{% block actions %}
{% if my_ticket %}
<button class="btn btn-secondary" id="unAssignTicket">Transferir mi bono</button>
{% endif %}
{% if my_ticket and event.transfers_enabled_until >= now %}
<button class="btn btn-secondary" id="unAssignTicket">Transferir mi bono</button>
{% endif %}
<a class="btn btn-primary" href="{% url "select_tickets"%}">Comprar Bonos</a>
{% endblock actions %}
{% block truecontent %}
Expand Down
4 changes: 3 additions & 1 deletion user_profile/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
from django.http import Http404
from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse
from django.utils import timezone

from events.models import Event
from .forms import ProfileStep1Form, ProfileStep2Form, VolunteeringForm
from tickets.models import NewTicket, NewTicketTransfer
from .forms import ProfileStep1Form, ProfileStep2Form, VolunteeringForm


@login_required
Expand All @@ -30,6 +31,7 @@ def my_ticket_view(request):
"event": event,
"nav_primary": "tickets",
"nav_secondary": "my_ticket",
'now': timezone.now(),
},
)

Expand Down

0 comments on commit 559e9f4

Please sign in to comment.