No reply yet, so bump.

On Friday, December 16, 2022 at 5:51:14 PM UTC-8 Michael Starr wrote:

> I hope someone is still subscribed to this post. I had another question...
>
> I looked up your link, about context dictionary, presumably to modify the 
> value returned by the function, like you said, to add the pets to it. I 
> don't know what to loop or iterate over to get all the pets, first off. I 
> know how to add them, I think, that would just be context[pet id or 
> something] = <pet object instance>. Secondly, I'm assuming this function, 
> get_context_data, goes in the models file. I understand how to retrieve 
> context from the dictionary, you explained that as well as the professor in 
> the course I took on Django, so no problems there (so far).
>
> I think that's it, actually.
>
> Thanks in advance, hugely appreciate any help anyone can offer.
>
> Best,
> Mike
>
> On Thursday, December 15, 2022 at 2:54:59 PM UTC-8 Michael Starr wrote:
>
>> Sorry for that crass, asinine comment. I had a flare up of my condition.
>> Thank you all for the help.
>> Mike
>>
>> On Sunday, December 11, 2022 at 4:32:04 PM UTC-8 Michael Starr wrote:
>>
>>> It's poorly written and mine isn't. Am I better than them.
>>
>>
>>>
>>> On Monday, December 5, 2022 at 6:36:30 AM UTC-8 [email protected] 
>>> wrote:
>>>
>>>> Good !😁
>>>>
>>>> Le dim. 4 déc. 2022 à 22:04, Michael Starr <[email protected]> a 
>>>> écrit :
>>>>
>>>>> Thank you, Peter. I forgot to acknowledge your contribution.
>>>>>
>>>>> On Wednesday, November 30, 2022 at 4:43:47 PM UTC-8 Ryan Nowakowski 
>>>>> wrote:
>>>>>
>>>>>> On Wed, Nov 30, 2022 at 09:16:39AM -0800, Michael Starr wrote: 
>>>>>> > Thank you. Though, that hard codes everything, which is bad. How do 
>>>>>> I 
>>>>>> > generalize it? 
>>>>>>
>>>>>> You'll need to do 2 things: 
>>>>>>
>>>>>> 1. Add the pet(s) you want to the template context, probably by 
>>>>>> implementing get_context_data[1]. 
>>>>>>
>>>>>> 2. Change your template to use the pet from the template context 
>>>>>> instead of the hard code pet, Mocha. Assuming your pet in the template 
>>>>>> context is named 'pet': 
>>>>>>
>>>>>> <a href="{% url 'pet_details' slug=pet.slug %}">Pet Profile: {{ 
>>>>>> pet.name }}</a> 
>>>>>>
>>>>>> ...alternatively since you've implemented get_absolute_url: 
>>>>>>
>>>>>> <a href="{{ pet.get_absolute_url }}">Pet Profile: {{ pet.name }}</a> 
>>>>>>
>>>>>>
>>>>>> [1] 
>>>>>> https://docs.djangoproject.com/en/4.1/ref/class-based-views/mixins-simple/#django.views.generic.base.ContextMixin.get_context_data
>>>>>>  
>>>>>>
>>>>> -- 
>>>>> 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 [email protected].
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/django-users/e8afb697-d067-4cc6-bda8-93dd9b8748een%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/django-users/e8afb697-d067-4cc6-bda8-93dd9b8748een%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0876cdf6-9e88-4336-9254-52aac5738c34n%40googlegroups.com.

Reply via email to