# Path: dashboard/apps/hub/managers.py
# class StateManager(models.Manager):
#     def status_json(self):
#         return json.dumps([s.status_entry() for s in self.all()])


import datetime
from django.contrib.auth.models import User
from localflavor.us.models import PhoneNumberField
from localflavor.us.us_states import US_STATES
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
from django.db import models
from django.db.models import Q
from django.template.defaultfilters import slugify
from .managers import StateManager

    class Meta:
        ordering = ['name']


class State(models.Model):
    """Top-level window into state data

    Intended as a resource to track general state information and
    as a skeleton for admin inlines such as election data and FOIA logs

    """
    STATUS_OPTIONS = (
        ('not-started', 'Not Started'),
        ('partial', 'Partial'),
        ('up-to-date', 'Up-to-date'),
    )
    PAIN_CHOICES = (
        ('easy', 'Easy'),
        ('medium', 'Medium'),
        ('hard', 'Hard'),
        ('excruciating', 'Excruciating'),
    )
    postal = models.CharField(max_length=2, choices=US_STATES, primary_key=True)
    name = models.CharField(max_length=25, help_text="Full state name")
    metadata_status = models.CharField(max_length=20, choices=STATUS_OPTIONS, db_index=True, help_text="Status of metadata collection for state")
    note = models.TextField("Overview", blank=True)
    pain = models.CharField(max_length=15, blank=True, choices=PAIN_CHOICES, default='', help_text="Degree of difficulty for loading a state's results.")
    results_description = models.TextField(blank=True, help_text="Quality and consistency of results over time. E.g., CSV files with consistent formats for all years except 2000 and 2002")


# Path: dashboard/apps/hub/managers.py
# class StateManager(models.Manager):
#     def status_json(self):
#         return json.dumps([s.status_entry() for s in self.all()])


# Path: dashboard/apps/hub/models.py
import datetime
from django.contrib.auth.models import User
from localflavor.us.models import PhoneNumberField
from localflavor.us.us_states import US_STATES
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
from django.db import models
from django.db.models import Q
from django.template.defaultfilters import slugify
from .managers import StateManager


    class Meta:
        ordering = ['name']


class State(models.Model):
    """Top-level window into state data

    Intended as a resource to track general state information and
    as a skeleton for admin inlines such as election data and FOIA logs

    """
    STATUS_OPTIONS = (
        ('not-started', 'Not Started'),
        ('partial', 'Partial'),
        ('up-to-date', 'Up-to-date'),
    )
    PAIN_CHOICES = (
        ('easy', 'Easy'),
        ('medium', 'Medium'),
        ('hard', 'Hard'),
        ('excruciating', 'Excruciating'),
    )
    postal = models.CharField(max_length=2, choices=US_STATES, primary_key=True)
    name = models.CharField(max_length=25, help_text="Full state name")
    metadata_status = models.CharField(max_length=20, choices=STATUS_OPTIONS, db_index=True, help_text="Status of metadata collection for state")
    note = models.TextField("Overview", blank=True)
    pain = models.CharField(max_length=15, blank=True, choices=PAIN_CHOICES, default='', help_text="Degree of difficulty for loading a state's results.")
    results_description = models.TextField(blank=True, help_text="Quality and consistency of results over time. E.g., CSV files with consistent formats for all years except 2000 and 2002")


    objects = StateManager()