# Path: status/models.py
# class Incident(BaseModel):
#     """ Creates an incident.  Incidents are displayed at the top of the page until closed. """
#     user = models.ForeignKey(settings.AUTH_USER_MODEL)
#     name = models.CharField(max_length=255)
#     hidden = models.BooleanField(default=False)
# 
#     def __unicode__(self):
#         return "%s - %s" % (self.user, self.name)
# 
#     def get_absolute_url(self):
#         return reverse('status:incident_detail', args=[self.pk, ])
# 
#     def get_first_update(self):
#         try:
#             first = self.incidentupdate_set.first()
#         except IncidentUpdate.DoesNotExist:
#             first = None
#         return first
# 
#     def get_latest_update(self):
#         try:
#             latest = self.incidentupdate_set.latest()
#         except IncidentUpdate.DoesNotExist:
#             latest = None
#         return latest
# 
#     class Meta:
#         get_latest_by = 'created'
#         verbose_name = 'Incident'
#         verbose_name_plural = 'Incidents'
#         ordering = ['-created', ]
# 
# class IncidentUpdate(BaseModel):
#     """ Updates about an incident. """
#     incident = models.ForeignKey(Incident)
#     user = models.ForeignKey(settings.AUTH_USER_MODEL)
#     status = models.ForeignKey(Status)
#     description = models.TextField()
# 
#     def __unicode__(self):
#         return "%s - %s: %s" % (self.user, self.status, self.description)
# 
#     def get_absolute_url(self):
#         return reverse('status:incident_detail', args=[self.incident.pk, ])
# 
#     class Meta:
#         get_latest_by = 'created'
#         verbose_name = 'Incident Update'
#         verbose_name_plural = 'Incident Updates'
#         ordering = ['created', ]
# 
#     def save(self, *args, **kwargs):
#         """ Update the parent incident update time too. """
#         self.incident.updated = timezone.now()
#         self.incident.save()
#         super(IncidentUpdate, self).save(*args, **kwargs)


from django import forms
from status.models import Incident, IncidentUpdate
from braces.forms import UserKwargModelFormMixin
import logging

logger = logging.getLogger(__name__)


class IncidentUpdateCreateForm(forms.ModelForm):
    class Meta:

# Path: status/models.py
# class Incident(BaseModel):
#     """ Creates an incident.  Incidents are displayed at the top of the page until closed. """
#     user = models.ForeignKey(settings.AUTH_USER_MODEL)
#     name = models.CharField(max_length=255)
#     hidden = models.BooleanField(default=False)
# 
#     def __unicode__(self):
#         return "%s - %s" % (self.user, self.name)
# 
#     def get_absolute_url(self):
#         return reverse('status:incident_detail', args=[self.pk, ])
# 
#     def get_first_update(self):
#         try:
#             first = self.incidentupdate_set.first()
#         except IncidentUpdate.DoesNotExist:
#             first = None
#         return first
# 
#     def get_latest_update(self):
#         try:
#             latest = self.incidentupdate_set.latest()
#         except IncidentUpdate.DoesNotExist:
#             latest = None
#         return latest
# 
#     class Meta:
#         get_latest_by = 'created'
#         verbose_name = 'Incident'
#         verbose_name_plural = 'Incidents'
#         ordering = ['-created', ]
# 
# class IncidentUpdate(BaseModel):
#     """ Updates about an incident. """
#     incident = models.ForeignKey(Incident)
#     user = models.ForeignKey(settings.AUTH_USER_MODEL)
#     status = models.ForeignKey(Status)
#     description = models.TextField()
# 
#     def __unicode__(self):
#         return "%s - %s: %s" % (self.user, self.status, self.description)
# 
#     def get_absolute_url(self):
#         return reverse('status:incident_detail', args=[self.incident.pk, ])
# 
#     class Meta:
#         get_latest_by = 'created'
#         verbose_name = 'Incident Update'
#         verbose_name_plural = 'Incident Updates'
#         ordering = ['created', ]
# 
#     def save(self, *args, **kwargs):
#         """ Update the parent incident update time too. """
#         self.incident.updated = timezone.now()
#         self.incident.save()
#         super(IncidentUpdate, self).save(*args, **kwargs)


# Path: status/forms.py
from django import forms
from status.models import Incident, IncidentUpdate
from braces.forms import UserKwargModelFormMixin
import logging


logger = logging.getLogger(__name__)


class IncidentUpdateCreateForm(forms.ModelForm):
    class Meta:

        model = IncidentUpdate