Malcolm Tredinnick gave a talk at Djangocon last year that touched on
this. He used a similar approach to Tim. Essentially he had a model
that had a DateField and a precision.

Malcolm has his slides up:
https://github.com/malcolmt/django-modeling-examples/blob/master/slides/modeling-challenges.pdf

On Jan 25, 9:16 am, "Tim Sawyer" <list.dja...@calidris.co.uk> wrote:
> Hi Karen,
>
> I did with two fields - storing a date and a date resolution.
>
> The values could be:
>
> date / resolution - display value
>
> 1984-12-31 / Exact Date - 31st December 1984
> 1984-12-01 / Month - December 1984
> 1984-01-01 / Year - 1984
>
> So I just used the first of the month where unknown, and January where
> unknown.
>
> I then had a method on the model object to return the format based on the
> stored date and the resolution.
>
> It worked for what I needed it for,
>
> Tim.
>
>
>
>
>
>
>
> > Hello,
>
> > I'm designing a model which is a collection of texts.  Some of the
> > texts will be things like books, with a YYYY date of publication, and
> > some of them will be articles or transcripts with a mmddyyy date of
> > publication/broadcast.
>
> > I'd like to structure it somehow so that when I view the list of texts
> > in the admin site, I see something like this:
>
> > Title                            Date                      ...other
> > fields
> > --------------------------------------------------------------------------- 
> > -------
> > Sample Book               1984                     ...
> > Sample Blog Post         1/14/2010             ...
>
> > Can I (should I?) store these two kinds of dates in one field?  If I
> > can't (or shouldn't), is there some other way to accomplish this
> > (that's not too complicated)?
>
> > Thanks,
> > Karen
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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

Reply via email to