Wednesday, July 7, 2021

Re: ProgrammingError - relationship does not exist

If this is your personal project delete all migrations inside shops app and run makemigrations, migrate again
Not sure but this may work I had similar error some time ago

On Wed, 7 Jul 2021 at 14:19, Stathis Angelou <stakathiki@gmail.com> wrote:
Good morning Jacob and thank you for your reply, i really do appreciate your time in looking into this, I am attaching my 

models.py:
# Create your models here.
from django.contrib.gis.db import models

class Shop(models.Model):
    name = models.CharField(max_length=100)
    location = models.PointField()
    address = models.CharField(max_length=100)
    city = models.CharField(max_length=50)

and showmigrations 
admin
 [X] 0001_initial
 [X] 0002_logentry_remove_auto_add
 [X] 0003_logentry_add_action_flag_choices
auth
 [X] 0001_initial
 [X] 0002_alter_permission_name_max_length
 [X] 0003_alter_user_email_max_length
 [X] 0004_alter_user_username_opts
 [X] 0005_alter_user_last_login_null
 [X] 0006_require_contenttypes_0002
 [X] 0007_alter_validators_add_error_messages
 [X] 0008_alter_user_username_max_length
 [X] 0009_alter_user_last_name_max_length
 [X] 0010_alter_group_name_max_length
 [X] 0011_update_proxy_permissions
 [X] 0012_alter_user_first_name_max_length
contenttypes
 [X] 0001_initial
 [X] 0002_remove_content_type_name
sessions
 [X] 0001_initial
shops
 [X] 0001_initial
 [X] 0002_auto_20210630_1341

does this give you a better idea?
Thank you very much again
Stathis
On Wednesday, July 7, 2021 at 1:52:35 AM UTC+1 jacobgr...@gmail.com wrote:
The issue is with the model not the admin page. I suspect you haven't ran migrations for the "Shop" model. You defined a "shop" field in the model, but the database doesn't know anything about it.



On Tue, Jul 6, 2021, 7:16 PM Stathis Angelou <staka...@gmail.com> wrote:
Good evening all, i have created a new app and added a model. Added the app under installed apps, and run python manage.py makemigrations and migrate and everything worked as expected.

But i believe there is an issue with the admin.py file

from django.contrib import admin

# Register your models here.
from django.contrib.gis.admin import OSMGeoAdmin
from .models import Shop

@admin.register(Shop)
class ShopAdmin(OSMGeoAdmin):
    list_display = ('name', 'location')

Error message:
"ProgrammingError at /admin/shops/shop/relation "shops_shop" does not exist LINE 1: SELECT COUNT(*) AS "__count" FROM "shops_shop" "

Any advice or hint would be really appreciated 
Kind Regards

Stathis 

--
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/60ca7670-d423-49e1-9d4a-ea978e193dd4n%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fee676a6-fc92-47ab-a3cc-b35e7f907a57n%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGp2JVH-wLBVtRO9hE%2BpNKTt0CbuLENEV%3DKfNPJFu%2BY8bdmi7Q%40mail.gmail.com.

No comments:

Post a Comment