Re: How to configure client side SSL trusted CA certificate ?

2017-02-08 Thread Pankaj Singh
Hi, My question is where does SSL client code get the trusted CA certificates > from, from Django, Python or the underlying OS? As per official documentation of requests library: By default, Requests bundles a set of roo

Logs bloated by template variable not found in DEBUG level

2017-02-08 Thread Florian Perrodin
Dear all, What is the proper way of checking if a variable exists in django? To my knowledge, the proper way is to use the {% if var %} tag. If this is the case, it should not trigger a print in the output (even in the debug log level). Hereafter is an example: # Note: django 1.10.2 from django

Re: How to configure client side SSL trusted CA certificate ?

2017-02-08 Thread Pankaj Singh
I forgot to put c_rehash command in the example in my last reply. Here it goes: mkdir -p /tmp/custom-certs cp ~/Download/foo.example.com.cert /tmp/custom-certs cp ~/Download/bar.example.com.cert /tmp/custom-certs c_rehash /tmp/custom-certsexport REQUESTS_CA_BUNDLE='/tmp/custom-certs' On Wed, Feb

Re: No installed app with label 'province'.

2017-02-08 Thread Pankaj Singh
Hi Gerald, Have you added your new app in 'INSTALLED_APPS' in `settings.py`? Can you tell more about context of ther error, e.g. this error occurs on `python manage.py runserver` or when you access a page on django admin? Also, it would be much easier to find the issue if you can share the trace

Re: No installed app with label 'province'.

2017-02-08 Thread Gerald Brown
On Wednesday, February 8, 2017 at 6:08:44 PM UTC+8, Pankaj Singh wrote: > > Hi Gerald, > > Have you added your new app in 'INSTALLED_APPS' in `settings.py`? No, > because "province" is the name of a MODEL, not an app. > > Can you tell more about context of ther error, e.g. this error occurs on

In the admin area Pre-select foreingkey fields for filtered list

2017-02-08 Thread Roberto Russi
In the admin I have a list with a filter on a foreing-key field of model. In the new record form, when the filter is applied, I wont that foreing-key field is pre-compiled with the same value of the filter. Is there a way? -- You received this message because you are subscribed to the Google Gr

Foreign Key data not showing in formset

2017-02-08 Thread jon
I have the following view with an inlineformset for two models: 1. Orders, the master / parent model 2. LineitemInfo, the detail / child model. FormSet LineFormSet = inlineformset_factory(Orders, LineitemInfo, can_delete=True, exclude = ('ordernotes',)) The edit order_edit vie

Re: Foreign Key data not showing in formset

2017-02-08 Thread jon
As much as I hate to answer my own questions, I was calling instance of an empty Order() model rather than the instance of the populated model. So: lineitem_formset = LineFormSet(instance=Orders()) should have been: lineitem_formset = LineFormSet(instance=order) On Wednesday, February 8,

RE: Logs bloated by template variable not found in DEBUG level

2017-02-08 Thread Matthew Pava
I would define avar in the context inside the view function with a value of None (or other falsey value). From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Florian Perrodin Sent: Wednesday, February 8, 2017 3:37 AM To: Django users Subject: Logs bloated by t

Re: Logs bloated by template variable not found in DEBUG level

2017-02-08 Thread Derek
If the variable does not exist at all (which is strange, because you should be passing in all the variables needed by the template, from the view that calls it), then the docs say: If you use a variable that doesn’t exist, the template system will insert the value of the TEMPLATE_STRING_IF_INVA

Re: Aggregation question

2017-02-08 Thread Viktor Bale
Hi all No takers, eh? Does this means it also confuses other more experienced people, or that it's a silly question? If the aggration function was Avg instead of Sum, then it would make perfect sense (the average price per page over all books)... but it doesn't, so it doesn't :-) Thanks On Mo

Re: Aggregation question

2017-02-08 Thread Tim Graham
As for me, this statement from that page applies, "It’s difficult to intuit how the ORM will translate complex querysets into SQL queries so when in doubt, inspect the SQL with str(queryset.query) and write plenty of tests." I'm not good at figuring out at a glance what an aggregation query will

Re: How to configure client side SSL trusted CA certificate ?

2017-02-08 Thread Gang Yang
Hi, Pankaj, Thanks for the reply. The REQUESTS_CA_BUNDLE env var worked as long as I start the server manually. But I don't seem to be able to "export" this env var into the server daemon process, which is started from /etc/init.d. I'll keep digging on the daemon env var. Gang On Wednesday, F

Re: Aggregation question

2017-02-08 Thread Viktor Bale
Ok, you spurred me on to actually try it out. And the answer is interpretation (i) is correct. Which means the example in the cheat sheet is somewhat misleading, since it does't calculate price per page, rather the sum of prices per page for individual books. BTW, while playing with that little

Newbie question, start server with hostname

2017-02-08 Thread hippohippo
Dear all, I am a new comer on Django. I was able to to run start server by command as below yesterday. python manage.py runserver http:/hostname:8000 However today, it submit the error as CommandError: "http://te172.24.221.137:8000/"; is not a valid port number or address:port pair. Can any

Django Channels: best way to launch multiple workers

2017-02-08 Thread Charlie DeTar
What's the best way to launch multiple Django channels workers on a production server to take advantage of extra cores? The documentation says : Each server is single-threaded, so it’s recommended you run around one o

Re: Newbie question, start server with hostname

2017-02-08 Thread Dylan Reinhold
You don't include the http:// python manage.py runserver hostname:8000 or put the IP address in the hostname area/ Dylan On Wed, Feb 8, 2017 at 12:29 PM, hippohippo wrote: > Dear all, > > I am a new comer on Django. I was able to to run start server by command > as below yesterday. > > python m

Re: Django Channels: best way to launch multiple workers

2017-02-08 Thread Andrew Godwin
The difference is mostly in Python performance - threading in Python tends to perform worse than using multiple processes, which is why we recommend using multiple processes in the docs. However, you can save a bit of memory usage with threading, so you can use that if you want. I would not, howev

Re: Aggregation question

2017-02-08 Thread Tim Graham
Please submit a pull request to fix the documentation if you can. There's an open ticket for a way to get the SQL for a terminal queryset method: https://code.djangoproject.com/ticket/18631 On Wednesday, February 8, 2017 at 5:09:25 PM UTC-5, Viktor Bale wrote: > > Ok, you spurred me on to actual

Re: file fields

2017-02-08 Thread ايهاب توفيق
hi this backtrace Performing system checks... System check identified no issues (0 silenced). Unhandled exception in thread started by .wrapper at 0x036B8588> Traceback (most recent call last): File "C:\Users\e.bugaighis\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\utils\

Re: How to configure client side SSL trusted CA certificate ?

2017-02-08 Thread Pankaj Singh
Hi, You can put export commands in you daemon script. Look at this stackoverflow answers: 1. http://stackoverflow.com/a/3865077/353550 2. http://stackoverflow.com/a/27718602/353550 You can also find different ways to set environment variables for supervisord, uwsgi, apache mod_wsgi by Google Sear