Skip to content

Tag: django

Django form – set label

I have a form that inherits from 2 other forms. In my form, I want to change the label of a field that was defined in one of the parent forms. Does anyone know how this can be done? I’m trying to do it in my __init__, but it throws an error saying that “‘RegistrationFormTOS’ object has no attribute ’email'”.

Is there an easy way to populate SlugField from CharField?

Is there a built-in way to get the slug field to autopopulate based on the title? Perhaps in the Admin and outside of the Admin. Answer for Admin in Django 1.0 and up, you’d need to use in your Your key in the prepopulated_fields dictionary is the field you want filled, and the value is a tuple of fields

Using Django time/date widgets in custom form

How can I use the nifty JavaScript date and time widgets that the default admin uses with my custom view? I have looked through the Django forms documentation, and it briefly mentions django.contrib.admin.widgets, but I don’t know how to use it? Here is my template that I want it applied on. Also, I think it should be noted that I