Re: Weird date math bug?

2017-08-31 Thread James Schneider
> I am so embarrassed. Thank you James, spot on. cheers L. No worries. I've stuck my foot in my mouth more than once on this list. -James -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: Weird date math bug?

2017-08-31 Thread Lachlan Musicman
On 1 September 2017 at 14:57, James Schneider wrote: > I'm guessing that ChemoRegime.regime_age() contains line 95. > > ChemoRegime defines the stop_date field with null=True and blank=True. I'm > guessing this is because patients may not have yet stopped treatment, so >

Re: Weird date math bug?

2017-08-31 Thread James Schneider
On Aug 31, 2017 9:44 PM, "Lachlan Musicman" wrote: Sorry, let me start again: Yay, I'm not the only one that does it! Lol... class ChemoRegime(models.Model): patient = models.ForeignKey(Patient, on_delete=models.CASCADE) chemotype = models.ForeignKey(ChemoType,

Re: Weird date math bug?

2017-08-31 Thread Lachlan Musicman
Sorry, let me start again: Is there a weird date math bug in Django 1.11.4? I say weird because surely not? I can't see any tickets in the tracker, but I'm definitely seeing it in production. Using postgresql: models.py class ChemoType(models.Model): name =

Weird date math bug?

2017-08-31 Thread Lachlan Musicman
Is there a weird date math bug in Django 1.11.4? I say weird because surely not? I can't see any tickets in the tracker, but I'm definitely seeing it in production. Using postgresql: class Patient(models.Model): -- "The antidote to apocalypticism is *apocalyptic civics*. Apocalyptic

Re: A lot of Problems with Migrating (conceptual)

2017-08-31 Thread Alexander Joseph
Thanks Melvyn, good to know. I'll keep that in mind On Thursday, August 31, 2017 at 9:19:57 AM UTC-6, Melvyn Sopacua wrote: > > There are two main principles to remember about Django migrations in early > development stage: > > 1) Make migrations often and coherent. >Typically, if you

django-channels get the json post on connect

2017-08-31 Thread Samuel Muiruri
I have this in routing.py for django-channels channel_routing = [ # Wire up websocket channels to our consumers: route("websocket.connect", ws_connect), route("websocket.receive", ws_message), ] and the ws_connect looks like this @channel_session def ws_connect(message, key): #

Re: Is some problem in field options 'null'?

2017-08-31 Thread Melvyn Sopacua
The document says to avoid null=True for character fields, because they both "mean the same thing": there is nothing in there. They are however different and this is why Django returns None: - Empty character fields are considered a value - NULL character fields are not This is important in

Link to download a file

2017-08-31 Thread giuseppe ricci
Hi guys, I need some help to insert a link to download a file. In a view I read data from a csv file and I show them in a table in a template. Under the table I need to insert, when there are data, a link similar as Download data and when user click it, he download the datafile, previously I

Re: trying to create allauth SignupForm subclass for customization....

2017-08-31 Thread Melvyn Sopacua
The answer lies in the fact that you are getting a Django configuration exception and not an ImportError. The solution: https://github.com/pennersr/django-allauth/issues/826 The reason: https://github.com/pennersr/django-allauth/blob/master/allauth/account/forms.py#L197 So, there is an import

Re: A lot of Problems with Migrating (conceptual)

2017-08-31 Thread Melvyn Sopacua
There are two main principles to remember about Django migrations in early development stage: 1) Make migrations often and coherent. Typically, if you change something about a model, make a migration. When you want to cover multiple models in one migration, there should be a good reason

Re: Testing file upload via a form?

2017-08-31 Thread Melvyn Sopacua
​In the documentation of the test client it is all spelled out how to test file uploads. ​ ​ On Tue, Aug 29, 2017 at 8:48 PM, Derek wrote: > (Python 3.5 and Django 1.10) > > I am trying

Re: Bizarre URL behaviour after deploying

2017-08-31 Thread Melvyn Sopacua
You may have a reverse proxy on port 80 that incorrectly rewrites /(.*) to / both ways. On Thu, Aug 31, 2017 at 2:10 PM, Bernd Wechner wrote: > Tom, > > So I did a quick test now before retiring after all. And I am pulling my > hair out now. If I restart lighttpd on port

Re: Bizarre URL behaviour after deploying

2017-08-31 Thread Bernd Wechner
Tom, So I did a quick test now before retiring after all. And I am pulling my hair out now. If I restart lighttpd on port 8000 (the last step to apparent convergence) it works. I access both development and webserve sites on: http://127.0.0.1:8000/ with server local browsers (Chrome on

Re: Bizarre URL behaviour after deploying

2017-08-31 Thread Bernd Wechner
Daniel, it's a red herring. I agree, that's where I'd suspect the issue lies, but I'm still confident it's a red herring. But because I'm stuck even the seemingly impossible needs to be revisited I guess. It's hard to share everything about a webservers config of course in an email, but

Re: Bizarre URL behaviour after deploying

2017-08-31 Thread Bernd Wechner
Tom, I will credit you there with stating the obvious in a sense, that I was reluctant to accept. Because it seems frankly impossible. But when nothing seems possible, we do need to revisit the "apparently" impossible, so I pulled a sweet trick and tried identical code in devlopment and

Re: Bizarre URL behaviour after deploying

2017-08-31 Thread Daniel Roseman
On Thursday, 31 August 2017 10:51:22 UTC+1, Tom Evans wrote: > > On Thu, Aug 31, 2017 at 2:09 AM, Bernd Wechner > wrote: > > Daniel, > > > > Yes, I have deployed, that is the problem in a sense. URLs are clean in > dev > > and suddenly contain an app_name when

Re: Bizarre URL behaviour after deploying

2017-08-31 Thread 'Tom Evans' via Django users
On Thu, Aug 31, 2017 at 2:09 AM, Bernd Wechner wrote: > Daniel, > > Yes, I have deployed, that is the problem in a sense. URLs are clean in dev > and suddenly contain an app_name when deployed. > > Not sure what you mean by configuration? The Django settings are here: > >

Re: Database router with read replica

2017-08-31 Thread Antonis Christofides
Hi, When I once faced this problem I used django-multidb-router . It uses the term "pinning" for the fact that after a query to the master database it "pins" itself to the master database, i.e. uses the master database exclusively for the rest of

Re: Bizarre URL behaviour after deploying

2017-08-31 Thread James Schneider
What I want to understand is why this "app" suddenly appears in my URLs and how I can control it (remove it ideally). But I have looked at urls.py long enough and scratched my head and not found it. settings.py is right next to if you need to inspect it. Out of sheer curiosity, what is the

Re: get json sent to channels in view

2017-08-31 Thread Andrew Godwin
You want to look for incoming data on the "websocket.receive" channel, which will call you once per message you send down with the right data. That's "websocket.connect", which happens after the socket opens but before data is sent down it. Andrew On Wed, Aug 30, 2017 at 10:07 AM, Samuel Muiruri