How to subclass django's generic CreateView with initial data?
问题 I'm trying to create a dialog which uses jquery's .load() function to slurp in a rendered django form. The .load function is passed the pk of the "alert" object. Also available in the class functions are things like self.request.user so I can pre-fill those fields, shown below in the Message model (models.py): class Message(models.Model): user = models.ForeignKey(User) alert = models.ForeignKey(Alert) date = models.DateTimeField() message = models.TextField() Subclassing django's CreateView