Skip to content
Permalink
Browse files

Added checks for domain expiration during checkout

  • Loading branch information...
chrismaddalena committed Oct 15, 2019
1 parent 928e3f6 commit be4e62d55c706f936be0a290d36469f038bfe9df
Showing with 12 additions and 3 deletions.
  1. +5 −0 ghostwriter/shepherd/forms.py
  2. +7 −3 ghostwriter/shepherd/templates/shepherd/domain_detail.html
@@ -6,6 +6,8 @@

from crispy_forms.helper import FormHelper

from datetime import date

from .models import (Domain, History, DomainNote, DomainServerConnection,
DomainStatus)
from .models import (StaticServer, TransientServer, ServerHistory,
@@ -81,6 +83,9 @@ def clean_domain(self):
domain = self.cleaned_data['domain']
if insert:
unavailable = DomainStatus.objects.get(domain_status='Unavailable')
expired = domain.expiration < date.today()
if expired:
raise ValidationError("This domain's registration has expired!")
if domain.domain_status == unavailable:
raise ValidationError('Someone beat you to it. This domain has '
'already been checked out!')
@@ -19,10 +19,14 @@ <h2>
<button class="dropbtn far fa-caret-square-down"></button>
<div id="myDropdown" class="dropdown-content">
<a href="{% url 'shepherd:domain_update' domain.id %}"><i class="far fa-edit"></i> Edit</a>
{% if domain.domain_status.domain_status == "Available" %}
<a href="{% url 'shepherd:checkout' domain.id %}"><i style="color: green" class="far fa-calendar-check"></i> Checkout Domain</a>
{% if domain.is_expired %}
<a href="#"><i style="color: red" class="fas fa-skull"></i> Domain Expired</a>
{% else %}
<a href="#"><i style="color: red" class="fas fa-ban"></i> Domain Unavailable</a>
{% if domain.domain_status.domain_status == "Available" %}
<a href="{% url 'shepherd:checkout' domain.id %}"><i style="color: green" class="far fa-calendar-check"></i> Checkout Domain</a>
{% else %}
<a href="#"><i style="color: red" class="fas fa-ban"></i> Domain Unavailable</a>
{% endif %}
{% endif %}
{% if domain.health_status.health_status == "Healthy" %}
<a href="{% url 'shepherd:burn' domain.id %}"><i style="color: orange" class="fas fa-fire-alt"></i> Mark Burned</a>

0 comments on commit be4e62d

Please sign in to comment.
You can’t perform that action at this time.