# AttributeError: type object 'Profile' has no attribute 'objects'

**URL:** <https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449>\
**Category:** Mystery Errors\
**Created:** [September 3, 2024, 2:18am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449 "2024-09-03T02:18:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 3, 2024, 2:18am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/1 "2024-09-03T02:18:36Z")

</div>

```auto
\Desktop\JMS> py manage.py createsuperuser
Email: emmasasu1670@gmail.com
Username: Emmanuel
Password: 
Password (again): 
Traceback (most recent call last):
  File "C:\Users\Emmanuel_coder\Desktop\JMS\manage.py", line 22, in <module>
    main()
  File "C:\Users\Emmanuel_coder\Desktop\JMS\manage.py", line 18, in main   
    execute_from_command_line(sys.argv)
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\ __init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\ __init__.py", line 436, in execute   
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\base.py", line 413, in run_from_argv 
    self.execute(*args, **cmd_options)
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 90, in execute     
    return super().execute(*args, **options)      
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^      
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\base.py", line 459, in execute       
    output = self.handle(*args, **options)        
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\contrib\auth\management\commands\createsuperuser.py", line 239, in handle     
    self.UserModel._default_manager.db_manager(database).create_superuser( 
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\contrib\auth\models.py", line 173, in create_superuser
    return self._create_user(username, email, password, **extra_fields)    
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^    
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\contrib\auth\models.py", line 156, in _create_user   
    user.save(using=self._db)
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\contrib\auth\base_user.py", line 62, in save
    super().save(*args, **kwargs)
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\models\base.py", line 891, in save
    self.save_base(
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\models\base.py", line 1012, in save_base
    post_save.send(      
  File "C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\dispatch\dispatcher.py", line 189, in send
    response = receiver(signal=self, sender=sender, **named)
ths\models.py", line 78, in create_user_profile
    Profile.objects.createths\models.py", line 78, in create_user_profile     
    Profile.objects.create(user=instance)
    ^^^^^^^^^^^^^^^       
AttributeError: type object 'Profile' has no attribute 'objects'

```

---

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 3, 2024, 2:19am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/2 "2024-09-03T02:19:22Z")

</div>

why is this happening

---

<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 3, 2024, 2:26am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/3 "2024-09-03T02:26:25Z")

</div>

Please post the complete view causing this message (`create_user_profile`) and the complete definition of your `Profile` model.

Also, when posting code, templates, error messages or other preformatted text here, enclose it between lines of three backtick - ` characters. This means you’ll have a line of ```, then the code, then another line of ```. (This forces the forum software to keep your code properly formatted.) I’ve taken the liberty of editing your original post for this.

---

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 4, 2024, 2:16am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/4 "2024-09-04T02:16:29Z")

</div>

from django.contrib import admin  
from userauths.models import User, Profile

class UserAdmin(admin.ModelAdmin):  
search\_fields = [‘full\_name’, ‘username’,]  
list\_display = [‘username’, ‘full\_name’, ‘email’, ‘phone’, ‘gender’,]

class ProfileAdmin(admin.ModelAdmin):  
search\_fields = [‘full\_name’, ‘user\_username’,]  
list\_display = [‘username’, ‘user’, ‘verified’,]

admin.site.register(User, UserAdmin)  
admin.site.register(Profile, ProfileAdmin)

---

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 4, 2024, 2:17am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/5 "2024-09-04T02:17:37Z")

</div>

that is the models.py

---

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 4, 2024, 2:19am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/6 "2024-09-04T02:19:51Z")

</div>

PS C:\Users\Emmanuel\_coder\Desktop\JMS\> py manage.py runserver  
Watching for file changes with StatReloader  
Exception in thread django-main-thread:  
Traceback (most recent call last):  
File “C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\threading.py”, line 1075, in \_bootstrap\_inner  
self.run()  
File “C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\threading.py”, line 1012, in run  
self._target(\*self.args, \*\*self.kwargs)  
File “C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\autoreload.py”, line 64, in wrapper  
fn(\*args, \*\*kwargs)  
File “C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\commands\runserver.py”, line 126, in inner\_run  
autoreload.raise\_last\_exception()  
File “C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\autoreload.py”, line 87, in raise\_last\_exception  
raise exception[1]  
File "C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\_init.py", line 394, in execute  
autoreload.check\_errors(django.setup)()  
File “C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\autoreload.py”, line 64, in wrapper  
fn(\*args, \*\*kwargs)  
File "C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\_init.py", line 24, in setup  
apps.populate(settings.INSTALLED\_APPS)  
File “C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\apps\registry.py”, line 124, in populate  
app\_config.ready()  
File “C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\contrib\admin\apps.py”, line 27, in ready  
self.module.autodiscover()  
File "C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\contrib\admin\_init.py", line 52, in autodiscover  
autodiscover\_modules(“admin”, register\_to=site)  
File “C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\utils\module\_loading.py”, line 58, in autodiscover\_modules  
import\_module(“%s.%s” % (app\_config.name, module\_to\_search))  
File "C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\importlib\_init_.py", line 90, in import\_module  
return \_bootstrap.\_gcd\_import(name[level:], package, level)  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “”, line 1387, in \_gcd\_import  
File “”, line 1360, in \_find\_and\_load  
File “”, line 1331, in \_find\_and\_load\_unlocked  
File “”, line 935, in \_load\_unlocked  
File “”, line 995, in exec\_module  
File “”, line 488, in \_call\_with\_frames\_removed  
File “C:\Users\Emmanuel\_coder\Desktop\JMS\userauths\admin.py”, line 14, in   
admin.site.register(Profile, ProfileAdmin)  
File “C:\Users\Emmanuel\_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\contrib\admin\sites.py”, line 110, in register  
for model in model\_or\_iterable:  
^^^^^^^^^^^^^^^^^  
TypeError: ‘type’ object is not iterable

---

<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 4, 2024, 2:20am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/7 "2024-09-04T02:20:49Z")

</div>

That looks like your admin.py, not your models.py.

And again, please use the three backticks (```) on lines before and after posting code, templates, error messages, and other preformatted text.

---

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 4, 2024, 2:22am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/8 "2024-09-04T02:22:20Z")

</div>

pls I don’t understand

---

<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 4, 2024, 2:23am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/9 "2024-09-04T02:23:02Z")

</div>

Please explain what it is that you don’t understand.

---

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 4, 2024, 2:24am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/10 "2024-09-04T02:24:13Z")

</div>

> [@KenWhitesell](#):
>
> please use the three backticks (```) on lines before and after posting code, templates, error messages, and other preformatted text.

can you explain it well to me

---

<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 4, 2024, 2:27am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/11 "2024-09-04T02:27:59Z")

</div>

When you are posting code, templates, error messages, tracebacks, or any other preformatted text, surround that text between lines of three backtick - ` characters. This means you’ll have a line of ```, then the code (or template, or error message, or traceback), then another line of ```.  
Example: The next line of this post is ```:

````plaintext
# The line above this is ```
def function():
    return None
# The line after this is ```

````

If you don’t put those lines around your code, it ends up looking like what you’ve got posted - you lose all the indentation, making the code difficult to understand.

The lines of ``` must be on lines by themselves, they must not be part of another line.

---

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 4, 2024, 2:32am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/12 "2024-09-04T02:32:38Z")

</div>

okay so please my admin,py where should i put my three bactick helps help to fix this

---

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 4, 2024, 2:33am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/13 "2024-09-04T02:33:10Z")

</div>

from cProfile import Profile  
from django.contrib import admin  
from userauths.models import User, Profile

class UserAdmin(admin.ModelAdmin):  
search\_fields = [‘full\_name’, ‘username’]  
list\_display = [‘username’, ‘full\_name’, ‘email’, ‘phone’, ‘gender’]

class ProfileAdmin(admin.ModelAdmin):  
search\_fields = [‘full\_name’, ‘user\_username’,]  
list\_display = [‘username’, ‘user’, ‘verified’,]

admin.site.register(User, UserAdmin)  
admin.site.register(Profile, ProfileAdmin)

---

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 4, 2024, 2:35am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/14 "2024-09-04T02:35:39Z")

</div>

should i send you my models.py

---

<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 4, 2024, 2:36am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/15 "2024-09-04T02:36:20Z")

</div>

You need to put ``` on the line _before_ the line `from cProfile ...` and ``` on the line _after_ the line `admin.site.register(Profile, ProfileAdmin)`

Note, when you joined the forum, you should have received a message from “Discobot” referencing a tutorial for the forum. I strongly suggest you take that tutorial to learn how to best use this forum.

---

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 4, 2024, 2:40am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/16 "2024-09-04T02:40:28Z")

</div>

okay i will learn how to use the forum thank you

---

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 4, 2024, 2:41am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/17 "2024-09-04T02:41:13Z")

</div>

‘’'from cProfile import Profile  
from django.contrib import admin  
from userauths.models import User, Profile

class UserAdmin(admin.ModelAdmin):  
search\_fields = [‘full\_name’, ‘username’]  
list\_display = [‘username’, ‘full\_name’, ‘email’, ‘phone’, ‘gender’]

class ProfileAdmin(admin.ModelAdmin):  
search\_fields = [‘full\_name’, ‘user\_username’]  
list\_display = [‘username’, ‘user’, ‘verified’]

admin.site.register(User, UserAdmin)  
admin.site.register(Profile, ProfileAdmin)‘’’

---

<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 4, 2024, 2:43am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/18 "2024-09-04T02:43:10Z")

</div>

Please see my reply at [AttributeError: type object 'Profile' has no attribute 'objects' - #7 by KenWhitesell](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/7) and at [AttributeError: type object 'Profile' has no attribute 'objects' - #11 by KenWhitesell](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/11)

---

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 4, 2024, 2:44am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/19 "2024-09-04T02:44:57Z")

</div>

yes seen that it works let me create my superuser and see if it will also works

---

<div class="post-metadata">

**Author:** ![Himselv123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himselv123/32/23557_2.png) [@Himselv123](https://forum.djangoproject.com/u/Himselv123)\
**Post date:** [September 4, 2024, 2:51am UTC](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449/20 "2024-09-04T02:51:34Z")

</div>

still not working

AttributeError: type object ‘Profile’ has no attribute ‘objects’

[Next page](https://forum.djangoproject.com/t/attributeerror-type-object-profile-has-no-attribute-objects/34449.md?page=2)
