this.window.gBrowserInit is undefined ext-browser.js:1134
    get activeTab chrome://browser/content/parent/ext-browser.js:1134
    candidates chrome://extensions/content/parent/ext-tabs-base.js:2091
    next self-hosted:1743
    query chrome://extensions/content/parent/ext-tabs-base.js:2113
    next self-hosted:1743
    from self-hosted:516
    query chrome://browser/content/parent/ext-tabs.js:1000
    query self-hosted:1359
    result resource://gre/modules/ExtensionParent.jsm:1156
    withCallContextData resource://gre/modules/ExtensionParent.jsm:639
    result resource://gre/modules/ExtensionParent.jsm:1155
    withPendingBrowser resource://gre/modules/ExtensionParent.jsm:649
    result resource://gre/modules/ExtensionParent.jsm:1154
    callAndLog resource://gre/modules/ExtensionParent.jsm:1107
    recvAPICall resource://gre/modules/ExtensionParent.jsm:1153
    AsyncFunctionNext self-hosted:810


On Tuesday, March 7, 2023 at 1:58:12 PM UTC-8 Red Plant wrote:

> What's showing on the browser console?
>
> If you're using chrome, press F12 to open developer tools, then find the 
> console tab.
>
> On Wed, Mar 8, 2023, 1:31 AM Michael Starr <starr...@gmail.com> wrote:
>
>> Well, my privilege of posting "" on SO was revoked so I can't get my 
>> questions answered anymore. So I guess I just won't be a developer now. Or 
>> the alternative, reinvent all code and the internet.
>> The answer the dude gave me wasn't sufficient and he was like, "Accept 
>> the answer!" Devious prick. And then he was like "share your code with me!" 
>> And what he does is copy your code into his github account and claim he 
>> "helped" you.
>> Blah. What a loser.
>> So anyway, it still shows img alt text BUT now when I upload a photo into 
>> the pet_photo object, it appends a six digit ASCII text thingy to the 
>> filename, so the filename isn't actually correct even, anymore.
>> So many problems. Django is NOT the api for perfectionists with deadlines.
>> Mike
>>
>> On Saturday, March 4, 2023 at 3:31:30 PM UTC-8 Michael Starr wrote:
>>
>>> Thank you Sandip. I missed that.
>>>
>>> In any case I have revamped the code with some help from stack overflow 
>>> here 
>>> https://stackoverflow.com/questions/75632266/displaying-an-image-stored-in-a-django-database
>>> However the image alt text instead of the image displays! So weird! 
>>>
>>> class PetOwnerDetailView(DetailView):
>>>     model = PetOwner
>>>     context_object_name = "owner"
>>>     template_name = "pet_owner_profile.html"
>>>     def get_context_data(self, *args, **kwargs):
>>>         context = super().get_context_data(**kwargs)
>>>         pets = Pet.objects.all()
>>>         pet_data = {}
>>>         for pet in pets:
>>>             pet_data[pet] = PetPhoto.objects.filter(pets=pet)
>>>         context['pet_data'] = pet_data
>>>         return context
>>>
>>> {% extends "base.html" %}
>>> {% block header %}
>>> {% endblock %}
>>> {% block content %}
>>>     {{ owner.name }}
>>>     {{ owner.age }}
>>>     {{ owner.location }}
>>>     {{ owner.profile_photo }}
>>>     {% for pet in owner.pets.all %}
>>>         {{ pet.name }}
>>>         {{ pet.animaltype }}
>>>         {{ pet.age }}
>>>         <!-- context['pet_photos'] = {pet1: [photo1, photo2, photo3], 
>>> pet2: [photo1, photo2]} -->
>>>         <h1>{{ pet.name }} Photos</h1>
>>>         {% for pet, photos in pet_data.items %}
>>>             <h2>{{ pet.name }}</h2>
>>>             {% for photo in photos %}
>>>                 <img src="{{ photo.photo.url }}" alt="{{ photo.title }}"
>>> >
>>>             {% endfor %}
>>>         {% endfor %}
>>>     {% endfor %}
>>> {% endblock %}
>>>
>>> [image: Screenshot 2023-03-04 153038.png]
>>>
>>> So close yet so far! Argh! lol
>>>
>>> Mike
>>>
>>> On Saturday, March 4, 2023 at 1:37:26 AM UTC-8 Sandip Bhattacharya wrote:
>>>
>>>> Are you sure this is the right query? This is looking for pet owners 
>>>> with the name “pets”. 
>>>>
>>>> pets = PetOwner.objects.filter(name = "pets”) 
>>>>
>>>> Perhaps, you mean: 
>>>> pets = PetOwner.pets.all() 
>>>>
>>>> - Sandip 
>>>>
>>>> > On Mar 3, 2023, at 8:08 PM, Michael Starr <starr...@gmail.com> 
>>>> wrote: 
>>>> > 
>>>> > I think this solution 
>>>> > 
>>>> https://stackoverflow.com/questions/75632266/displaying-an-image-stored-in-a-django-database
>>>>  
>>>> > should work but for some reason python got messed up on my laptop 
>>>> when I went mobile at the coffee shop. The PYTHONPATH got deleted the 
>>>> .venv 
>>>> environment was deleted but still displayed and I'm getting a ton of 
>>>> system 
>>>> bugs trying to run python makemigrations or python migrate. 
>>>> > 
>>>> > Frustrating. I am using the python repair tool in the python 
>>>> installer to repair python. Will let you know if the solution works after 
>>>> I 
>>>> get my environment back up and workin.g 
>>>> > On Friday, March 3, 2023 at 2:01:03 PM UTC-8 Michael Starr wrote: 
>>>> > It's not working. 
>>>> > class PetOwnerDetailView(DetailView): 
>>>> > model = PetOwner 
>>>> > context_object_name = "owner" 
>>>> > template_name = "pet_owner_profile.html" 
>>>> > def get_context_data(self, *args, **kwargs): 
>>>> > context = super().get_context_data(**kwargs) 
>>>> > context['pet_photos'] = {} 
>>>> > pets = PetOwner.objects.filter(name = "pets") 
>>>> > for pet in pets: 
>>>> > context['pet_photos'][pet] = [] 
>>>> > for photo in pet.pet_photos: 
>>>> > context['pet_photos'][pet] += photo 
>>>> > # context['pet_photos'] = {pet1: [photo1, photo2, photo3], pet2: 
>>>> [photo1, photo2]} 
>>>> > return context 
>>>> > 
>>>> > {% extends "base.html" %} 
>>>> > {% block header %} 
>>>> > {% endblock %} 
>>>> > {% block content %} 
>>>> > {{ owner.name }} 
>>>> > {{ owner.age }} 
>>>> > {{ owner.location }} 
>>>> > {{ owner.profile_photo }} 
>>>> > {% for pet in owner.pets.all %} 
>>>> > {{ pet.name }} 
>>>> > {{ pet.animaltype }} 
>>>> > {{ pet.age }} 
>>>> > <!-- context['pet_photos'] = {pet1: [photo1, photo2, photo3], pet2: 
>>>> [photo1, photo2]} --> 
>>>> > {% for photo in pet_photos.pet.photos %} 
>>>> > <img src = "{{ photo.photo.url }}"> 
>>>> > {% endfor %} 
>>>> > {% endfor %} 
>>>> > {% endblock %} 
>>>> > 
>>>> > 
>>>> > Nothing shows up. I've tried a million and a half ways to iterate 
>>>> over the data structure I've created to store pets as keys and photos in a 
>>>> list as values in get_context_data for 'pet_photos' but nothing ever 
>>>> displays. 
>>>> > 
>>>> > Then there's the question of like, are my directory structure and 
>>>> settings file correct. 
>>>> > 
>>>> > STATIC_URL = '/static/' 
>>>> > STATIC_ROOT = os.path.join(BASE_DIR, 'static/') 
>>>> > 
>>>> > pet_memorial/static/ is the file path. I don't know if that's right 
>>>> or it needs to be in the project sub-directory. It's impossible to figure 
>>>> this out online. No one explains these simple simple things CLEARLY. 
>>>> > 
>>>> > So frustrating. 
>>>> > 
>>>> > Michael 
>>>> > 
>>>> > 
>>>> > 
>>>> > 
>>>> > -- 
>>>> > 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...@googlegroups.com. 
>>>> > To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/django-users/9754727b-7cab-43b1-99ef-923d3f1fc2b2n%40googlegroups.com.
>>>>  
>>>>
>>>>
>>>>
>>>> -- 
>> 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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/03fe9089-eaed-4ba3-bb46-d7eea03acb15n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/03fe9089-eaed-4ba3-bb46-d7eea03acb15n%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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/428c2054-1da7-4d02-bccd-8093bd227939n%40googlegroups.com.

Reply via email to