So much code ;-) at first I'm proposing to add some code for form.is_valid block for example : if form.is_valid(): source = Sources.objects.get(name=source) allPosts = Posts.objects.filter(PostSource=source) subreddits = SubReddits.objects.all() source = form.cleaned_data['foo'] return render_to_response('feeds.html', {'allPosts': allPosts, 'subreddits': subreddits}, context_instance=RequestContext(request)) else: print form.error
This will help to catch error with form . Also it is not correct to use this construction: class SourceSelection(forms.Form): sources = Sources.objects.all() foo = forms.ChoiceField(choices=sources) This mean that you never add any sources. or sources object are add before starting application. For dynamic loading objects in the form use form constructor. and last one point : Please separate views and form in the different files : views.py forms.py 2012/4/2 Barry Morrison <bdmorri...@gmail.com>: > Full Disclosure: I've been using Python for 5-6 months. Django for maybe 3 > > I have this: https://gist.github.com/a934fe08643e0c3ee017 > > In an effort to teach myself, I'm simply building a Django app. For teaching > purposes only. It's an aggregator of favorites across multiple sites. Right > now, I'm simply dealing with saved items from Reddit. > > The problem I'm having is the drop-down selector POST'ing and creating a the > new URL. > > http://imgur.com/a/FL32I << Screen shots > > 1) root or /feeds/ > 2) Select Reddit from drop-down > 3) Displays Reddit items only /feeds/Reddit/ > 4) Select 'Python' from drop-down, displays items from r/Python with URL > /feeds/Reddit/Python > > This works (manually entering URL's), the drop down does not. > > I currently get "Error 1" from the gist. > > On views.py, if I uncomment lines 16 - 19, and comment the lines 21 - 23, I > get a different error: "Error2" from the gist. What I don't understand > regarding the 2nd error, is that it is in fact returning: source: u'Reddit' > and that exists in the Model, so it makes me think it's expecting something > other than u'Reddit'. > > I'm at a loss, so this is me asking for help. Sorry for the long post and > crazy amounts of information. > > Any help is GREATLY APPRECIATED! > > Thanks! > > POST > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/zXNmsoqAfdMJ. > 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.