Re: Redirection to SSO using Django

2017-03-09 Thread Melvyn Sopacua
On Wednesday 08 March 2017 20:10:26 Arun S wrote: > Using the django_allauth package, i could see it supports most of the > social accounts that can use used for redirection. > But what if i want to add a custom link within a corporate account.??? If that corporate account follows Oauth/Oauth2 the

Re: "trans" template tag using wrong language

2017-03-09 Thread Joan Perals
This post on StackOverflow seems to report the same behaviour: http://stackoverflow.com/questions/10282074/how-to-set-default-language-in-django-for-templates It's quite old (almost 5 years), but remains unresolved. -- You received this message because you are subscribed to the Google Groups "D

Re: "trans" template tag using wrong language

2017-03-09 Thread Antonis Christofides
It's very unlikely that such a basic behaviour won't work, so probably you are doing something wrong (and so's the stack overflow poster). I made several related changes in an app yesterday and I had absolutely no problem with {% trans %} (but I'm using 1.8). Do you have USE_I18N = True? If in th

Is it good practice to access the request from a model manager?

2017-03-09 Thread Antonis Christofides
Hello, *The problem** * It has happened to me more than once to need to check the user's permissions before allowing access to an object. Rather than worry whether I've remembered to do that in all my views and in all pieces of code there might be access, I'd prefer to make this check at the mode

Re: Is it good practice to access the request from a model manager?

2017-03-09 Thread Melvyn Sopacua
On Thursday 09 March 2017 12:51:26 Antonis Christofides wrote: > One solution that I've implemented in an app is to have middleware > that stores the request in a thread local variable. The model manager > gets the request from there and filters the results accordingly. If > there is no request ob

Re: Django FormPreview: Save form data to database

2017-03-09 Thread ludovic coues
If you want to create a Job object and save it to database, I highly recommend the CreateView https://docs.djangoproject.com/en/1.10/ref/class-based-views/generic-editing/#django.views.generic.edit.CreateView 2017-03-09 2:17 GMT+01:00 jthewriter : > Probably a simple question but having trouble i

Re: Is it good practice to access the request from a model manager?

2017-03-09 Thread Antonis Christofides
> So you've rebranded your problem from "remembering to do this in views" to > "remembering you've used the right model manager". No, because I do this in the default manager, "objects", and I create a new manager, "all_objects", for the exceptional case I actually want to get all objects in a view

Re: Full domain url subfolder redirected my django application with apache with mod_wsgi

2017-03-09 Thread valerio orfano
Yes, http//10.184.2.231/static/images/giphy.gif works out properly but www.uibm.gov.it/ static/images/giphy.gif does not work. On Wednesday, March 8, 2017 at 3:34:23 PM UTC+1, Antonis Christofides wrote: > > You say that you "run manage.py collectstatic and everything is

Re: Django FormPreview: Save form data to database

2017-03-09 Thread jthewriter
Yeah, that's actually what I was doing before, but as far as I can tell formtools prevents that possibility. Do you know of some way to create the desired 'preview page' behavior while using CreateView? On Thursday, March 9, 2017 at 4:30:26 AM UTC-7, ludovic coues wrote: > > If you want to creat

Re: Full domain url subfolder redirected my django application with apache with mod_wsgi

2017-03-09 Thread valerio orfano
Hi, i want to claim that www.mydomain.com is not the FQDN of my server where django app is installed, but it's another server that redirect to my django app. thanx valerio On Thursday, March 9, 2017 at 3:35:26 PM UTC+1, valerio orfano wrote: > > Yes, http//10.184.2.231/static/images/giphy.gif

Help: Data model in django

2017-03-09 Thread Ricken Cheng
Hi: I am a beginner using django, I want to build a flexible data model like this: Item_ID AttributeValue 1 Attr1 V1 1 Attr2 V2 2 Attr1 V3 2 Attr2 V4 1

Re: Help: Data model in django

2017-03-09 Thread Shawn Milochik
Are you using PostgreSQL? Maybe you can use JSONField. https://docs.djangoproject.com/en/1.10/ref/contrib/postgres/fields/#jsonfield -- 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 i

Re: Help: Data model in django

2017-03-09 Thread Melvyn Sopacua
On Thursday 09 March 2017 09:49:03 Ricken Cheng wrote: > Hi: >I am a beginner using django, I want to build a flexible data model > like this: > > Item_ID AttributeValue > 1 Attr1 V1 > 1 Attr2 V2 > 2 Att

Re: Django FormPreview: Save form data to database

2017-03-09 Thread ludovic coues
Oh, sorry, I didn't notice the form preview functionality. CreateView simply call form.save() but it have access to a ModelForm. I assume you want to create the object and save it in the done function. I would try that: def done(self, request, cleaned_data): job = Job(**cleaned_data)

Re: Django FormPreview: Save form data to database

2017-03-09 Thread jthewriter
Thanks. That's essentially what I ended up doing just with job = Job.objects.create(**cleaned_data) Appreciate your help! On Thursday, March 9, 2017 at 4:21:13 PM UTC-7, ludovic coues wrote: > > Oh, sorry, I didn't notice the form preview functionality. > > CreateView simply call form.save() bu

Django queryset High CPU Usage

2017-03-09 Thread Web Architect
Hi, I am a bit perplexed by this and not sure what the solution is. Following is the scenario: There is a Model A with 1 records. Just a simple queryset - A.objects.all() is resulting in CPU hitting almost 100%. Is there a way to optimize this? But why would such a query result in high CPU

Re: Django queryset High CPU Usage

2017-03-09 Thread Web Architect
Would like to further add - the python CPU Usage is hitting almost 100 %. When I run a Select * query on Mysql, its quite fast and CPU is normal. I am not sure if anything more needs to be done in Django. On Friday, March 10, 2017 at 10:55:51 AM UTC+5:30, Web Architect wrote: > > Hi, > > I am

Re: Redirection to SSO using Django

2017-03-09 Thread Scot Hacker
On Wednesday, March 8, 2017 at 5:26:02 AM UTC-8, Arun S wrote: > > Hi, > > My Project, i would want to redirect login page to a SSO page. > and handle redirection in Django. > You didn't mention what SSO service you are using for authentication, but there are existing Django apps for most commo

Re: Simple Join with no matching primary keys

2017-03-09 Thread Scot Hacker
On Wednesday, March 8, 2017 at 8:39:43 AM UTC-8, aysh...@gmail.com wrote: > > Tables are coming from different sources, for each single datetime value > there is a different url, in order to tie up the single source data it must > live inside its own table. > So why not make them into one tabl