updating postgres to postgis
This commit is contained in:
parent
bc46ca831c
commit
7fcca38986
3 changed files with 30 additions and 18 deletions
|
|
@ -1,15 +1,3 @@
|
|||
"""
|
||||
Django settings for localist project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 6.0.6.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/6.0/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/6.0/ref/settings/
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
from config import DB_NAME, DB_USER, DB_HOST, DB_PASSWORD, DB_PORT, SECRET_KEY
|
||||
|
||||
|
|
@ -33,6 +21,7 @@ ALLOWED_HOSTS = []
|
|||
|
||||
INSTALLED_APPS = [
|
||||
"corsheaders",
|
||||
"django.contrib.gis",
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
|
|
@ -81,7 +70,7 @@ WSGI_APPLICATION = "localist.wsgi.application"
|
|||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.postgresql",
|
||||
"ENGINE": "django.contrib.gis.db.backends.postgis",
|
||||
"NAME": DB_NAME,
|
||||
"USER": DB_USER,
|
||||
"PASSWORD": DB_PASSWORD,
|
||||
|
|
@ -131,4 +120,4 @@ STATIC_URL = "static/"
|
|||
CORS_ALLOWED_ORIGINS = [
|
||||
"http://localhost:5173",
|
||||
"http://127.0.0.1:5173",
|
||||
]
|
||||
]
|
||||
|
|
|
|||
21
web/migrations/0003_event_coordinates.py
Normal file
21
web/migrations/0003_event_coordinates.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Generated by Django 6.0.6 on 2026-06-21 17:56
|
||||
|
||||
import django.contrib.gis.db.models.fields
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("web", "0002_alter_eventcategory_category"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="event",
|
||||
name="coordinates",
|
||||
field=django.contrib.gis.db.models.fields.PointField(
|
||||
blank=True, default=None, null=True, srid=4326
|
||||
),
|
||||
),
|
||||
]
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
from django.db import models
|
||||
from django.contrib import admin
|
||||
from django.contrib.gis import admin
|
||||
from django.contrib.gis.db import models
|
||||
from web.models.base import BaseModel
|
||||
from enum import StrEnum
|
||||
|
||||
|
||||
class Event(BaseModel):
|
||||
|
|
@ -14,6 +13,7 @@ class Event(BaseModel):
|
|||
description = models.TextField()
|
||||
url = models.URLField()
|
||||
address = models.CharField()
|
||||
coordinates = models.PointField(blank=True, default=None, null=True)
|
||||
status = models.CharField(max_length=20, choices=Status.choices, default=Status.SCHEDULED)
|
||||
price = models.DecimalField(max_digits=10, default=None, blank=True, decimal_places=2)
|
||||
require_rsvp = models.BooleanField()
|
||||
|
|
@ -29,7 +29,7 @@ class Event(BaseModel):
|
|||
db_table = 'events'
|
||||
|
||||
|
||||
class EventAdmin(admin.ModelAdmin):
|
||||
class EventAdmin(admin.GISModelAdmin):
|
||||
search_fields = (
|
||||
'name',
|
||||
'description',
|
||||
|
|
@ -38,6 +38,7 @@ class EventAdmin(admin.ModelAdmin):
|
|||
'rain_date',
|
||||
'url',
|
||||
'address',
|
||||
'coordinates',
|
||||
'status',
|
||||
'price',
|
||||
'require_rsvp',
|
||||
|
|
@ -51,6 +52,7 @@ class EventAdmin(admin.ModelAdmin):
|
|||
'rain_date',
|
||||
'url',
|
||||
'address',
|
||||
'coordinates',
|
||||
'status',
|
||||
'price',
|
||||
'require_rsvp',
|
||||
|
|
|
|||
Loading…
Reference in a new issue