Re: save_model doesn't run on Django version 4
One thing I'm not sure of it, how to tell if a particular Admin page is triggering a particular Admin instance. On Tuesday, September 13, 2022 at 11:27:54 AM UTC-5 Mike Kilmer wrote: > After having upgraded from Django 3 to 4 the save_model() method isn't > running, though the form it imports does. > > ``` > class MyCoolMapAdmin(SuperUserChangeOnlyMixIn, FilterByOwnerAdmin): > form = MyCoolModelForm > print("this prints on app initialization") > > def save_model(self, request, obj, form, change): > print("this never runs") > > class MyCoolModelForm(forms.ModelForm): > > def clean(self): > print("this does run") > ``` > > The `save_model` method doesn't seem to run for new or updated form > submission from the "MyCool" admin page. > > Thank you. > -- 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/29eeac28-112a-4935-b0c8-62e48b6a49den%40googlegroups.com.
save_model doesn't run on Django version 4
After having upgraded from Django 3 to 4 the save_model() method isn't running, though the form it imports does. ``` class MyCoolMapAdmin(SuperUserChangeOnlyMixIn, FilterByOwnerAdmin): form = MyCoolModelForm print("this prints on app initialization") def save_model(self, request, obj, form, change): print("this never runs") class MyCoolModelForm(forms.ModelForm): def clean(self): print("this does run") ``` The `save_model` method doesn't seem to run for new or updated form submission from the "MyCool" admin page. Thank you. -- 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/2051c3c8-d6ca-4d99-a5fe-d1b9f0897b08n%40googlegroups.com.
Re: Django tried these URL patterns
Not sure why, but moving path("integrations/", include("integrations.urls")), above the "" slash seems to have solved the problem. On Friday, June 17, 2022 at 5:45:19 PM UTC-5 Mike Kilmer wrote: > This app is set up to create webhooks and receive requests, however the > routing has broken and the requests are getting a 404. > > The path looks like this: > > > http://127.0.0.1:8000/integrations/dc3509ac-1aa8-4c9a-a439-904342d885cd/order > > The Stack Track/Routing: > > Using the URLconf defined in fulfill.urls, Django tried these URL > patterns, in this order: > >1. baton/ >2. [name='index'] >3. etc... >4. integrations/request/ >5. reports/clientreport/ >6. > ^(?Pauth|sites|account|socialaccount|users|core|integrations|reports)/$ > >[name='app_list'] >7. (?P.*)$ > > The current path, integrations/dc3509ac-1aa8-4c9a-a439-904342d885cd/order, > matched the last one. > > My URL setup is like this: > urlpatterns = [ > path("baton/", include("baton.urls")), > # Be sure "baton/" is at the beginning of the list, before "". > path("", admin.site.urls), > path('accounts/', include('allauth.urls')), > path("integrations/", include("integrations.urls")), > path("queryfilter/", include("core.urls")), > path("docs/", include("docs.urls")), > path( > "favicon.ico", > RedirectView.as_view(url=staticfiles_storage.url("favicon.ico")) > ), > ] > > With integrations.urls like this: > > urlpatterns = [ > path( > "/order", > incoming_order, > name="incoming-order", > ), > ] > > > The incoming_order method looks like this: > > @csrf_exempt > @require_http_methods(["POST"]) > def incoming_order(request, integration_uuid): > headers = request.headers > request_body = request.body.decode("utf-8") > log = Request.objects.create( > url=request.build_absolute_uri(), body=request_body, > headers=dict(headers) > ) > > log.process(integration_uuid) > > return JsonResponse({"status": "ok"}) > > Any suggestions? > -- 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/c23ab998-6331-44a0-ace2-a2f273fc36d5n%40googlegroups.com.
Django tried these URL patterns
This app is set up to create webhooks and receive requests, however the routing has broken and the requests are getting a 404. The path looks like this: http://127.0.0.1:8000/integrations/dc3509ac-1aa8-4c9a-a439-904342d885cd/order The Stack Track/Routing: Using the URLconf defined in fulfill.urls, Django tried these URL patterns, in this order: 1. baton/ 2. [name='index'] 3. etc... 4. integrations/request/ 5. reports/clientreport/ 6. ^(?Pauth|sites|account|socialaccount|users|core|integrations|reports)/$ [name='app_list'] 7. (?P.*)$ The current path, integrations/dc3509ac-1aa8-4c9a-a439-904342d885cd/order, matched the last one. My URL setup is like this: urlpatterns = [ path("baton/", include("baton.urls")), # Be sure "baton/" is at the beginning of the list, before "". path("", admin.site.urls), path('accounts/', include('allauth.urls')), path("integrations/", include("integrations.urls")), path("queryfilter/", include("core.urls")), path("docs/", include("docs.urls")), path( "favicon.ico", RedirectView.as_view(url=staticfiles_storage.url("favicon.ico")) ), ] With integrations.urls like this: urlpatterns = [ path( "/order", incoming_order, name="incoming-order", ), ] The incoming_order method looks like this: @csrf_exempt @require_http_methods(["POST"]) def incoming_order(request, integration_uuid): headers = request.headers request_body = request.body.decode("utf-8") log = Request.objects.create( url=request.build_absolute_uri(), body=request_body, headers=dict(headers) ) log.process(integration_uuid) return JsonResponse({"status": "ok"}) Any suggestions? -- 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/98d3971b-41da-4b33-8bbe-3b9a59332b9bn%40googlegroups.com.
Re: CSRF issue in default login
If you're interested in some piecemeal work, I could use some help. mike at mzoo.org. On Friday, June 17, 2022 at 3:10:16 PM UTC-5 181...@northsouth.edu wrote: > I have basic to intermediate knowledge on Django, but don't find any entry > level job to master my django knowledge in my country, can any one suggest > me where I can get some project or industry level job in django , please. I > am badly need that > > On Friday, June 17, 2022 at 11:29:04 PM UTC+6 Mike Kilmer wrote: > >> That sounds hopeful. Where do you put that config? Settings.py? >> >> On Friday, June 17, 2022 at 12:25:29 PM UTC-5 vicker...@gmail.com wrote: >> >>> I was having a similar issue after setting up https with certbot. After >>> searching around, I found adding this to settings worked. >>> >>> CSRF_TRUSTED_ORIGINS = ["https://yourdomain.com";, >>> "https://www.yourdomain.com";] >>> >>> I'd be curious to hear from others, because I'm *not *an expert in how to >>> best set up django for production. >>> >>> >>> On Fri, 17 Jun 2022 at 11:48, Mike Kilmer wrote: >>> >>>> Hi. >>>> >>>> I'm fairly new to Django. Here's what I need insight on: >>>> >>>> Local server, no issue. >>>> >>>> On production: CSRF 403 error on login. >>>> >>>> There's a cookie loaded on the login page containing csrftoken: >>>> pAFeeUI8YFXZ2PKRYxOTX1qz4Xgto42WVNi7FFvBlZDqcFLwQ2rdQvVeZBHFSpLW >>>> >>>> (Local and Session storage are empty) >>>> >>>> In the FORM element: >>>> >>>> >>> value="Vz4FiujD4qkLpxCwWNJU0HCWs4u0Qf4RrMHyJf66rK0cznDbOimeTb7BnIVckANR"> >>>> >>>> Notice they don't match. >>>> >>>> I tried running ./migrate.py clearsessions. >>>> >>>> Once, yesterday, it seemed that the error did not occur in an Incognito >>>> Window, but today it persists even in an incognito window, as well as a >>>> different browser. >>>> >>>> One additional piece of information, I have allauth installed, but it >>>> doesn't seem to be correctly configured. It's login page is not loading. >>>> >>>> Additionally, the problem was there even when I removed allauth from >>>> Apps and Authentication Backends. >>>> >>>> Thanks much. >>>> >>>> –Mike >>>> >>>> -- >>>> 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/551AFE93-8B25-4CB9-8D3F-F1BF1EC4F585%40mzoo.org >>>> . >>>> >>> -- 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/810b5821-7117-48d5-a71b-3ad09df7a1ean%40googlegroups.com.
Re: CSRF issue in default login
That sounds hopeful. Where do you put that config? Settings.py? On Friday, June 17, 2022 at 12:25:29 PM UTC-5 vicker...@gmail.com wrote: > I was having a similar issue after setting up https with certbot. After > searching around, I found adding this to settings worked. > > CSRF_TRUSTED_ORIGINS = ["https://yourdomain.com";, > "https://www.yourdomain.com";] > > I'd be curious to hear from others, because I'm *not *an expert in how to > best set up django for production. > > > On Fri, 17 Jun 2022 at 11:48, Mike Kilmer wrote: > >> Hi. >> >> I'm fairly new to Django. Here's what I need insight on: >> >> Local server, no issue. >> >> On production: CSRF 403 error on login. >> >> There's a cookie loaded on the login page containing csrftoken: >> pAFeeUI8YFXZ2PKRYxOTX1qz4Xgto42WVNi7FFvBlZDqcFLwQ2rdQvVeZBHFSpLW >> >> (Local and Session storage are empty) >> >> In the FORM element: >> >> > value="Vz4FiujD4qkLpxCwWNJU0HCWs4u0Qf4RrMHyJf66rK0cznDbOimeTb7BnIVckANR"> >> >> Notice they don't match. >> >> I tried running ./migrate.py clearsessions. >> >> Once, yesterday, it seemed that the error did not occur in an Incognito >> Window, but today it persists even in an incognito window, as well as a >> different browser. >> >> One additional piece of information, I have allauth installed, but it >> doesn't seem to be correctly configured. It's login page is not loading. >> >> Additionally, the problem was there even when I removed allauth from Apps >> and Authentication Backends. >> >> Thanks much. >> >> –Mike >> >> -- >> 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/551AFE93-8B25-4CB9-8D3F-F1BF1EC4F585%40mzoo.org >> . >> > -- 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/d592ab6f-68ee-483e-9ae6-6f4074cdbcefn%40googlegroups.com.
CSRF issue in default login
Hi. I'm fairly new to Django. Here's what I need insight on: Local server, no issue. On production: CSRF 403 error on login. There's a cookie loaded on the login page containing csrftoken: pAFeeUI8YFXZ2PKRYxOTX1qz4Xgto42WVNi7FFvBlZDqcFLwQ2rdQvVeZBHFSpLW (Local and Session storage are empty) In the FORM element: Notice they don't match. I tried running ./migrate.py clearsessions. Once, yesterday, it seemed that the error did not occur in an Incognito Window, but today it persists even in an incognito window, as well as a different browser. One additional piece of information, I have allauth installed, but it doesn't seem to be correctly configured. It's login page is not loading. Additionally, the problem was there even when I removed allauth from Apps and Authentication Backends. Thanks much. –Mike -- 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/551AFE93-8B25-4CB9-8D3F-F1BF1EC4F585%40mzoo.org.
Re: how to deploy python django project using heroku
Do you have your codebase tracked in a version tracking system like Github? If you do, then, from within Heroku, you can use the Github integration. On Thursday, June 16, 2022 at 11:01:52 AM UTC-5 maheshb...@gmail.com wrote: > please support me how deploy django project using git and heroku > help me > deploy on heroku and operation on it ...i am fresher so i dont no how to > work on dajngo rest framework please support me > -- 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/99774508-2d1a-43e4-8b2b-9dfe6ac4b523n%40googlegroups.com.