Christian Joergensen wrote:
> Carl Karsten wrote:
>> nicely formated template code generates lots of CRs in the resulting html.  
>> I am 
>> trying to figure out how to make the html a bit easier to read.
>>
>> for instance, how can I make this:
>>
>> <td{% if not day.in_month %} class="cal_not_in_month"{% endif %}
>> {% ifequal day.day day.today %} class="today"{% endifequal %}>
>>
>> Not put the CR inside the <td> ?
>>
>> I realize i may be asking for magic, but I am thinking maybe something like 
>> skip 
>> the CR for lines ending with %}
> 
> I used something like this once. However, you should think twice before
> adding it on a busy site.

This is just for development.  Once it goes into production I don't care what 
the html looks like as much.

> 
> from BeautifulSoup import BeautifulSoup
> 
> class BeautifulSoupPrettifyMiddleware(object):
> 
>     def process_response(self, request, response):
> 
>         if 'text/html' in response['Content-Type']:
> 
>             soup = BeautifulSoup(response.content)
>             response.content = soup.prettify()
> 
>         return response
> 

This will help. Where do I put that code?

Carl K

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to