Commits

Dmitri Lebedev committed a83291f

continued development without delayed commits

Comments (0)

Files changed (1)

example/django_inline/__init__.py

+from django import forms
+
+
 def templates_list(template_name, obj, field_name):
 	long_tuple = (obj._meta.app_label, obj.__class__.__name__, field_name, template_name)
 	return [
 		'%s/%s' % (obj._meta.app_label, template_name),
 		template_name,
 	]
+
+def form_class(obj, field_name):
+	class FormClass(forms.ModelForm):
+		class Meta:
+			model = obj.__class__
+			fields = (field_name,)
+	
+		def as_inline(self):
+			"Returns this form rendered as HTML <li>s -- excluding the <ul></ul>."
+			return self._html_output(
+				normal_row = u'<span%(html_class_attr)s>%(errors)s %(field)s</span>',
+				error_row = u'<span>%s</span>',
+				row_ender = '</span>',
+				help_text_html = u' %s',
+				errors_on_separate_row = False)