Re: Multiple levels of user in django application

2014-12-01 Thread Scot Hacker
On Monday, December 1, 2014 9:00:51 PM UTC-8, Anju SB wrote: > > Actually I can't change the models of the different user details > (state_data,district_data,dub-division_data,circle_data,station_data) > because these tables are used for other GIS activities. > I need to map user with these t

Re: Multiple levels of user in django application

2014-12-01 Thread James Schneider
W wc On Dec 1, 2014 9:00 PM, "Anju SB" wrote: > Actually I can't change the models of the different user details > (state_data,district_data,dub-division_data,circle_data,station_data) > because these tables are used for other GIS activities. > I need to map user with these tables. > > > > > > O

Re: Multiple levels of user in django application

2014-12-01 Thread Anju SB
Actually I can't change the models of the different user details (state_data,district_data,dub-division_data,circle_data,station_data) because these tables are used for other GIS activities. I need to map user with these tables. On Saturday, 29 November 2014 23:00:11 UTC+5:30, Cal Leeming

Re: Any interest in a multi email field in django?

2014-12-01 Thread Lachlan Musicman
All good - that's how I build too. The slug/get_absolute_url will blow your mind. Makes everything easier. L. On 2 December 2014 at 15:10, JJ Zolper wrote: > Lachlan, > > Oh I absolutely understand. Don't get me wrong I prefer Django to be as > lightweight as possible, and leave out things that

Re: Any interest in a multi email field in django?

2014-12-01 Thread JJ Zolper
Lachlan, Oh I absolutely understand. Don't get me wrong I prefer Django to be as lightweight as possible, and leave out things that aren't really that necessary. I'm with you. I have also seen some ideas that I have turn into something people like and wish to pursue (rare but it has happened) s

Re: Any interest in a multi email field in django?

2014-12-01 Thread JJ Zolper
Carl, Thanks so much for your help, this suggestion will help a lot. I actually wasn't really aware that this was even possible until now. Would explain why I wasn't sure if it could be done. Thanks again, JJ -- You received this message because you are subscribed to the Google Groups "Djan

Re: Any interest in a multi email field in django?

2014-12-01 Thread Carl Meyer
Hi JJ, To make a form for users to add/remove emails with a linked model approach, you'll need an inline model formset: https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#inline-formsets Carl On 12/01/2014 07:47 PM, JJ Zolper wrote: > Carl, > > I went ahead and tried your implementa

Re: Any interest in a multi email field in django?

2014-12-01 Thread Lachlan Musicman
Hey JJ, And I probably could have been less gruff. What I was trying to say was, as someone that's been hanging in these parts for a few years now, I can tell you that it is unlikely the devs would introduce it to standard Django. That's why the BaseUser is so base - it's specifically designed to

Re: Any interest in a multi email field in django?

2014-12-01 Thread JJ Zolper
Carl, I went ahead and tried your implementation suggestion and I am at a point now that I am not sure what to do next: # Athlete Email class AthleteEmail(models.Model): athlete = models.ForeignKey(Athlete) email = models.EmailField(unique=True) verified = models.BooleanField(def

Re: Any interest in a multi email field in django?

2014-12-01 Thread JJ Zolper
Lachlan, Thanks for your input. I apologize if from my OP that it wasn't clear but I am already creating a Profile or "extending the user model". # Athlete User class Athlete(models.Model): athleteuser = models.OneToOneField(User) athleteavatar = models.ImageField("Profile Pic", uplo

Re: Any interest in a multi email field in django?

2014-12-01 Thread Carl Meyer
Hi JJ, On 12/01/2014 05:58 PM, JJ Zolper wrote: > I'm just curious if anyone around the community has an interest in > discussing the possibility of adding a "MultiEmailField" to Django? > > Here is what I found when roaming the internet: > > https://github.com/fle/django-multi-email-field > >

Re: Any interest in a multi email field in django?

2014-12-01 Thread Lachlan Musicman
You don't really need it native in Django because the User Model is easily extensible - giving you or others the opportunity to extend it as you see fit and to release it the world as fle has. See here: https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#extending-the-existing-user-mod

Any interest in a multi email field in django?

2014-12-01 Thread JJ Zolper
Hey everyone, I'm just curious if anyone around the community has an interest in discussing the possibility of adding a "MultiEmailField" to Django? Here is what I found when roaming the internet: https://github.com/fle/django-multi-email-field Basically, the reason I care is because on my web

Re: Using login_required decorator

2014-12-01 Thread JJ Zolper
The best way to require login to certain url and view hooks is the: @login_required decorator. Let me show you how I have it setup: My "Profile" view is the profile a user sees once they are logged in to then have the ability to edit their information so obviously this needs to have the login

Using login_required decorator

2014-12-01 Thread Rootz
I have a small project but I am trying to restrict access on some of the django app urls to login users only. The problem is that when I hit a page that requires login users I expected that they(users) are redirected to the login page however that is not the case of what happens instead they are

Re: Django's query result caching

2014-12-01 Thread termopro
Could you please explain ? Because I don't think it is possible to do it that way. For example i have the following in my models.py: class City(models.Model): name = models.CharField(max_length=40,db_index=True) state_name = models.CharField(max_length=30) location = models.PointField(

Re: Django's query result caching

2014-12-01 Thread George Silva
You can convert your spatial results to WKT and store them in redis. On Mon, Dec 1, 2014 at 2:45 PM, termopro wrote: > I am creating a website using Django 1.7 and GeoDjango. I've hit the point > when i need to optimize website speed. > > One of the bottlenecks is query execution. There are some

Re: Query set append

2014-12-01 Thread Simon Charette
Try using a subquery for this: tableC_QuerySet = models.TableC.objects.filter( tableC_id__in=models.TableB.objects.filter(table_ID = ).values() ) Le lundi 1 décembre 2014 14:07:59 UTC-5, check@gmail.com a écrit : > > Hello > > I am very new to python and Django . I have a basic question

Query set append

2014-12-01 Thread check . django
Hello I am very new to python and Django . I have a basic question : 1. I have three database tables : Table A , Table B and Table C 2. in my views.py i do : - tableB_QuerySet = models.TableB.objects.filter(table_ID = ) - *This returns 4 rows from table B * - Then i iterate over tableB

Re: template url reverse and namespacing is driving me crazy

2014-12-01 Thread Ionel Cristian Mărieș
Tim, this is not about documentation. It's a question of whose responsibility this (setting the current_app) is. The reusable app code (where one would set the current_app) is out of pjotr's control, unless he forks it and makes a fix. Making a fix is not that bad but the problem is that very

Django data replication example

2014-12-01 Thread Sebastian M Cheung
Hi, Anyone worked on Django data replication project? Please comment your experiences or links Thanks Sebastian -- 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

Re: simplifying double decorators?

2014-12-01 Thread Collin Anderson
Hi, Yes, decorators are just fancy syntax. These two code blocks are the same: @the_decorator def the_view(*args): # etc def the_view(*args): # etc the_view = the_decorator(the_view) Collin On Sunday, November 30, 2014 3:19:07 PM UTC-5, Richard Brockie wrote: > > Hi, > > Thanks for th

Re: template url reverse and namespacing is driving me crazy

2014-12-01 Thread Tim Graham
I don't disagree this is a common source of confusion and the documented solution seems cumbersome. In fact, I found a ticket about it: https://code.djangoproject.com/ticket/22203 We should move any discussion about solving the problem to django-developers instead of django-users though. Than

Django's query result caching

2014-12-01 Thread termopro
I am creating a website using Django 1.7 and GeoDjango. I've hit the point when i need to optimize website speed. One of the bottlenecks is query execution. There are some queries which run slowly even when optimized. So i'd like to cache query results and store them in Redis. The problem t

Re: template url reverse and namespacing is driving me crazy

2014-12-01 Thread Ionel Cristian Mărieș
This, this is not about improving the documentation. It's pretty clear how to solve the problem. The issue here is whom should have the responsibility of setting the correct current_app in the template context. One can always fix 3rd party apps but it gets old after a while. I for one can't nam

Re: template url reverse and namespacing is driving me crazy

2014-12-01 Thread Tim Graham
Did you read about passing 'current_app' to your template rendering calls? https://docs.djangoproject.com/en/1.7/topics/http/urls/#id4 The contrib.admin class has app_name='admin' and namespace='admin' by default, but you can create a custom AdminSite(name='foo') to customize the instance names

Re: template url reverse and namespacing is driving me crazy

2014-12-01 Thread pjotr
That is not the point. I know I can do that, but that doesn't solve the issue of an reusable app. I could fork the 'greeter' project, add my namespace in the templates, and it would be all working. But still that is not the point. The point is: how can I write a reusable app so that someone els

Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-01 Thread Danish Ali
I am not sure about that. is there any other easy way to get autofill slug then :) On Monday, December 1, 2014 6:34:05 PM UTC+5, Jani Tiainen wrote: > > On Mon, 1 Dec 2014 10:20:24 -0300 > Vijay Khemlani > wrote: > > > Have you tried following the stacktrace that resulted in the error? > > >

Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-01 Thread Jani Tiainen
On Mon, 1 Dec 2014 10:20:24 -0300 Vijay Khemlani wrote: > Have you tried following the stacktrace that resulted in the error? > > Does it fail when trying to strip the contents of the "name" field? > Or maybe that library where field AutoSlug comes from isn't compatible with your version of Dj

Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-01 Thread Danish Ali
I think it fails when it tries to stip content of name. Should I paste stacktrace here. Because I do not get any clue from stacktrace about the problem :/ On Monday, December 1, 2014 6:21:00 PM UTC+5, Vijay Khemlani wrote: > > Have you tried following the stacktrace that resulted in the error?

Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-01 Thread Kelvin Wong
Post the full trace. I looked at the source for auto slug field and they don't use strip, so the source of this error must be somewhere else. You are looking for code like this: slug = None slug.strip() K On Monday, December 1, 2014 5:11:17 AM UTC-8, Danish Ali wrote: > > still same error. >

Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-01 Thread Vijay Khemlani
Have you tried following the stacktrace that resulted in the error? Does it fail when trying to strip the contents of the "name" field? On Mon, Dec 1, 2014 at 10:16 AM, Danish Ali wrote: > I am using admin to enter data. > This is the URL from where I am trying to save records: > http://127.0.0

Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-01 Thread Danish Ali
I am using admin to enter data. This is the URL from where I am trying to save records: http://127.0.0.1:8000/admin/product/shop/add/ On Monday, December 1, 2014 6:15:08 PM UTC+5, Jani Tiainen wrote: > > On Mon, 1 Dec 2014 04:12:45 -0800 (PST) > Danish Ali > wrote: > > > Hello, > > > > I am

Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-01 Thread Jani Tiainen
On Mon, 1 Dec 2014 04:12:45 -0800 (PST) Danish Ali wrote: > Hello, > > I am getting this error: Error: 'NoneType' object has no attribute 'strip' > I have created a model and I am trying to autofill slug field in it. When I > save the record in database I get this error: Error: 'NoneType' objec

Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-01 Thread Danish Ali
still same error. On Monday, December 1, 2014 5:36:52 PM UTC+5, WongoBongo wrote: > > Comment out the earlier slug field. What happens? > > # slug = models.SlugField(null=True, blank=True) > > K > > On Monday, December 1, 2014 4:12:45 AM UTC-8, Danish Ali wrote: >> >> Hello, >> >> I am getting thi

Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-01 Thread Kelvin Wong
Comment out the earlier slug field. What happens? # slug = models.SlugField(null=True, blank=True) K On Monday, December 1, 2014 4:12:45 AM UTC-8, Danish Ali wrote: > > Hello, > > I am getting this error: Error: 'NoneType' object has no attribute 'strip' > I have created a model and I am trying

Error: 'NoneType' object has no attribute 'strip'

2014-12-01 Thread Danish Ali
Hello, I am getting this error: Error: 'NoneType' object has no attribute 'strip' I have created a model and I am trying to autofill slug field in it. When I save the record in database I get this error: Error: 'NoneType' object has no attribute 'strip' My model is: from django.db import model

Re: Constructing query

2014-12-01 Thread termopro
Thank you Collin ! It works :) On Sunday, November 30, 2014 9:09:46 PM UTC+2, Collin Anderson wrote: > > Hi, > > This might work: > > Tag.objects.filter(name__startswith='A').exclude(company=None).order_by( > 'name').all() > > Collin > > > On Friday, November 28, 2014 9:08:42 AM UTC-5, termopro wr