Re: ProgrammingError - relationship does not exist

2021-07-21 Thread Stathis Angelou
good evening all, I was wondering whether any of you had the chance to 
review my code and identify what the issue seems to be
Thank you once again
Stathis

On Tuesday, July 13, 2021 at 11:56:27 AM UTC+1 Stathis Angelou wrote:

> Good morning all and thank you for your time in this, as suggested once 
> again I did delete my migrations and re-run them again, 
> I am still getting the same error message though and that is when I try to 
> add data to my app.
>
> as mentioned before you can find my code on the link below:
> https://github.com/sangel667/Nearby_Shops_Project
>
> Thank you once more very much
>
> Stathis
> On Thursday, July 8, 2021 at 8:01:32 AM UTC+1 sutharl...@gmail.com wrote:
>
>> you can try this 
>> https://stackoverflow.com/questions/26283159/django-1-7-migrations-how-do-i-clear-all-migrations-and-start-over-from-scrat#comment41239691_26283159
>> if that also doesn't work and you are working on a personal project then 
>> you can try deleting your db, migration files and re running migrations
>>
>> On Thu, 8 Jul 2021 at 04:48, Stathis Angelou  wrote:
>>
>>> Good evening all and thank you for your messages,
>>>
>>>  as suggested i did delete all migrations in my shops project and did do 
>>> them again, 
>>> but i'm getting the same error message, i did use again makemigrations 
>>> and migrate. 
>>> show migrations show everything applied ok. if it makes it easier for 
>>> you i can share my github repository:
>>> https://github.com/sangel667/Nearby_Shops_Project
>>>
>>> Once again thank oyu very much for your time
>>>
>>> Stathis
>>> On Wednesday, July 7, 2021 at 5:07:50 PM UTC+1 jacobgr...@gmail.com 
>>> wrote:
>>>
>>>> Oh actually, it looks like the table doesn't exist. I misread the SQL. 
>>>> Something is wrong with your migrations. Are you sure you ran 
>>>> "makemigrations" after creating the shop model?
>>>>
>>>> On Wed, Jul 7, 2021, 11:03 AM Jacob Greene  
>>>> wrote:
>>>>
>>>>> Do you have any other attributes set in the modeladmin? Something is 
>>>>> telling the ORM to do a query on the "shop" field, and that field doesn't 
>>>>> exist in the DB and it's not defined in the model. Possibly a filter 
>>>>> field 
>>>>> in the ModelAdmin class? A full back trace might help illuminate where 
>>>>> you 
>>>>> have this set.
>>>>>
>>>>> On Wed, Jul 7, 2021, 8:13 AM Samin Serge  wrote:
>>>>>
>>>>>> in admin.py put this code to see. 
>>>>>> @admin.site.register (shop) 
>>>>>>
>>>>>>
>>>>>> Le mer. 7 juil. 2021 à 00:16, Stathis Angelou  a 
>>>>>> écrit :
>>>>>>
>>>>>>> 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 emai

Re: ProgrammingError - relationship does not exist

2021-07-13 Thread Stathis Angelou
Good morning all and thank you for your time in this, as suggested once 
again I did delete my migrations and re-run them again, 
I am still getting the same error message though and that is when I try to 
add data to my app.

as mentioned before you can find my code on the link below:
https://github.com/sangel667/Nearby_Shops_Project

Thank you once more very much

Stathis
On Thursday, July 8, 2021 at 8:01:32 AM UTC+1 sutharl...@gmail.com wrote:

> you can try this 
> https://stackoverflow.com/questions/26283159/django-1-7-migrations-how-do-i-clear-all-migrations-and-start-over-from-scrat#comment41239691_26283159
> if that also doesn't work and you are working on a personal project then 
> you can try deleting your db, migration files and re running migrations
>
> On Thu, 8 Jul 2021 at 04:48, Stathis Angelou  wrote:
>
>> Good evening all and thank you for your messages,
>>
>>  as suggested i did delete all migrations in my shops project and did do 
>> them again, 
>> but i'm getting the same error message, i did use again makemigrations 
>> and migrate. 
>> show migrations show everything applied ok. if it makes it easier for you 
>> i can share my github repository:
>> https://github.com/sangel667/Nearby_Shops_Project
>>
>> Once again thank oyu very much for your time
>>
>> Stathis
>> On Wednesday, July 7, 2021 at 5:07:50 PM UTC+1 jacobgr...@gmail.com 
>> wrote:
>>
>>> Oh actually, it looks like the table doesn't exist. I misread the SQL. 
>>> Something is wrong with your migrations. Are you sure you ran 
>>> "makemigrations" after creating the shop model?
>>>
>>> On Wed, Jul 7, 2021, 11:03 AM Jacob Greene  wrote:
>>>
>>>> Do you have any other attributes set in the modeladmin? Something is 
>>>> telling the ORM to do a query on the "shop" field, and that field doesn't 
>>>> exist in the DB and it's not defined in the model. Possibly a filter field 
>>>> in the ModelAdmin class? A full back trace might help illuminate where you 
>>>> have this set.
>>>>
>>>> On Wed, Jul 7, 2021, 8:13 AM Samin Serge  wrote:
>>>>
>>>>> in admin.py put this code to see. 
>>>>> @admin.site.register (shop) 
>>>>>
>>>>>
>>>>> Le mer. 7 juil. 2021 à 00:16, Stathis Angelou  a 
>>>>> écrit :
>>>>>
>>>>>> 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
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/django-users/60ca7670-d423-49e1-9d4a-ea978e193dd4n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "Django users

Re: ProgrammingError - relationship does not exist

2021-07-07 Thread Stathis Angelou


Good evening all and thank you for your messages,

 as suggested i did delete all migrations in my shops project and did do 
them again, 
but i'm getting the same error message, i did use again makemigrations and 
migrate. 
show migrations show everything applied ok. if it makes it easier for you i 
can share my github repository:
https://github.com/sangel667/Nearby_Shops_Project

Once again thank oyu very much for your time

Stathis
On Wednesday, July 7, 2021 at 5:07:50 PM UTC+1 jacobgr...@gmail.com wrote:

> Oh actually, it looks like the table doesn't exist. I misread the SQL. 
> Something is wrong with your migrations. Are you sure you ran 
> "makemigrations" after creating the shop model?
>
> On Wed, Jul 7, 2021, 11:03 AM Jacob Greene  wrote:
>
>> Do you have any other attributes set in the modeladmin? Something is 
>> telling the ORM to do a query on the "shop" field, and that field doesn't 
>> exist in the DB and it's not defined in the model. Possibly a filter field 
>> in the ModelAdmin class? A full back trace might help illuminate where you 
>> have this set.
>>
>> On Wed, Jul 7, 2021, 8:13 AM Samin Serge  wrote:
>>
>>> in admin.py put this code to see. 
>>> @admin.site.register (shop) 
>>>
>>>
>>> Le mer. 7 juil. 2021 à 00:16, Stathis Angelou  a 
>>> écrit :
>>>
>>>> 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
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/60ca7670-d423-49e1-9d4a-ea978e193dd4n%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...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/CAKRM%3DdFUzUj37o%3DxgqfQZU-Dj9FeH7CTZCUbCpRdkZ-nHAM-oQ%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/CAKRM%3DdFUzUj37o%3DxgqfQZU-Dj9FeH7CTZCUbCpRdkZ-nHAM-oQ%40mail.gmail.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/46a597f2-bfe1-4049-9c15-4d03ed4ac4b7n%40googlegroups.com.


Re: ProgrammingError - relationship does not exist

2021-07-07 Thread Stathis Angelou
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  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
>>  
>> <https://groups.google.com/d/msgid/django-users/60ca7670-d423-49e1-9d4a-ea978e193dd4n%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/fee676a6-fc92-47ab-a3cc-b35e7f907a57n%40googlegroups.com.


ProgrammingError - relationship does not exist

2021-07-06 Thread Stathis Angelou
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+unsubscr...@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.


Re: location based web app with django and geodjango

2021-06-20 Thread Stathis Angelou
Good evening all,
following my application development, I have reached to the stage where I 
am about to add some data using data migrations.
I did download some data from OSM (saved as json), added a load data 
function but when i run the migrate command I get a keyerror in my 
migration files:   

File 
"/home/qgislinuxadmin/nearbyshops/shops/migrations/0002_auto_20210618_2102.py", 
line 18, in load_data
for obj in objects['elements']:
KeyError: 'elements'

which would mean that the key in not in a dictionary.
Any help or advice would be appreciated

Kind  Regards

Stathis 
On Tuesday, June 15, 2021 at 12:01:19 PM UTC+1 Stathis Angelou wrote:

>
> Good morning Both and thank you very much for your help,
>
> Yes that worked!!?
> Thank you again,
> off for the next step!!
>
> Kind Regards
>
> Stathis
>
> On Tuesday, June 15, 2021 at 10:05:16 AM UTC+1 Nikeet NA wrote:
>
>> Your app is not registered in settings file as stated by Aritra.
>>
>> On Tuesday, 15 June 2021 at 14:22:45 UTC+5:30 arit...@gmail.com wrote:
>>
>>> Hello, 
>>> Register your app in setting.py-> INSTALLED_APPS like 
>>> 'appname.apps.appnameConfig' from your apps.py. Alternatively, you can 
>>> write 'app_name' instead of the whole sentence.
>>>
>>> Regards,
>>> Aritra.
>>>
>>> On Tue, 15 Jun 2021 at 05:46, Stathis Angelou  
>>> wrote:
>>>
>>>> good evening all,
>>>>
>>>> I have started building a webapp using python, django and linux, but 
>>>> i'm afraid the app does not appear under admin tab in 
>>>> 127.0.0.1:8000/admin
>>>> I am sure I am missing something, attached is my code
>>>>
>>>> Thank you in advance
>>>> 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/f96dec5e-7f33-43d5-b48b-283460668f5an%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/f96dec5e-7f33-43d5-b48b-283460668f5an%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/cb7f9498-97ea-4769-8638-638a101ccaf9n%40googlegroups.com.
# Generated by Django 3.2.4 on 2021-06-18 21:02

from os import name
from django.db import migrations
import json
from django.contrib.gis.geos import fromstr
from pathlib import Path

DATA_FILENAME = 'data.json'


def load_data(apps, schema_editor):
Shop = apps.get_model('shops', 'Shop')
jsonfile = Path(__file__).parents[2] / DATA_FILENAME

with open(str(jsonfile)) as datafile:
objects = json.load(datafile)
for obj in objects['elements']:
try:
objType = obj['type']
if objType == 'node':
tags = obj['tags']
name = tags.get('name', 'no-name')
longitude = obj.get('lon', 0)
latitude = obj.get('lat', 0)
location = fromstr(
f'POINT({longitude} {latitude})', srid=4326
)
Shop(name=name, location=location).save()
except KeyError:
pass


class Migration(migrations.Migration):

dependencies = [
('shops', '0001_initial'),
]

operations = [
migrations.RunPython(load_data)
]


Re: location based web app with django and geodjango

2021-06-15 Thread Stathis Angelou

Good morning Both and thank you very much for your help,

Yes that worked!!?
Thank you again,
off for the next step!!

Kind Regards

Stathis

On Tuesday, June 15, 2021 at 10:05:16 AM UTC+1 Nikeet NA wrote:

> Your app is not registered in settings file as stated by Aritra.
>
> On Tuesday, 15 June 2021 at 14:22:45 UTC+5:30 arit...@gmail.com wrote:
>
>> Hello, 
>> Register your app in setting.py-> INSTALLED_APPS like 
>> 'appname.apps.appnameConfig' from your apps.py. Alternatively, you can 
>> write 'app_name' instead of the whole sentence.
>>
>> Regards,
>> Aritra.
>>
>> On Tue, 15 Jun 2021 at 05:46, Stathis Angelou  wrote:
>>
>>> good evening all,
>>>
>>> I have started building a webapp using python, django and linux, but i'm 
>>> afraid the app does not appear under admin tab in 127.0.0.1:8000/admin
>>> I am sure I am missing something, attached is my code
>>>
>>> Thank you in advance
>>> 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/f96dec5e-7f33-43d5-b48b-283460668f5an%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/django-users/f96dec5e-7f33-43d5-b48b-283460668f5an%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/c960259e-2f2e-463c-a5b5-1eb1231b48b0n%40googlegroups.com.


Re: location based web app with django and geodjango

2021-06-15 Thread Stathis Angelou
Good morning Nikeet and thank you for your response, i am afraid i am
still not getting the web app yet on my admin page

Kind Regards

Stathis
On Tuesday, June 15, 2021 at 1:27:03 AM UTC+1 Nikeet NA wrote:

> Replace admin.site.register(Report) with this @admin.register(Report)
>
> On Tuesday, 15 June 2021 at 05:46:46 UTC+5:30 staka...@gmail.com wrote:
>
>> good evening all,
>>
>> I have started building a webapp using python, django and linux, but i'm 
>> afraid the app does not appear under admin tab in 127.0.0.1:8000/admin
>> I am sure I am missing something, attached is my code
>>
>> Thank you in advance
>> 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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2c0226e0-be5c-487f-8776-436e9baccd4fn%40googlegroups.com.


Re: location based web app with django and geodjango

2021-06-15 Thread Stathis Angelou
Good morning Nikeet and thank you for your response, i am afraid i am
still not getting the web app yet on my admin page

Kind Regards

Stathis

Στις Τρί, 15 Ιουν 2021 στις 1:27 π.μ., ο/η Nikeet NA
 έγραψε:
>
> Replace admin.site.register(Report) with this @admin.register(Report)
>
> On Tuesday, 15 June 2021 at 05:46:46 UTC+5:30 staka...@gmail.com wrote:
>>
>> good evening all,
>>
>> I have started building a webapp using python, django and linux, but i'm 
>> afraid the app does not appear under admin tab in 127.0.0.1:8000/admin
>> I am sure I am missing something, attached is my code
>>
>> Thank you in advance
>> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/15cbe9a7-fb69-4498-a726-1b6613c6536an%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO0H-H9M-1yXoeKbuZCrkbYCV68UJZ05BQS0A0AKa3zuG7DAHw%40mail.gmail.com.


location based web app with django and geodjango

2021-06-14 Thread Stathis Angelou
good evening all,

I have started building a webapp using python, django and linux, but i'm 
afraid the app does not appear under admin tab in 127.0.0.1:8000/admin
I am sure I am missing something, attached is my code

Thank you in advance
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f96dec5e-7f33-43d5-b48b-283460668f5an%40googlegroups.com.
from django.contrib import admin
from django.contrib.gis.admin import OSMGeoAdmin
from .models import Report

admin.site.register(Report)
class ReportAdmin(OSMGeoAdmin):
list_display = ('name','location')

# Register your models here.
from django.contrib.gis.db import models

class Incident(models.Model):
name = models.CharField(max_length=100)
location = models.PointField()
address = models.CharField(max_length=100)
ward = models.CharField(max_length=50)
# Create your models here.
from django.apps import AppConfig


class ReportsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'reports'
"""
Django settings for incidents project.

Generated by 'django-admin startproject' using Django 3.2.4.

For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""

from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-*#kfn*+a!qz_*u!r#c9s2pq1f@$5^2=&!2fg@mfhto1ot!)ndi'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'incidents',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'incidents.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'incidents.wsgi.application'


# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'postgres',
'USER' : 'postgres',
'PASSWORD' : '***',
'HOST' : 'localhost',
'PORT' : '5432'
}
}


# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/3.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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

STATIC_URL = '/static/'

# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

Testing in a project with multiple databases

2011-02-07 Thread Stathis
Hello everyone,

I have set up a project with multiple database connections (default
and legacy). I use models for the default database, but the legacy db
is not managed by models. I issue raw sql to query the legacy
database. Django-nose and south are  used.

I am facing multiple problems:

- When I run the tests two test databases are created (which is fine).
Nevertheless, django system tables (auth etc) are created in the test
legacy database (which is something I want to avoid). What is more, a
south script which uses the models is also run against the test legacy
database causing a failure.

- I am looking for a way to create the structure of the test legacy
database before testing. I want to do this by raw sql as the legacy
databased is not managed by models. Is there any way to do that?

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.