These are chat archives for caep-unb/gestorpsi

10th
Sep 2015
Carlos Coêlho
@chocoelho
Sep 10 2015 19:41
galera
hoje estarei com vocês de 18-20
:)
Carlos Coêlho
@chocoelho
Sep 10 2015 22:26
from django import forms
from django.core.exceptions import ValidationError

def set_field_html_name(cls, new_name):
    """
    This creates wrapper around the normal widget rendering, 
    allowing for a custom field name (new_name).
    """
    old_render = cls.widget.render
    def _widget_render_wrapper(name, value, attrs=None):
        return old_render(new_name, value, attrs)

    cls.widget.render = _widget_render_wrapper