# Please help. How can I get the name/string representation of the objects in my admin. I am seeing object (1), object (2)

**URL:** <https://forum.djangoproject.com/t/please-help-how-can-i-get-the-name-string-representation-of-the-objects-in-my-admin-i-am-seeing-object-1-object-2/35211>\
**Category:** Getting Started\
**Created:** [September 29, 2024, 12:14am UTC](https://forum.djangoproject.com/t/please-help-how-can-i-get-the-name-string-representation-of-the-objects-in-my-admin-i-am-seeing-object-1-object-2/35211 "2024-09-29T00:14:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZacAmata](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/zacamata/32/21766_2.png) [@ZacAmata](https://forum.djangoproject.com/u/ZacAmata)\
**Post date:** [September 29, 2024, 12:14am UTC](https://forum.djangoproject.com/t/please-help-how-can-i-get-the-name-string-representation-of-the-objects-in-my-admin-i-am-seeing-object-1-object-2/35211/1 "2024-09-29T00:14:23Z")

</div>

I am working on the Django tutorial by W3 Schools. I have got up to where I customize the 404 page. I wanted to add images to the member details page. So I went to the tutorial by Code with Stein to see how he added images to his Item page. I have added the MEDIA\_URL, and the MEDIA\_ROOT. When I go to my dashboard I am able to upload the image. But when I try to refresh so I see the names of the objects I get a Server Error (500).  
my models.py file

```auto
from django.db import models

class Member(models.Model):
    firstname = models.CharField(max_length=255)
    lastname = models.CharField(max_length=255)
    phone = models.IntegerField(null=True)
    joined_date = models.DateField(null=True)
    image = models.ImageField(upload_to='member_images', blank=True, null=True)

    def __str__ (self):
        return self.name

```

the views.py file

```auto
# from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from .models import Member

def members(request):
    mymembers = Member.objects.all().values()
    template = loader.get_template('all_members.html')
    # template = loader.get_template('myfirst.html')
    # return HttpResponse("Hello world. Say 'Congratulations' to Zack Amata!!")
    context = {
        'mymembers': mymembers,
    }
    return HttpResponse(template.render(context, request))

def details(request, id):
    mymember = Member.objects.get(id=id)
    template = loader.get_template('details.html')
    context = {
        'mymember': mymember,
    }
    return HttpResponse(template.render(context, request))

def main(request):
    template = loader.get_template('main.html')
    return HttpResponse(template.render())

```

the static section of the settings.py file

```auto
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/

STATIC_URL = 'static/'
MEDIA_URL = 'media/'
MEDIA_ROOT = BASE_DIR / 'media'

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 29, 2024, 12:22am UTC](https://forum.djangoproject.com/t/please-help-how-can-i-get-the-name-string-representation-of-the-objects-in-my-admin-i-am-seeing-object-1-object-2/35211/2 "2024-09-29T00:22:15Z")

</div>

> [@ZacAmata](#):
>
> I am working on the Django tutorial by W3 Schools.

Please don’t. Stop immediately and move on to another source. There are too many good resources for you to be spending time using it.

I have encountered multiple issues (here and elsewhere) with people trying to learn from it and getting all sorts of mistaken ideas.

Check out the Education section of the [Awesome Django](https://github.com/wsvincent/awesome-django) page to find the best known materials.

---

<div class="post-metadata">

**Author:** ![ZacAmata](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/zacamata/32/21766_2.png) [@ZacAmata](https://forum.djangoproject.com/u/ZacAmata)\
**Post date:** [September 29, 2024, 12:25am UTC](https://forum.djangoproject.com/t/please-help-how-can-i-get-the-name-string-representation-of-the-objects-in-my-admin-i-am-seeing-object-1-object-2/35211/3 "2024-09-29T00:25:46Z")

</div>

Thank you very much. Could you please suggest a source where I could learn how to build a blog with images and the ability to comment on posts. If that is in order.

---

<div class="post-metadata">

**Author:** ![ZacAmata](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/zacamata/32/21766_2.png) [@ZacAmata](https://forum.djangoproject.com/u/ZacAmata)\
**Post date:** [September 29, 2024, 12:26am UTC](https://forum.djangoproject.com/t/please-help-how-can-i-get-the-name-string-representation-of-the-objects-in-my-admin-i-am-seeing-object-1-object-2/35211/4 "2024-09-29T00:26:47Z")

</div>

Okay will check Awesome Django

---

<div class="post-metadata">

**Author:** ![anefta](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/anefta/32/10649_2.png) [@anefta](https://forum.djangoproject.com/u/anefta)\
**Post date:** [September 29, 2024, 9:41am UTC](https://forum.djangoproject.com/t/please-help-how-can-i-get-the-name-string-representation-of-the-objects-in-my-admin-i-am-seeing-object-1-object-2/35211/5 "2024-09-29T09:41:04Z")

</div>

> [@ZacAmata](#):
>
> ```auto
> from django.db import models
> 
> class Member(models.Model):
> firstname = models.CharField(max_length=255)
> lastname = models.CharField(max_length=255)
> phone = models.IntegerField(null=True)
> joined_date = models.DateField(null=True)
> image = models.ImageField(upload_to='member_images', blank=True, null=True)
> 
> def __str__ (self):
> return self.name
> 
> ```

In your Member model, you have a ` __str__ ` method that’s trying to return `self.name`, but there’s no `name` field in your model.

```auto
from django.db import models

class Member(models.Model):
    firstname = models.CharField(max_length=255)
    lastname = models.CharField(max_length=255)
    phone = models.IntegerField(null=True)
    joined_date = models.DateField(null=True)
    image = models.ImageField(upload_to='member_images', blank=True, null=True)

    def __str__ (self):
        return f"{self.firstname} {self.lastname}"

```

---

<div class="post-metadata">

**Author:** ![ZacAmata](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/zacamata/32/21766_2.png) [@ZacAmata](https://forum.djangoproject.com/u/ZacAmata)\
**Post date:** [September 29, 2024, 5:46pm UTC](https://forum.djangoproject.com/t/please-help-how-can-i-get-the-name-string-representation-of-the-objects-in-my-admin-i-am-seeing-object-1-object-2/35211/6 "2024-09-29T17:46:51Z")

</div>

Thank you very much. I really appreciate.
