On Mon, Jan 8, 2018 at 2:51 PM, Ronnie Raney <theroni...@gmail.com> wrote:

> *You can't change the of a user from a view unless you do a redirect. You
> can issue a redirect to /post/<id> where the id is what you picked at
> random at the "random_post" view*
>
> I can't change the *what *of a user from the view? Also, what user? I've
> tried putting <id> in there and it causes errors. I've also tried <int:id>,
> <pk>, <int:pk>, <post_id>, and <int:post_id>
>
> *Is your template for a "random_obj" or for a "post" object? What does it
> expect? You can insert a "import ipdb; ipdb.set_trace()" after "context" in
> your view and inspect if it is right - it will probably be OK.*
> *Did you rename the post template to random_post and did not change the
> variables inside? If so, just use something like {"post": random_obj}.*
>
> The template is asking for the name of the url - "random_post". The
> template is loading right now at */post/random/* - confirmed by
> inspecting the page. The template expects to get the random_post view, I
> would assume. There are no errors telling me otherwise. Once again, the
> template is named random_post. So what I think you're suggesting is to
> change the contex to this:
>
> *        context = {'random_obj':random_post,}*
>
> I also tried switching these:
>
>         *context = {'random_post':random_obj,}*
>
> 'random_obj' is what was established here: *random_obj =
> Post.objects.get(post_id=random.choice(list(post_ids)))*
> 'random_post' is the name of my urlpattern, and the name of my template
> link
>
> Am I getting anywhere near understanding what you're saying? All of the
> things that I've tried are leading me to a template with blank fields.
>

Listen to Mattew's summary


> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/6e2224c1-ebbc-4f44-947b-a9115b56e4e8%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/6e2224c1-ebbc-4f44-947b-a9115b56e4e8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BFDnhJotU9bNvtL5ct1jjg2f1DMuUbmPjwT5W8Cfhpk1_VXGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to