Centroid of PolygonField

2019-09-12 Thread Pasquale
I have the following model: from django.contrib.gis.db import models as g class Neighborhoods(Model):     area = g.PolygonField()         def point(self):     #TODO:something better than this horrible hack of 2 db round trip     return Neighborhoods.objects.annotate(p=Centroid("area")).

Re: Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

2019-09-05 Thread Pasquale
On 04/09/19 10:24, Julien Enselme wrote: > Did you do the reverse with 'reviews:detail'? >>> reverse("review:detail")   Traceback (mo

Re: Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

2019-09-05 Thread Pasquale
On 04/09/19 10:24, Julien Enselme wrote: > Did you do the reverse with 'reviews:detail'? >>> reverse("review:detail")   Traceback (mo

Re: Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

2019-09-03 Thread Pasquale
Applied your suggestion,now I get django.urls.exceptions.NoReverseMatch: Reverse for 'detail' not found. 'detail' is not a valid view function or pattern name. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and st

Re: Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

2019-09-03 Thread Pasquale
I did put reviews/urls.py: from django.urls import path, include from . import views as v app_name="review" urlpatterns = [     path("", v.ReviewsDetail.as_view(), name="detail"), ] Also if I replace name parameter with namespace I get: TypeError: _path() got an unexpected keyword argument 'namesp

Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

2019-09-02 Thread Pasquale
I have in mysite/urls.py: from django.contrib import admin from django.urls import include, path from django.contrib.auth import views as auth_views from django.conf import settings from .views import * urlpatterns = [     path('admin/', admin.site.urls, name="admin"),     path("places/", include

Error 403 (Csfr token not valid)

2019-01-06 Thread Pasquale
I have the following files: #views.py from django.views.generic.edit import FormView from django.views.generic.base import TemplateView from braces.views import AnonymousRequiredMixin, CsrfExemptMixin #exempting from Csfr as the worst it can do is making lots of new users class LogonView(CsrfEx