Re: log out a user when user closes tab or browser

2019-03-21 Thread Christian Ledermann
SESSION_EXPIRE_AT_BROWSER_CLOSE works for me but only when you close the browswer, closing a tab will not log you out also it depends on the browser (firefox seemed in the past to ignore this) On Thu, 21 Mar 2019 at 05:34, Sam W wrote: > Is there a way in Django to log out a user when user

Virtual Host vs. MAMP

2019-03-21 Thread Daniel Leavey
I recently purchased and installed VirtualHostX 8.7 https://clickontyler.com/virtualhostx/ I wondered if I could use this local server setup on my Mac instead of installing MAMP or IMAMP. -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Hello From Nigeria

2019-03-21 Thread carl collins
Pls add me +237677104421 On Thu, Mar 21, 2019, 13:11 Gabriel Stone wrote: > hello i am from Ghana am i qualified to join? > > On Thu, Mar 21, 2019 at 1:54 PM Asiwaju Lasisi Prodigy Olatunbosun < > bosun...@gmail.com> wrote: > >> Yes 08024273381 >> >> On Wednesday, 13 March 2019 12:44:16 UTC+1,

Re: Hello From Nigeria

2019-03-21 Thread Gabriel Stone
hello i am from Ghana am i qualified to join? On Thu, Mar 21, 2019 at 1:54 PM Asiwaju Lasisi Prodigy Olatunbosun < bosun...@gmail.com> wrote: > Yes 08024273381 > > On Wednesday, 13 March 2019 12:44:16 UTC+1, Thaddeaus Iorbee wrote: >> >> Yes please. 0814390 >> >> On Monday, March 11, 2019,

Re: Hello From Nigeria

2019-03-21 Thread Nasim TKP
Anyone please share django whatsapp group or telegram group joining link pleasee On Thu, 21 Mar 2019, 3:11 pm Gabriel Stone, wrote: > hello i am from Ghana am i qualified to join? > > On Thu, Mar 21, 2019 at 1:54 PM Asiwaju Lasisi Prodigy Olatunbosun < > bosun...@gmail.com> wrote: > >>

404 error when posting a multipart/form-data form

2019-03-21 Thread Manlio Perillo
I have a Django application that works perfectly fine both on my PC and on a hosting system with CloudLinux and Passenger. However when I added a form with a file field, I started to get 404 errors on POST. I tried to remove all the middleware, but the problem is still here. The error message

Re: 404 error when posting a multipart/form-data form

2019-03-21 Thread Mohammad Etemaddar
Can you send your view here? On Thu, 21 Mar 2019 12:58 Manlio Perillo, wrote: > I have a Django application that works perfectly fine both on my PC and on > a hosting system with CloudLinux and Passenger. > However when I added a form with a file field, I started to get 404 errors > on POST. >

Re: Hello From Nigeria

2019-03-21 Thread Asiwaju Lasisi Prodigy Olatunbosun
Yes 08024273381 On Wednesday, 13 March 2019 12:44:16 UTC+1, Thaddeaus Iorbee wrote: > > Yes please. 0814390 > > On Monday, March 11, 2019, Joshua Kayode > wrote: > >> Greetings, if you are a django developer in Nigeria, would you consider >> joining a WhatsApp group? >> >> -- >> You

Re: log out a user when user closes tab or browser

2019-03-21 Thread Marconi Moreto Jr.
How about on `window.onbeforeunload` you delete the session id from the cookie, on next visit no session id to send so should be considered logged-out. On Thu, Mar 21, 2019, at 10:17 PM, KadirCEBEL wrote: > You can use jquery. you can write a function like logout (in the view) > after that when

Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Dylan Young
It's not a recalculation. It's instantiation. Instance data diverges from the factory data and needs to be independently editable. Best, Casey Le jeu. 21 mars 2019 2:52 a.m., Derek a écrit : > Permanently storing data that can be recalculated from existing data is a > practice specific to

Re: 404 error when posting a multipart/form-data form

2019-03-21 Thread Manlio Perillo
On Thursday, March 21, 2019 at 10:56:43 AM UTC+1, Mohammad Etemaddar wrote: > > Can you send your view here? > > Here is the URL that reproduce the problem: https://fast-page.it/mp/bug/ and here is the URL that prints the Django environment: https://fast-page.it/mp/debug/ The view code is here:

Re: log out a user when user closes tab or browser

2019-03-21 Thread Sam W
Thank you for your response. SESSION_EXPIRE_AT_BROWSER_CLOSE = True Doesn't work well in Chrome browser. Plus I want the client's session to be expired/logged out when tab closed. On Thursday, March 21, 2019 at 6:48:20 AM UTC-5, Christian Ledermann wrote: > > SESSION_EXPIRE_AT_BROWSER_CLOSE

Re: log out a user when user closes tab or browser

2019-03-21 Thread KadirCEBEL
You can use jquery. you can write a function like logout (in the view) after that when browser tab is closed (you have to check with jquery code) you can kill user session. Prş, 2019-03-21 tarihinde 17:15 +0330 saatinde, Mohammad Etemaddar yazdı: > I have a suggest for you. Its non standard. >

Re: log out a user when user closes tab or browser

2019-03-21 Thread Mohammad Etemaddar
I have a suggest for you. Its non standard. First create a javascript infinite loop to make a get call every 1 minute. Also make session expiration time at 2 minutes. So if tabs closed the session will expire at 1 minute. On Thu, 21 Mar 2019 15:17 Christian Ledermann, <

Re: Hello From Nigeria

2019-03-21 Thread chaitanya goud
Hi i am an django developer I can join On Mon, 11 Mar 2019, 18:46 Joshua Kayode, wrote: > Greetings, if you are a django developer in Nigeria, would you consider > joining a WhatsApp group? > > -- > You received this message because you are subscribed to the Google Groups > "Django users"

Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Derek
Your use case is not very clear. If you are simply "running a few trivial calculations and storing the info" then you could use a function in the database to do this for you - pulling data directly from Table A and storing the result in Table B. Data in Table B could then be later edited using

Re: log out a user when user closes tab or browser

2019-03-21 Thread Sam W
Thank you for your response. JavaScript infinite loop behavior gets blocked by Antivirus. On Thursday, March 21, 2019 at 8:46:22 AM UTC-5, Mohammad Etemaddar wrote: > > I have a suggest for you. Its non standard. > > First create a javascript infinite loop to make a get call every 1 minute. >

Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Dylan Young
For example using made-up syntax: Entry.objects.create(start=F(Recurrence.objects.filter(pk=r_id), 'start_time')) Note that we can't use `get` since the whole point is to avoid all the useless round-trips to the DB. Best, Casey On Thu, 21 Mar 2019 at 13:18, Dylan Young wrote: > It's not a

Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Chasan KIOUTSOUK MOUSTAFA
You can override the save method or simply use Django signals to modify fields of Model automatically. On Thu, Mar 21, 2019 at 8:21 PM Derek wrote: > Your use case is not very clear. > > If you are simply "running a few trivial

Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Dylan Young
It's perfectly clear and precisely what an ORM is for. If you don't have an answer, just say so, though I suspect the answer is use SubQuery. It is not "useless" in general (obviously if you want to display/ deliver to an end user, you need to pluck from the database). It is useless in the

Re: 404 error while loading uploaded image when debug is False

2019-03-21 Thread Mohammad Etemaddar
In production , we serve static files (like images) stright from httpd like apache, and we do not call django to serve them. But in testing while run django test server, we use static paths in urls.py to serve them, Maybe you have added mediaurls to your urlpatterns in urls.py conditionally (when

Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Simon Charette
I'm not sure where r_id comes from but Model.save usually deals with any expression correctly so you could try using a subquery assignment and see if it works. e.g. entry = Entry.objects.create( start=Subquery( Recurrence.objects.filter(pk=r_id).values('start_time')[:1] ) )

Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Dylan Young
Thanks Simon. That's exactly what I'm looking for. Wish they had piggy backed in the established F pattern though. It's quite verbose just to access the field on either model. r_id would just be a pk, usually from a fk on another model that I do need to fetch. Best, Casey Le jeu. 21 mars

404 error while loading uploaded image when debug is False

2019-03-21 Thread mayank dubey
Hii there, I am not able to load images which have been uploaded through the admin portal on my Django site if I set debug = false. While when debug = true, images are easily loaded. I am not able to understand what is the problem, please help me out. Thank you, M -- You received this message

Problema con dos formularios en una plantilla. Error " Generic detail view addAutorXlibro must be called with either an object pk or a slug in the URLconf."

2019-03-21 Thread Diego Puerta
Para comentarles mi problema los contextualizo: Es un ejercicio de prática. Django 2.1.5; PyCharms Tengo dos modelos relacionados, la idea es poder ingresar datos desde un mismo formulario a los dos modelos, para eso tengo lo siquiente: *Modelos:* class Autor(models.Model): nombre =

Translation doesn't work?

2019-03-21 Thread ANi
Hello. The only word that has been translated is "name", but it seems that it is the default one in Django. So basically my translation does not work at all.. please help Here is what I've done so far... settings.py MIDDLEWARE = [ ...

Re: Translation doesn't work?

2019-03-21 Thread Aldian Fazrihady
Hi ANi, I think the settings should you lower case letter like this: LANGUAGE = [ ('en-us', 'English'), ('zh-hant','繁體中文'), ] LANGUAGE_CODE = 'zh-hant' And the locale folder should use underscore instead of dash, and use uppercase 'H', like this: - locale - zh_Hant Regards, Aldian

Re: Translation doesn't work?

2019-03-21 Thread ANi
Oh yes, thank you, Aldian. But it doesn't work, either. :-\ Aldian Fazrihady於 2019年3月22日星期五 UTC+8上午11時20分54秒寫道: > > Hi ANi, > > I think the settings should you lower case letter like this: > > LANGUAGE = [ > ('en-us', 'English'), > ('zh-hant','繁體中文'), > ] > > LANGUAGE_CODE = 'zh-hant' > >

Re: Translation doesn't work?

2019-03-21 Thread Aldian Fazrihady
Even after you rerun these commands? python manage.py makemessages -l zh_Hant python manage.py compilemessages On Fri, Mar 22, 2019 at 11:41 AM ANi wrote: > Oh yes, thank you, Aldian. > But it doesn't work, either. :-\ > > > Aldian Fazrihady於 2019年3月22日星期五 UTC+8上午11時20分54秒寫道: >> >> Hi ANi,

initial data inlineAdmin

2019-03-21 Thread carlos
Hi, what is the best way fill all extra data inline, my code is model.py ModelA(models.Model): name = charfield(...) CHOICE_OPTION = ((1,'One'),(2,'Two'),(3, 'Three') ModelB(models.Model): fk(ModelA) option = integerfield(choice=CHOICE_OPTION) field1 = boolfield() field2 =

Re: Translation doesn't work?

2019-03-21 Thread ANi
That's right, nothing changed. Aldian Fazrihady於 2019年3月22日星期五 UTC+8上午11時49分29秒寫道: > > Even after you rerun these commands? > > python manage.py makemessages -l zh_Hant > > python manage.py compilemessages > > > On Fri, Mar 22, 2019 at 11:41 AM ANi > > wrote: > >> Oh yes, thank you, Aldian. >>