Trying to test SelectDateWidget as SelectMonthDayWidget on command line
MRAB
python at mrabarnett.plus.com
Mon Jun 3 20:13:06 EDT 2019
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...
>
[snip]
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
strings:
> 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.
> """
[snip]
In other words, you're asking it to do:
class SelectMonthDayWidget(u'', u''):
....
More information about the Python-list
mailing list