Skip to content

Commit

Permalink
unicef-locations
Browse files Browse the repository at this point in the history
  • Loading branch information
domdinicola committed Mar 14, 2022
1 parent 96b1661 commit 7dbfc18
Show file tree
Hide file tree
Showing 15 changed files with 732 additions and 667 deletions.
7 changes: 4 additions & 3 deletions django_api/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ python-social-auth = "<=0.3.6"
pyrestcli = "<=0.6.11"
requests = "<=2.26"
sentry-sdk = "<=1.3.1"
social-auth-app-django = "<=4.0"
social-auth-core = "<=4.1"
unicef-notification = "<=0.2.1"
social-auth-app-django = "<=5.0"
social-auth-core = "<=5.0"
unicef-notification = "<=1.1"
unicef-locations = "<=4.0"
uWSGI = "<=2.0.19.1"
weasyprint = "<=53.0"

Expand Down
1,025 changes: 585 additions & 440 deletions django_api/Pipfile.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions django_api/etools_prp/apps/core/admin.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from django.contrib.gis import admin

from leaflet.admin import LeafletGeoAdmin
from unicef_locations.models import CartoDBTable

from .cartodb import update_sites_from_cartodb
from .forms import CartoDBTableForm
from .models import CartoDBTable, Location, PRPRole, ResponsePlan, Workspace
from .models import Location, PRPRole, ResponsePlan, Workspace


class LocationAdmin(LeafletGeoAdmin, admin.ModelAdmin):
Expand Down Expand Up @@ -57,7 +58,6 @@ def import_sites(self, request, queryset):
class WorkspaceAdmin(admin.ModelAdmin):
list_display = ('title', 'workspace_code', 'business_area_code',
'external_id')
list_filter = ('countries',)
search_fields = ('title', 'workspace_code', 'business_area_code',
'external_id')

Expand All @@ -78,5 +78,6 @@ class PRPRoleAdmin(admin.ModelAdmin):
admin.site.register(Workspace, WorkspaceAdmin)
admin.site.register(Location, LocationAdmin)
admin.site.register(ResponsePlan, ResponsePlanAdmin)
admin.site.unregister(CartoDBTable)
admin.site.register(CartoDBTable, CartoDBTableAdmin)
admin.site.register(PRPRole, PRPRoleAdmin)
3 changes: 2 additions & 1 deletion django_api/etools_prp/apps/core/cartodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from celery import shared_task
from celery.utils.log import get_task_logger
from pyrestcli.auth import BaseAuthClient
from unicef_locations.models import CartoDBTable

from etools_prp.apps.core.models import CartoDBTable, Location
from etools_prp.apps.core.models import Location

logger = get_task_logger('core.cartodb')

Expand Down
2 changes: 1 addition & 1 deletion django_api/etools_prp/apps/core/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

from carto.exceptions import CartoException
from carto.sql import SQLClient
from unicef_locations.models import CartoDBTable

from etools_prp.apps.core.cartodb import EtoolsCartoNoAuthClient
from etools_prp.apps.core.models import CartoDBTable

logger = logging.getLogger('locations.models')

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Generated by Django 3.2.6 on 2022-02-23 23:23

import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.utils.timezone
import model_utils.fields


class Migration(migrations.Migration):

dependencies = [
('core', '0017_alter_location_unique_together'),
]

operations = [
migrations.AlterUniqueTogether(
name='gatewaytype',
unique_together=None,
),
migrations.RemoveField(
model_name='gatewaytype',
name='country',
),
migrations.RemoveField(
model_name='workspace',
name='countries',
),
migrations.AddField(
model_name='location',
name='created',
field=model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created'),
),
migrations.AddField(
model_name='location',
name='is_active',
field=models.BooleanField(blank=True, default=True, verbose_name='Active'),
),
migrations.AddField(
model_name='location',
name='modified',
field=model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified'),
),
migrations.AlterField(
model_name='location',
name='geom',
field=django.contrib.gis.db.models.fields.MultiPolygonField(blank=True, null=True, srid=4326, verbose_name='Geo Point'),
),
migrations.AlterField(
model_name='location',
name='point',
field=django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326, verbose_name='Point'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 3.2.6 on 2022-03-01 00:39

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('core', '0018_auto_20220223_2323'),
]

operations = [
migrations.SeparateDatabaseAndState(
state_operations=[
migrations.DeleteModel(name='CartoDBTable'),
],
database_operations=[
]
)
]
Loading

0 comments on commit 7dbfc18

Please sign in to comment.