The models need to be rewritten. It might be a better idea use a DateField,
you need to not worry about having a seperate foreignkey for month and year.
Try using a slug, instead of searching based pubtitles. Check the models
documentation, it will help you.
Here are some tips, pubtitle, pubauthors can be CharField. Have an extra
field called slug, a slugfield which will be slugified from the title.
Your view is searching for an object based on id. If you want to put it up
based on title , which I wont recommend, you need to
def search_detail(request, pubtitle):
p = get_object_or_404(Publication, pubtitle=pubtitle)
return render_to_response('search_detail.html', {'publication': p})
Instead search for slug (read the docs)
def search_detail(request, slug):
p = get_object_or_404(Publication,slug =slug)
return render_to_response('search_detail.html', {'publication': p})
urls will be something like
search_detail/(?P<slug>[0-9A-Za-z-]+)/$
search_detail/my-new-story/ will give you the results you require.
Anna IMHO you need to do some more reading before you code
constructively. Just search and google there are enough examples to go
thru
On Wed, Dec 31, 2008 at 12:06 AM, Ana <[email protected]> wrote:
>
> Hello Ramdas,
>
> The model is here: http://dpaste.com/103815/
>
> The URL is here: http://dpaste.com/103816/
>
> I've got quite a mess trying to figure out how to move between
> templates. I'm having a very hard time finding practical examples of
> this stage of Django. The admin and database piece was very well
> documented and I had that part up and running in a few days.
>
> Thanks,
>
> Ana
>
> On Dec 30, 10:27 am, "Ramdas S" <[email protected]> wrote:
> > fsafety/search_detail283, this does not make sense. Your regular
> > expression in urls clearly is looking for a number. Can you dpaste the
> > models and urls.py also
> >
> > Thanks
> >
> > Ramdas
> >
> > On Tue, Dec 30, 2008 at 11:23 PM, Ana <[email protected]> wrote:
> >
> > > Hello,
> >
> > > Please see the following:
> >
> > >http://dpaste.com/103798/
> >
> > > Thank you,
> >
> > > Anna
> >
> > --
> > Ramdas S
> > +91 9342 583 065
> >
>
--
Ramdas S
+91 9342 583 065
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---