aamalig / django-profile

Automatically exported from code.google.com/p/django-profile
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

generic overview #44

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This is to list all custom Profile model fields in the overview.
Unfortunately, it doesn't know how to format different field types, so it
is rather ugly for dates and file fields, but works for text-oriented
fields. It can be overridden by changing userprofile/overview.html. I'm not
sure if this is better than the current behaviour. Can this be improved?

Original issue reported on code.google.com by ericd...@gmail.com on 4 Dec 2008 at 7:11

Attachments:

GoogleCodeExporter commented 8 years ago
probably a bad idea since there's no way to know how the output should be 
formatted

Original comment by ericd...@gmail.com on 4 Dec 2008 at 7:22

GoogleCodeExporter commented 8 years ago
one possibility would be to create a directory with template snippets for 
rendering
fields:
  * templates/profile/fields/field_${name}.html
  * templates/profile/fields/type_${typename}.html

these templates could be used to override default rendering of fields. an 
example
template:

field_birthday.html:
<div class="birthday">
  {{ field|date:"%B %d, %Y" }}
</div>

could override the default for date fields:
type_DateField.html:
<div class="{{ field.name }}">
  {{ field|date:"%d-%m-%y" }}
</div>

fields could be rendered by a template tag:
{% load "profile_fields" %}
{% profile_field field %}

What do you think?

Original comment by ericd...@gmail.com on 5 Dec 2008 at 12:28

GoogleCodeExporter commented 8 years ago
I like it! I have commit your initial patch to the trunk. I'm going code your 
idea of
the fields types.

Original comment by david.ru...@gmail.com on 5 Dec 2008 at 10:38