auto-generated template for generic views

157 views
Skip to first unread message

Rachel Willmer

unread,
Sep 4, 2005, 1:52:34 PM9/4/05
to django...@googlegroups.com
I want to use the generic view mechanism to add/change/delete but I
don't want to have to write my own form template for each page.

I'd like it to work just like the admin interface does. Is it
possible/sensible to hook into the admin code which seems to use
add_stage/change_stage to automatically generate the templates? Or is
there a better way of doing this?

Any pointers welcome...
Rachel

Adrian Holovaty

unread,
Sep 4, 2005, 2:17:39 PM9/4/05
to django...@googlegroups.com
That's a really interesting idea. I think it'd be better to
"statically" generate the templates a single time, rather than have
Django create the templates automatically, because the former would
allow people to custom the templates' look and feel. Maybe a
"django-admin.py formtemplate app" command? What do you think?

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Carlo C8E Miron

unread,
Sep 4, 2005, 3:07:24 PM9/4/05
to django...@googlegroups.com
2005/9/4, Adrian Holovaty <holo...@gmail.com>:
> That's a really interesting idea. I think it'd be better to
> "statically" generate the templates a single time, rather than have
> Django create the templates automatically, because the former would
> allow people to custom the templates' look and feel. Maybe a
> "django-admin.py formtemplate app" command? What do you think?

A big +1 from me!

--
Carlo C8E Miron, ICQ #26429731
--
Disclaimer:
If I receive a message from you, you are agreeing that:
1. I am by definition, "the intended recipient".
2. All information in the email is mine to do with as I see fit and
make such financial profit, political mileage, or good joke as it
lends itself to. In particular, I may quote it on USENET or the WWW.
3. I may take the contents as representing the views of your company.
4. This overrides any disclaimer or statement of confidentiality that
may be included on your message.

Rachel Willmer

unread,
Sep 5, 2005, 4:56:22 AM9/5/05
to django...@googlegroups.com
> That's a really interesting idea. I think it'd be better to
> "statically" generate the templates a single time, rather than have
> Django create the templates automatically, because the former would
> allow people to custom the templates' look and feel. Maybe a
> "django-admin.py formtemplate app" command? What do you think?

The ideal would be to have both. :-)

Having an auto-generated on-the-fly template gets you up and going
faster and if you didn't actually need to do any customisation, ;
being able to statically generate the template once would be better
for later customisation...

I'd be delighted with either!

Rachel Willmer

unread,
Sep 8, 2005, 2:01:53 PM9/8/05
to django...@googlegroups.com
Following up on my original question, now I've read a bit more about
it, the answer is of course to just use the admin interface. :-)

If you run django-admin.py adminindex <app>, it will auto-generate a
copy of the guts of the index page needed to display the admin
interface. You can copy that into your template directory to over-ride
the inbuilt one, as described in
<http://www.djangoproject.com/documentation/tutorial2/#customize-the-admin-look-and-feel>

Then you can modify that as you wish...

Rachel

Johan

unread,
Sep 11, 2005, 1:36:04 PM9/11/05
to Django users
Also a big +1. using django-admin.py to generate the template is not
only great for generating a standard template, but also an ideal tool
for people like me who learn best by example.

Looking forward for this feature.

Boffbowsh

unread,
Sep 14, 2005, 5:16:04 AM9/14/05
to Django users
It's there already Johan, it's not something to look forward to

Andreas

unread,
Sep 14, 2005, 10:12:25 AM9/14/05
to Django users
Boffbowsh wrote:
> It's there already Johan

How does it work? As far as I can see it's already possible to create
an admin-like index view. Auto-generated templates for the CRUD generic
views would be extremely useful, but I don't see how you would create
them with the current Django version.

Andreas

Johan

unread,
Sep 15, 2005, 9:21:35 AM9/15/05
to Django users
Indeed for the admin index it's there. But using django-admin.py there
is no option. Or must I use something else?

Reply all
Reply to author
Forward
0 new messages