This line:

   query = show.objects.filter(show_feed__contains="http://";)

selects all shows that have a feed url(?) containing "http://";. The for loop
then loops through these items and passes each one to feedparser. If you
want to view only one show you have to change this to use the show ID you're
passing in.  So maybe replacing the query line with

  s = show.objects.get(pk=show_feed)

and getting rid of the "for s in query" line might do the trick? Then you'll
get only the feed for show 1 parsed when you go to /shows/1.

  /Emil

2008/6/25 sebey <[EMAIL PROTECTED]>:

>
>
> sorry but I do not want to limit the results as I am useing a parser
> in the views.py but I want to get all of the urls and the first url
> show/1, the second url I want to give shows/2 and so on and so on
> On Jun 25, 1:48 pm, Jeff FW <[EMAIL PROTECTED]> wrote:
> > You've now passed in the variable (which you can check by throwing a
> > "print show_feed" at the top of the function), but now you actually
> > need to *do* something with it.  I'm assuming (not really knowing what
> > you want out of this) that you'd want to add an order_by clause to
> > order your podcasts (?) by *something*, then do some slicing to limit
> > the results.
> >
> > Read:
> http://www.djangoproject.com/documentation/db-api/#limiting-querysets
> >
> > -Jeff
> >
> > On Jun 25, 4:58 am, sebey <[EMAIL PROTECTED]> wrote:
> >
> > > yes i have that set up it now looks like this
> >
> > > def show_page(request,show_feed):
> > >     """this is where we take what we need form the rss feeds in the
> > > data base"""
> > >     query = show.objects.filter(show_feed__contains="http://";)
> > >     for s in query:
> > >         podcast = feedparser.parse(s.show_feed)
> > >         if  podcast.entries:
> > >             elements = {'show_about':
> > > podcast.feed.summary,'show_latest_title':
> > > podcast.entries[0].title,'show_latest': podcast.entries[0].summary}
> > >     e = elements
> > >     t = loader.get_template('shows/show_page_base.html')
> > >     return  HttpResponse(t.render(Context(e)))
> >
> > > but it still in not working so help please thank you for trying
> >
> > > On Jun 24, 3:07 pm, phillc <[EMAIL PROTECTED]> wrote:
> >
> > > > you did not readhttp://
> www.djangoproject.com/documentation/url_dispatch/
> >
> > > > your method, show_page, is now passed a parameter called show_feed.
> > > > you need to use it accordingly
> >
> > > > On Jun 24, 10:02 am, sebey <[EMAIL PROTECTED]> wrote:
> >
> > > > > either way its still the same thanks though but it still is not
> > > > > working
> >
> > > > > On Jun 24, 1:44 pm, Jeff FW <[EMAIL PROTECTED]> wrote:
> >
> > > > > > The regex you're using has a trailing /, so you need to have that
> in
> > > > > > your link as well:
> > > > > > /shows/1/
> >
> > > > > > The other option is to make the trailing slash optional like so:
> > > > > > r'^shows/(?P<show_feed>\d{1})[/]?$'
> >
> > > > > > On Jun 24, 7:09 am, sebey <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > it works but  (thanks for the tips) it still is getting the
> same feed
> > > > > > > for local/shows/1/ and local/show/2 help please
> >
> > > > > > > everyone who has helped so far thank you
> >
> > > > > > > On Jun 24, 12:06 pm, sebey <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > ok fixed that yeah i saw that after I posted but here is what
> it looks
> > > > > > > > like now
> >
> > > > > > > > from django.conf.urls.defaults import *
> >
> > > > > > > > urlpatterns = patterns('',
> > > > > > > >     # Example:
> > > > > > > >     # (r'^ubermicro/', include('ubermicro.foo.urls')),
> >
> > > > > > > >     # Uncomment this for admin:
> > > > > > > >     (r'^admin/', include('django.contrib.admin.urls')),
> > > > > > > >     #temp only fo dev proposes
> > > > > > > >     (r'^shows/(?p<show_feed>\d{1})/
> > > > > > > > $','ubermicro.shows.views.show_page')
> > > > > > > > )
> >
> > > > > > > > thanks some please
> >
> > > > > > > > On Jun 24, 11:46 am, Tye <[EMAIL PROTECTED]>
> wrote:
> >
> > > > > > > > > Why does the /shows/ etc url string end with
> >
> > > > > > > > > /s'
> >
> > > > > > > > > ?
> >
> > > > > > > > > Typo?
> >
> > > > > > > > > Sent from my iPhone
> >
> > > > > > > > > On Jun 24, 2008, at 3:23, sebey <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > > > I have gotten this traceback
> >
> > > > > > > > > > Traceback (most recent call last):
> > > > > > > > > > File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > > > > > > > > > site-packages/django/core/handlers/base.py" in
> get_response
> > > > > > > > > >  68. callback, callback_args, callback_kwargs =
> > > > > > > > > > resolver.resolve(request.path)
> > > > > > > > > > File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > > > > > > > > > site-packages/django/core/urlresolvers.py" in resolve
> > > > > > > > > >  160. for pattern in self.urlconf_module.urlpatterns:
> > > > > > > > > > File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > > > > > > > > > site-packages/django/core/urlresolvers.py" in
> _get_urlconf_module
> > > > > > > > > >  177. self._urlconf_module =
> __import__(self.urlconf_name, {}, {},
> > > > > > > > > > [''])
> > > > > > > > > > File "/Users/sebey/Sites/ubermicro/../ubermicro/urls.py"
> in
> > > > > > > > > >  10. (r'^shows/(?p<show_feed>\d{1})/
> > > > > > > > > > s','ubermicro.shows.views.show_page') # .* does not work
> > > > > > > > > > File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > > > > > > > > > site-packages/django/conf/urls/defaults.py" in patterns
> > > > > > > > > >  18. pattern_list.append(RegexURLPattern(regex, prefix
> and (prefix +
> > > > > > > > > > '.' + view_or_include) or view_or_include,
> *default_kwargs))
> > > > > > > > > > File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > > > > > > > > > site-packages/django/core/urlresolvers.py" in __init__
> > > > > > > > > >  96. self.regex = re.compile(regex)
> > > > > > > > > > File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > > > > > > > > > re.py" in compile
> > > > > > > > > >  180. return _compile(pattern, flags)
> > > > > > > > > > File
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
> > > > > > > > > > re.py" in _compile
> > > > > > > > > >  233. raise error, v # invalid expression
> >
> > > > > > > > > >  error at /shows/1/
> > > > > > > > > >  unexpected end of pattern
> >
> > > > > > > > > > here is what I have done to the urls
> >
> > > > > > > > > > from django.conf.urls.defaults import *
> >
> > > > > > > > > > urlpatterns = patterns('',
> > > > > > > > > >    # Example:
> > > > > > > > > >    # (r'^ubermicro/', include('ubermicro.foo.urls')),
> >
> > > > > > > > > >    # Uncomment this for admin:
> > > > > > > > > >    (r'^admin/', include('django.contrib.admin.urls')),
> > > > > > > > > >    #temp only fo dev proposes
> > > > > > > > > >    (r'^shows/(?p<show_feed>\d{1})/
> > > > > > > > > > s','ubermicro.shows.views.show_page') # .* does not work
> > > > > > > > > > )
> >
> > > > > > > > > > can anyone help?
> > > > > > > > > > On Jun 24, 10:34 am, sebey <[EMAIL PROTECTED]> wrote:
> > > > > > > > > >> cool thats great thanks anymore suggestions would be
> great thanks
> >
> > > > > > > > > >> On Jun 23, 7:48 pm,phillc<[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > > >>>
> http://www.djangoproject.com/documentation/url_dispatch/
> >
> > > > > > > > > >>> look at the regular expressions used in the examples,
> and the
> > > > > > > > > >>> section
> > > > > > > > > >>> "named groups"
> >
> > > > > > > > > >>> On Jun 23, 9:22 am, sebastian stephenson <
> [EMAIL PROTECTED]> wrote:
> >
> > > > > > > > > >>>> ok so I have in my data base a colium of rss feeds and
> I am
> > > > > > > > > >>>> parseing
> > > > > > > > > >>>> them via feedparser and I am having a touble getting
> one feed to
> > > > > > > > > >>>> have
> > > > > > > > > >>>> like "local/show/1" and another feed have
> "local/show/2" but how do
> > > > > > > > > >>>> you do this here is the urls.py in its current state:
> >
> > > > > > > > > >>>> from django.conf.urls.defaults import *
> >
> > > > > > > > > >>>> urlpatterns = patterns('',
> > > > > > > > > >>>>      # Example:
> > > > > > > > > >>>>      # (r'^ubermicro/',
> include('ubermicro.foo.urls')),
> >
> > > > > > > > > >>>>      # Uncomment this for admin:
> > > > > > > > > >>>>      (r'^admin/',
> include('django.contrib.admin.urls')),
> > > > > > > > > >>>>      #temp only fo dev proposes
> > > > > > > > > >>>>      (r'^shows/','ubermicro.shows.views.show_page') #
> .* does not
> > > > > > > > > >>>> work
> > > > > > > > > >>>> )
> >
> > > > > > > > > >>>> then views.py:
> >
> > > > > > > > > >>>> from django.http import HttpResponse
> > > > > > > > > >>>> import feedparser
> > > > > > > > > >>>> from ubermicro.shows.models import show
> > > > > > > > > >>>> from django.template import Context, loader
> >
> > > > > > > > > >>>> def show_page(request):
> > > > > > > > > >>>>      """this is where we take what we need form the
> rss feeds in
> > > > > > > > > >>>> the
> > > > > > > > > >>>> data base"""
> > > > > > > > > >>>>      query =
> show.objects.filter(show_feed__contains="http://";)
> > > > > > > > > >>>>      for s in query:
> > > > > > > > > >>>>          podcast = feedparser.parse(s.show_feed)
> > > > > > > > > >>>>          if  podcast.entries:
> > > > > > > > > >>>>              elements = {'show_about':
> > > > > > > > > >>>> podcast.feed.summary,'show_latest_title':
> podcast.entries
> > > > > > > > > >>>> [0].title,'show_latest': podcast.entries[0].summary}
> > > > > > > > > >>>>      e = elements
> > > > > > > > > >>>>      t =
> loader.get_template('shows/show_page_base.html')
> > > > > > > > > >>>>      return  HttpResponse(t.render(Context(e)))
> >
> > > > > > > > > >>>> just to say new to django and webdev python etc. so
> baby language
> > > > > > > > > >>>> please thank you very much in advance
> >
> > > > > > > > > >>>> Thanks
> > > > > > > > > >>>> see ya
> >
> > > > > > > > > >>>> sebey
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to