[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trying to test SelectDateWidget as SelectMonthDayWidget on command line

On 2019-06-03 20:18, eileen at themaii.org wrote:
> Hi,
> I'm a newbie and I want to change the Django SelectDateWidget to SelectMonthDayWidget because I can't use the year in my application. I had been getting another error (which I don't recall right now) on the statement that started 'html['month']' so, I decided to convert it to command line to get a better picture of what's going on.
> Unfotunately, now I get:
> Traceback (most recent call last):
>    File "SelectMDWidget.py", line 34, in <module>
>      class SelectMonthDayWidget(month,day_ok):
> TypeError: Error when calling the metaclass bases
>      unicode() argument 2 must be string, not tuple
> What am I doing wrong? I'm passing the class two strings...
You're saying that 'day_ok' and 'month' are both Unicode strings:
> day_ok = u''
> month = u''
and then trying to create a class that's a _subclass_ of those Unicode 

> class SelectMonthDayWidget(month,day_ok):
>      """
>      A Widget that splits date input into three <select> boxes.
>      This also serves as an example of a Widget that has more than one HTML
>      element and hence implements value_from_datadict.
>      """

In other words, you're asking it to do:

class SelectMonthDayWidget(u'', u''):