How to discover which postgres vesion is in use (on 1.11)?

2017-07-19 Thread Hanne Moa
When https://code.djangoproject.com/ticket/18332 lands (No generic way to get database backend version) this will be trivial but I need a solution for this now: How can I find out which version of postgres is in use? I need it thanks to JSONField. 9.6 has support for it but older postgresqls don't

New to django

2017-07-19 Thread dkushwah5
I want to connect my bootstrap website with django's database. Please tell me how to do it. -- 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+unsubsc

Re: Math filter

2017-07-19 Thread Vijay Khemlani
Also I guess mathfilters just executes left-to-right so a|mul:b|add:b|mul:c is (((a * b) + b) * c) On Wed, Jul 19, 2017 at 1:50 AM, James Schneider wrote: > > > On Jul 18, 2017 7:21 PM, "sum abiut" wrote: > > Hi, > needed direction maths filters on django templates. for example how to you >

url path got static ,can't execute other project files

2017-07-19 Thread Kesava Knights
I had downloaded a django file from github , and executed the file and working properly in browser UI. but later tried to execute another project file which is in another directory , url path got fixed to previous executed file and it same for any other project files except the first executed

permission denied for relation gallery_image

2017-07-19 Thread Samuel Muiruri
I made a mistake and overwrote the Django server's settings file with the local version and I lost the database settings for postgresql I have setup a new user and when I tried to reload the site again I get an error from one of the models as permission denied for relation gallery_image if I try t

Re: New to django

2017-07-19 Thread Stefano Probst
Hi! New to Django? Read the Getting started . Am Mittwoch, 19. Juli 2017 13:04:50 UTC+2 schrieb dkushwah5: > > I want to connect my bootstrap website with django's database. Please tell > me how to do it. > -- You received this message because yo

Re: How to discover which postgres vesion is in use (on 1.11)?

2017-07-19 Thread Antonis Christofides
Hello, You can probably do something like this: import sys from django.db import connection with connection.cursor() as cursor: cursor.execute("SELECT version()") result = cursor.fetchone()[0] sys.stdout.write(result + '\n') This prints out something like "PostgreSQL 9.4.12 on x86_64-

Fluent interface on custom methods of custom Queryset class

2017-07-19 Thread Fabio C. Barrionuevo da Luz
What is the right way to make Fluent interface on custom methods of custom Queryset class? In other words, how to make "by_validity" work without lost previous filters? Procedure.objects.filter(is_active=False).by_validity() I've tried using q = self or q = self.query before apply Q(start_date_

Re: Fluent interface on custom methods of custom Queryset class

2017-07-19 Thread Felippe Raposo
Hey Fabio, according to the Django documentation the right way would be: ProcedureManager = models.Manager.from_queryset(ProcedureQuerySet) class Procedure(models.Model): start_date = models.DateTimeField() end_dat

serving over either 80 or 443

2017-07-19 Thread Larry Martell
This is probably not strictly a Django question, but I'm hoping someone here has had to solve this before. We have a django app that is sometimes deployed in an environment with SSL and talks over port 443, and other times is deployed in a non-SSL environment and talks over port 80. In our templa

Re: serving over either 80 or 443

2017-07-19 Thread François Schiettecatte
This tells you whether the request is secure or not: https://docs.djangoproject.com/en/1.11/ref/request-response/#django.http.HttpRequest.is_secure You could set a flag in the context you pass your templates. And what about stripping 'https://0.0.0.0:443/‘ from the url, just use ‘/stat

Re: Math filter

2017-07-19 Thread Mike Morris
I am a newbie, but I think the answer is that you can't do that in the template - instead, calculate the number in the view and pass it to the template in the context dictionary. I think it's a design philosophy of Django Template Language to not support this as it muddies the border between d

Re: Math filter

2017-07-19 Thread Mike Morris
Of course, if they're integers you could implement the "mul" as a loop of "add"s... clumsy, but would work. On 07/19/2017 03:39 PM, Mike Morris wrote: I am a newbie, but I think the answer is that you can't do that in the template - instead, calculate the number in the view and pass it to t

Re: Math filter

2017-07-19 Thread Vijay Khemlani
I'm guessing he's using the mathfilters package https://github.com/dbrgn/django-mathfilters On Wed, Jul 19, 2017 at 7:28 PM, Mike Morris wrote: > Of course, if they're integers you could implement the "mul" as a loop of > "add"s... clumsy, but would work. > > On 07/19/2017 03:39 PM, Mike Morris

Re: Math filter

2017-07-19 Thread Mike Morris
On 07/19/2017 06:20 PM, Vijay Khemlani wrote: I'm guessing he's using the mathfilters package https://github.com/dbrgn/django-mathfilters Arggghhh... my ignorance is showing! I hope I included an "I'm new here" disclaimer in the original post!!! Anyway, never heard of it, I'll take a look!

Re: serving over either 80 or 443

2017-07-19 Thread James Schneider
On Jul 19, 2017 1:56 PM, "Larry Martell" wrote: This is probably not strictly a Django question, but I'm hoping someone here has had to solve this before. We have a django app that is sometimes deployed in an environment with SSL and talks over port 443, and other times is deployed in a non-SSL