Blogger Template by Blogcrowds.

Sometimes, we required to change the order of field rendering in modelform. We can override by adding "keyorder" in __init__ method.
class MyModel(ModelForm):
    def __init__(self, *args, **kwargs):
        super(MyModel, self).__init__(*args, **kwargs)
        self.fields.keyOrder = ['Field1', 'Field2','Field3', 'Field4']

def code_generator(size=6):
    chars = "abcdefghjklmnpqrstuvwxyz23456789"
    return ''.join(random.choice(chars) for x in range(size))

How to check JQuery element exist using terinary operation
$('.mydiv').length ? $('.mydiv').remove(): 0; // remove element, if already rendered

Newer Posts Older Posts Home