# Path: borme/models.py
# class Borme(m.Model):
#     """ Edicion de BORME """
#     cve = m.CharField(max_length=30, primary_key=True)
#     date = m.DateField(db_index=True)
#     url = m.URLField()
#     from_reg = m.IntegerField()
#     until_reg = m.IntegerField()
#     # province = CharField(max_length=100, choices=PROVINCES)
#     province = m.CharField(max_length=100)
#     section = m.CharField(max_length=20)
#     # pages = IntegerField()
#     anuncios = JSONField(default=list)
# 
#     @property
#     def total_anuncios(self):
#         return len(self.anuncios)
# 
#     def get_absolute_url(self):
#         return reverse('borme-borme', args=[str(self.cve)])
# 
#     def __str__(self):
#         return self.cve


from django.urls import reverse
from .models import Borme
from calendar import Calendar, January, monthrange, month_name, day_abbr
import datetime
import sys
        """
        if day == self.day:
            css_selected = 'selected'
        else:
            css_selected = ''

        if day == 0:
            return '<td class="noday">&nbsp;</td>'  # day outside month
        elif weekday in (5, 6):
            return '<td class="day %s %s">%d</td>' % (self.cssclasses[weekday], css_selected, day)
        elif self.today == datetime.date(self.year, self.month, day):
            if (self.month, day) in self.days_bormes:
                url = reverse('borme-fecha', args=['-'.join([str(self.year), str(self.month), str(day)])])
                return '<td class="day bormeday today %s"><a href="%s">%d</a></td>' % (css_selected, url, day)
            else:
                return '<td class="day nobormeday today %s">%d</td>' % (css_selected, day)
        else:
            if (self.month, day) in self.days_bormes:
                url = reverse('borme-fecha', args=['-'.join([str(self.year), str(self.month), str(day)])])
                return '<td class="day bormeday %s"><a href="%s">%d</a></td>' % (css_selected, url, day)
            else:
                return '<td class="day nobormeday %s">%d</td>' % (css_selected, day)

    def formatmonth(self, date):
        self.year = date.year
        self.month = date.month
        self.day = date.day
        self.today = datetime.date.today()

        _, lastday = monthrange(self.year, self.month)

# Path: borme/models.py
# class Borme(m.Model):
#     """ Edicion de BORME """
#     cve = m.CharField(max_length=30, primary_key=True)
#     date = m.DateField(db_index=True)
#     url = m.URLField()
#     from_reg = m.IntegerField()
#     until_reg = m.IntegerField()
#     # province = CharField(max_length=100, choices=PROVINCES)
#     province = m.CharField(max_length=100)
#     section = m.CharField(max_length=20)
#     # pages = IntegerField()
#     anuncios = JSONField(default=list)
# 
#     @property
#     def total_anuncios(self):
#         return len(self.anuncios)
# 
#     def get_absolute_url(self):
#         return reverse('borme-borme', args=[str(self.cve)])
# 
#     def __str__(self):
#         return self.cve


# Path: borme/calendar.py
from django.urls import reverse
from .models import Borme
from calendar import Calendar, January, monthrange, month_name, day_abbr
import datetime
import sys

        """
        if day == self.day:
            css_selected = 'selected'
        else:
            css_selected = ''

        if day == 0:
            return '<td class="noday">&nbsp;</td>'  # day outside month
        elif weekday in (5, 6):
            return '<td class="day %s %s">%d</td>' % (self.cssclasses[weekday], css_selected, day)
        elif self.today == datetime.date(self.year, self.month, day):
            if (self.month, day) in self.days_bormes:
                url = reverse('borme-fecha', args=['-'.join([str(self.year), str(self.month), str(day)])])
                return '<td class="day bormeday today %s"><a href="%s">%d</a></td>' % (css_selected, url, day)
            else:
                return '<td class="day nobormeday today %s">%d</td>' % (css_selected, day)
        else:
            if (self.month, day) in self.days_bormes:
                url = reverse('borme-fecha', args=['-'.join([str(self.year), str(self.month), str(day)])])
                return '<td class="day bormeday %s"><a href="%s">%d</a></td>' % (css_selected, url, day)
            else:
                return '<td class="day nobormeday %s">%d</td>' % (css_selected, day)

    def formatmonth(self, date):
        self.year = date.year
        self.month = date.month
        self.day = date.day
        self.today = datetime.date.today()

        _, lastday = monthrange(self.year, self.month)

        bormes = Borme.objects.filter(