On 07/28/06 19:20, Nagy Károly wrote:
> Steven Armstrong írta:
>
>>I've extended some of django's built in model and form fields to accept
>>an additional kwarg named 'html_attributes'.
>>
>>It works like this:
>>
>>class Whatever(models.Model):
>> ...
>> title = models.CharField(maxlength=128,
>> html_attributes={
>> 'size': 15,
>> 'class': 'myCssClass'
>> }
>> )
>> content = models.TextField(
>> html_attributes={
>> 'dojoType': 'Editor',
>> 'items': 'formatBlock;textGroup;|;justifyGroup'
>> }
>> )
>> ...
>>
>>The fields are then rendered like:
>><input type="text" id="id_title" class="vTextField required myCssClass"
>>name="title" size="15" value="" maxlength="128" />
>>
>><textarea rows="10" name="content" cols="40" class="vLargeTextField
>>required" id="id_content" dojoType="Editor"
>>items="formatBlock;textGroup;|;justifyGroup"></textarea>
>>
>>Not perfect, but works for me.
>>I could wrap it up as a patch if someone's interested.
>>
>>
> I do. Backward compatible and does not hurt nobody(?).
> That is perfect for me Steve, if you share i'll thank you.
>
> Charlie.
>
Hi Charlie
Instead of writing a patch, I've extended/wrapped djangos model and form
fields. This way you can update django without having to reapply patches.
You can find the code and instructions under [1].
Just for the record. I'm totally with Malcolm that this is not a pretty
solution and that in time there must be a better way.
[1] http://www.c-area.ch/code/django/
cheers
Steven
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---