mpachas/django-monthfield

NameError: name 'basestring' is not defined

rafammpp opened this issue · 2 comments

/month/__init__.py  in __eq__ line: 55
    def __eq__(self, x):
        if isinstance(x, Month):
            return x.month == self.month and x.year == self.year
        if isinstance(x, datetime.date):
            return self.year == x.year and self.month == x.month
        if isinstance(x, int):
            return x == int(self)
        #this line
        if isinstance(x, basestring): 
            return str(self) == x[:7]
    def __gt__(self, x):
        if isinstance(x, Month):
            if self.year != x.year: return self.year > x.year
            return self.month > x.month
        if isinstance(x, datetime.date):

Al realizar una llamada en la plantilla del tipo:

{{ article.month_initial|date }}

Al editar un número sigue saliendo este error.
Incluir esto en django-monthfield/moth/__init__.py, después de import:

try:
    unicode = unicode
except NameError:
    # 'unicode' is undefined, must be Python 3
    str = str
    unicode = str
    bytes = bytes
    basestring = (str,bytes)
else:
    # 'unicode' exists, must be Python 2
    str = str
    unicode = unicode
    bytes = str
    basestring = basestring

fixed and merged in #2