# Path: cavedb/middleware.py
# def get_request_uri():
#     return getattr(THREAD_LOCALS, 'request_uri', None)
# 
# def get_valid_bulletins():
#     return getattr(THREAD_LOCALS, 'valid_bulletins', [])


import os
import re
import time
import cavedb.docgen_all
import cavedb.perms
import cavedb.utils
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from cavedb.middleware import get_request_uri, get_valid_bulletins
class StatewideDoc(models.Model):
    doc_type = models.ForeignKey(StatewideDocType, verbose_name='Type')
    doc = models.FileField(upload_to=statewide_doc_upload_to)
    author = models.CharField(max_length=255, null=True, blank=True)
    title = models.CharField(max_length=255, null=True, blank=True)
    volume = models.IntegerField(null=True, blank=True)
    number = models.IntegerField(null=True, blank=True)
    pages = models.IntegerField(null=True, blank=True)
    url = models.CharField(max_length=255, null=True, blank=True)
    date = models.CharField(max_length=255, null=True, blank=True)
    extra = models.CharField(max_length=255, null=True, blank=True)

    create_date = models.DateTimeField("Creation Date", auto_now_add=True, editable=False, \
                                       null=True)
    mod_date = models.DateTimeField("Modification Date", auto_now=True, editable=False, null=True)

    def __str__(self):
        #pylint: disable=no-member
        return self.doc.path

    class Meta:
        ordering = ('doc_type', 'volume', 'number', 'date', )
        verbose_name = 'Statewide Document'


class County(models.Model):
    county_name = models.CharField(max_length=80, unique=True)
    survey_short_name = models.CharField(max_length=80, unique=True, null=True, blank=True)

    create_date = models.DateTimeField("Creation Date", auto_now_add=True, editable=False, \

# Path: cavedb/middleware.py
# def get_request_uri():
#     return getattr(THREAD_LOCALS, 'request_uri', None)
# 
# def get_valid_bulletins():
#     return getattr(THREAD_LOCALS, 'valid_bulletins', [])


# Path: cavedb/models.py
import os
import re
import time
import cavedb.docgen_all
import cavedb.perms
import cavedb.utils
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from cavedb.middleware import get_request_uri, get_valid_bulletins

class StatewideDoc(models.Model):
    doc_type = models.ForeignKey(StatewideDocType, verbose_name='Type')
    doc = models.FileField(upload_to=statewide_doc_upload_to)
    author = models.CharField(max_length=255, null=True, blank=True)
    title = models.CharField(max_length=255, null=True, blank=True)
    volume = models.IntegerField(null=True, blank=True)
    number = models.IntegerField(null=True, blank=True)
    pages = models.IntegerField(null=True, blank=True)
    url = models.CharField(max_length=255, null=True, blank=True)
    date = models.CharField(max_length=255, null=True, blank=True)
    extra = models.CharField(max_length=255, null=True, blank=True)

    create_date = models.DateTimeField("Creation Date", auto_now_add=True, editable=False, \
                                       null=True)
    mod_date = models.DateTimeField("Modification Date", auto_now=True, editable=False, null=True)

    def __str__(self):
        #pylint: disable=no-member
        return self.doc.path

    class Meta:
        ordering = ('doc_type', 'volume', 'number', 'date', )
        verbose_name = 'Statewide Document'


class County(models.Model):
    county_name = models.CharField(max_length=80, unique=True)
    survey_short_name = models.CharField(max_length=80, unique=True, null=True, blank=True)

    create_date = models.DateTimeField("Creation Date", auto_now_add=True, editable=False, \

                                       null=True)