Simple input forms which show more than one row - easy/possible in django?

10 views
Skip to first unread message

Chris G

unread,
Oct 5, 2011, 10:44:23 AM10/5/11
to django...@googlegroups.com
I want to create a simple data entry form on a web page that shows all
the columns of a database across the page (there aren't many columns,
they will fit!) and a number of rows down the page.

I.e. I want a data entry form that looks like MS Access 'tabular'
format, as follows:-

Col1Row1 Col2Row1 Col3Row1 Col4Row1 Col5Row1
Col1Row2 Col2Row2 Col3Row2 Col4Row2 Col5Row2
Col1Row3 Col2Row3 Col3Row3 Col4Row3 Col5Row3
Col1Row4 Col2Row4 Col3Row4 Col4Row4 Col5Row4
Col1Row5 Col2Row5 Col3Row5 Col4Row5 Col5Row5
Col1Row6 Col2Row6 Col3Row6 Col4Row6 Col5Row6
New Data New Data New Data New Data New Data


Can django do this easily in a 'ready made' sort of way or do I have to
actually create the form and all its fields?

--
Chris Green

Brett Epps

unread,
Oct 5, 2011, 11:13:08 AM10/5/11
to django...@googlegroups.com
Hi Chris,

Once you've defined a model for your data, you can use a ModelForm [1] to
automatically generate a form for that model.

You might also want to check out the admin site [2], which displays data
in a tabular format similar to what you describe.

1. https://docs.djangoproject.com/en/dev/topics/forms/modelforms/
2. https://docs.djangoproject.com/en/dev/ref/contrib/admin/

Brett

>--
>You received this message because you are subscribed to the Google Groups
>"Django users" group.
>To post to this group, send email to django...@googlegroups.com.
>To unsubscribe from this group, send email to
>django-users...@googlegroups.com.
>For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>

Daniel Roseman

unread,
Oct 5, 2011, 11:13:48 AM10/5/11
to django...@googlegroups.com
You want model formsets:

There's a third-party package called django-datagrid which might also help, but I've no idea what it's like.
--
DR. 

Chris G

unread,
Oct 5, 2011, 12:05:54 PM10/5/11
to django...@googlegroups.com
On Wed, Oct 05, 2011 at 03:13:08PM +0000, Brett Epps wrote:
> Hi Chris,
>
> Once you've defined a model for your data, you can use a ModelForm [1] to
> automatically generate a form for that model.
>
> You might also want to check out the admin site [2], which displays data
> in a tabular format similar to what you describe.
>
Yes, I'd seen that, can I get the admin forms to work 'outside' as it
were?

Thanks, it looks as if ModelForm will do most of what I want.

--
Chris Green

Andre Terra

unread,
Oct 5, 2011, 12:32:13 PM10/5/11
to django...@googlegroups.com
I've only skimmed this thread, but I recommend django-form-utils[1] if what you want is to write nicely formatted forms with little to no headache at all.

[1] https://bitbucket.org/carljm/django-form-utils/overview


Cheers,
AT


--
Chris Green

Reply all
Reply to author
Forward
0 new messages