Re: Using email instead of username for registration and login

2012-09-24 Thread Stephen Anto
Hi,

For login with email or username in Django visit
http://www.f2finterview.com/web/Django/18/ it will give you direction

On Tue, Sep 25, 2012 at 7:27 AM, Bill Beal  wrote:

> Hi all,
>
> I want to use the email address as the username for registration and
> login.  I'm using django-registration for 2-stage registration.  I'm
> looking for an easier way than what I've come up with so far.  I can modify
> registration and activation, but then django.contrib.auth.views.login has a
> 30-character limit on the username.  I'm not looking forward to making
> username act like an email address.  Any quick fixes?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/E4GTF1wAPZ8J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Thanks & Regards
Stephen S



Website: www.f2finterview.com
Blog:  blog.f2finterview.com
Tutorial:  tutorial.f2finterview.com
Group:www.charvigroups.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Upgrade to Mountain Lion bootstrap and buildout don't work

2012-09-24 Thread Zeeshan Syed
Hi there,

I recently upgraded to Mountain Lion on my Mac, and now bootstrap and 
buildout don't work. I keep on getting this error message anytime I run 
python boostrap.py:

Traceback (most recent call last):
  File "bootstrap.py", line 172, in 
ez['use_setuptools'](**setup_args)
  File "", line 103, in use_setuptools
  File "", line 99, in do_download
  File "build/bdist.linux-i686/egg/setuptools/__init__.py", line 2, in 

  File "build/bdist.linux-i686/egg/setuptools/extension.py", line 2, in 

  File "build/bdist.linux-i686/egg/setuptools/dist.py", line 6, in 
  File "build/bdist.linux-i686/egg/setuptools/command/sdist.py", line 5, in 

  File "build/bdist.linux-i686/egg/pkg_resources.py", line 2623, in 
add_activation_listener(lambda dist: dist.activate())
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 679, in subscribe
callback(dist)
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 2623, in 
add_activation_listener(lambda dist: dist.activate())
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 2172, in activate
map(declare_namespace, self._get_metadata('namespace_packages.txt'))
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 1776, in 
declare_namespace
__import__(parent)
ImportError: No module named z3c

Any help is much appreciated.

Thanks,
Zee


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/bOnbKb0S7DwJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Using email instead of username for registration and login

2012-09-24 Thread Russell Keith-Magee
On Tue, Sep 25, 2012 at 9:57 AM, Bill Beal  wrote:
> Hi all,
>
> I want to use the email address as the username for registration and login.
> I'm using django-registration for 2-stage registration.  I'm looking for an
> easier way than what I've come up with so far.  I can modify registration
> and activation, but then django.contrib.auth.views.login has a 30-character
> limit on the username.  I'm not looking forward to making username act like
> an email address.  Any quick fixes?

The quick and nasty fix -- issue the ALTER statement on your database
to make the field longer, and define custom forms that enforce the new
field length. Provide those custom forms to the auth login views, etc.

The slightly better fix -- fork Django (or, at least,
django.contrib.auth) for the purposes of your local deployment, and
modify the 30 character constraint wherever it occurs.

The real fix: I'm about to land a new feature for Django 1.5 that will
allow you to install a custom your User model that has whatever
properties you want (e.g., a longer username field, only an email
field, twitter handle instead of username, etc). If you want to test
this branch, you can check out my Github repo [1], or wait a day or
two and try it out on the Django development branch (that will
eventually become 1.5).

[1] https://github.com/freakboy3742/django/tree/t3011

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django on Bluehost

2012-09-24 Thread Babatunde Akinyanmi
If cloud, I like dotcloud

On 9/24/12, Alec Taylor  wrote:
> You will probably crap-out with Bitbucket. Go to a cloud provider instead.
>
> For example, Red Hat OpenShift offers their IaaS platform for free (ATM
> anyway).
>
> On Mon, Sep 24, 2012 at 2:21 PM, Zach  wrote:
>
>> Hey everyone,
>> I have recently been setting up a Django 1.4.1 project with python 2.7.2
>> and MySQL. I am using fcgi to deploy my project in this environment
>> because
>> mod_wsgi is not available through bluehost. After much frustration I have
>> gotten my site up to display the "it works" page. Now for some strange
>> reason I can not get it away from this page. I have set up the urls.py
>> file
>> for the main project along with adding my app into the Installed_Apps
>> section of the settings.py file.
>> My .htaccess file is the following
>> *AddHandler fcgid-script .fcgi*
>> *Options +SymLinksIfOwnerMatch*
>> *RewriteEngine On*
>> *RewriteBase /*
>> *RewriteRule ^(media/.*)$ - [L]*
>> *RewriteRule ^(adminmedia/.*)$ - [L]*
>> *RewriteCond %{REQUEST_URI} !(mysite.fcgi)*
>> *RewriteRule ^(.*)$ mysite.fcgi/$1 [L]*
>>
>> My mysite.fcgi is the following
>> *#!/home1/propesn4/python27/bin/python*
>> *import sys, os*
>> *sys.path.insert(0, "/home1/propesn4/python27")*
>> *os.environ['DJANGO_SETTINGS_MODULE'] = "project.settings"
>> *
>> *sys.path.append("/home1/propesn4/project/")*
>> *from django.core.servers.fastcgi import runfastcgi*
>> *runfastcgi(method="threaded", daemonize="false")*
>> *
>> *
>> When I make changes to my django project I preform a *touch mysite.fcgi*
>> so
>> that the fcgi agent knows there has been changes.
>> If anyone could lead me in the right direction I would really appreciate
>> it!
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/Aqyku-yyimsJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
Sent from my mobile device

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: A lots of foreign keys - Django Admin

2012-09-24 Thread rentgeeen
Thanks will look at that, what I found out is if I remove foreign keys 
fields from admin list display:

 list_display = ('client', 'category', 'subcategory', 'project', 'title', )

to 

 list_display = ('title', )

its working super fast and all works.

But I want to work it out with some FK keys in the admin...

thanks for advice

On Monday, 24 September 2012 20:00:30 UTC-4, Lachlan Musicman wrote:
>
> I'm not an expert on this matter, but I did read about list_select 
> related recently: 
>
> /path/django-docs-1.4-en/ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.list_select_related
>  
>
>
> which links to select related: 
>
> django-docs-1.4-en/ref/models/querysets.html#django.db.models.query.QuerySet.select_related
>  
>
>
> which talks about using the depth keyword to minimise the level the db 
> goes to: 
>
> "Usually, using select_related() can vastly improve performance 
> because your app can avoid many database calls. However, in situations 
> with deeply nested sets of relationships select_related() can 
> sometimes end up following "too many" relations, and can generate 
> queries so large that they end up being slow. 
>
> In these situations, you can use the depth argument to 
> select_related() to control how many "levels" of relations 
> select_related() will actually follow" 
>
> Hope this helps! 
>
> cheers 
> L. 
>
>
> On Tue, Sep 25, 2012 at 11:29 AM, rentgeeen  
> wrote: 
> > Also just found out when I remove Foreign Keys from admin.py from 
> > "list_display", it works blazing fast: 
> > 
> > 
> > class ClientAdmin(admin.ModelAdmin): 
> > 
> >list_display = ('title',) 
> > 
> > admin.site.register(Client, ClientAdmin) 
> > class CategoryAdmin(admin.ModelAdmin): 
> > 
> >list_display = ('client', 'title',) 
> > 
> > admin.site.register(Category, CategoryAdmin) 
> > class SubcategoryAdmin(admin.ModelAdmin): 
> > 
> >list_display = ('client', 'category', 'title', ) 
> > 
> > admin.site.register(Subcategory, SubcategoryAdmin) 
> > class ProjectAdmin(admin.ModelAdmin): 
> > 
> >list_display = ('client', 'category', 'subcategory', 'title', ) 
> > 
> > admin.site.register(Project, ProjectAdmin) 
> > class TypeAdmin(admin.ModelAdmin): 
> > 
> >list_display = ('client', 'title', ) 
> > 
> > admin.site.register(Type, TypeAdmin) 
> > class PageAdmin(admin.ModelAdmin): 
> >   list_display = ('client', ) 
> > 
> > admin.site.register(Page, PageAdmin) 
> > 
> > FOREIGN KEYS cannot be in list_display? How to optimize them? 
> > 
> > On Monday, 24 September 2012 19:17:45 UTC-4, rentgeeen wrote: 
> >> 
> >> Have a SQL problem, adding this model all works correctly, the problem 
> is 
> >> in ADMIN. 
> >> 
> >> When I add the data just few to each table, by clicking on TYPE & PAGE 
> in 
> >> ADMIN the page is loading so slow, installed debug_toolbar and SQL took 
> 17 
> >> seconds for the TYPE. When I tried the PAGE it gave me timeout, my 
> question 
> >> is what is wrong with my model? Is it constructed bad? 
> >> 
> >> My goal is this lets say example: 
> >> 
> >> www.example.com/audi/4doors/s4/sport/red/audi-url 
> >> 
> >> basically all 6 urls are dynamic that I would specify in the each table 
> >> and would be in the PAGE as dropdowns also in others. What is the 
> optimal 
> >> way to do that or optimize the model? 
> >> 
> >> Here is a screenshot of TYPE page loading: 
> >> 
> >> screenshot: http://cl.ly/image/2931040E0t35 
> >> 
> >> Records: 
> >> 
> >> auto_client = 3 rows 
> >> 
> >> auto_category = 2 rows 
> >> 
> >> auto_subcategory = 2 rows 
> >> 
> >> auto_project = 5 rows 
> >> 
> >> auto_type = 2 rows 
> >> 
> >> auto_page = 0 - because cliking on auto_page it times out because of 
> SQL 
> >> query. Basically togehter like 14 records thats nothing :) 
> >> 
> >> here is also mysql query in PHPmyadmin: cl.ly/image/2S320h3d0P0J 17 
> >> seconds 
> >> 
> >> Please help thanks 
> >> 
> >> 
> >> from django.db import models 
> >> 
> >> 
> >> class Client(models.Model): 
> >> title = models.CharField(max_length=100, unique=True) 
> >> def __unicode__(self): 
> >> return self.title 
> >> 
> >> class Category(models.Model): 
> >> client = models.ForeignKey(Client, to_field='title') 
> >> title = models.CharField(max_length=200, unique=True) 
> >> def __unicode__(self): 
> >> return self.title 
> >> 
> >> class Subcategory(models.Model): 
> >> client = models.ForeignKey(Client, to_field='title') 
> >> category = models.ForeignKey(Category, to_field='title') 
> >> title = models.CharField(max_length=200, unique=True) 
> >> def __unicode__(self): 
> >> return self.title 
> >> 
> >> class Project(models.Model): 
> >> client = models.ForeignKey(Client, to_field='title') 
> >> category = models.ForeignKey(Category, to_field='title') 
> >> subcategory = models.ForeignKey(Subcategory, to_field='title') 
> >> title = models.CharField(max_length=200, unique=True) 
> >>  

Re: Using email instead of username for registration and login

2012-09-24 Thread Kurtis Mullins
You could check out django-userena

On Mon, Sep 24, 2012 at 9:57 PM, Bill Beal  wrote:

> Hi all,
>
> I want to use the email address as the username for registration and
> login.  I'm using django-registration for 2-stage registration.  I'm
> looking for an easier way than what I've come up with so far.  I can modify
> registration and activation, but then django.contrib.auth.views.login has a
> 30-character limit on the username.  I'm not looking forward to making
> username act like an email address.  Any quick fixes?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/E4GTF1wAPZ8J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Using email instead of username for registration and login

2012-09-24 Thread Bill Beal
Hi all,

I want to use the email address as the username for registration and login. 
 I'm using django-registration for 2-stage registration.  I'm looking for 
an easier way than what I've come up with so far.  I can modify 
registration and activation, but then django.contrib.auth.views.login has a 
30-character limit on the username.  I'm not looking forward to making 
username act like an email address.  Any quick fixes?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/E4GTF1wAPZ8J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: A lots of foreign keys - Django Admin

2012-09-24 Thread Lachlan Musicman
I'm not an expert on this matter, but I did read about list_select
related recently:

/path/django-docs-1.4-en/ref/contrib/admin/index.html#django.contrib.admin.ModelAdmin.list_select_related

which links to select related:

django-docs-1.4-en/ref/models/querysets.html#django.db.models.query.QuerySet.select_related

which talks about using the depth keyword to minimise the level the db goes to:

"Usually, using select_related() can vastly improve performance
because your app can avoid many database calls. However, in situations
with deeply nested sets of relationships select_related() can
sometimes end up following "too many" relations, and can generate
queries so large that they end up being slow.

In these situations, you can use the depth argument to
select_related() to control how many "levels" of relations
select_related() will actually follow"

Hope this helps!

cheers
L.


On Tue, Sep 25, 2012 at 11:29 AM, rentgeeen  wrote:
> Also just found out when I remove Foreign Keys from admin.py from
> "list_display", it works blazing fast:
>
>
> class ClientAdmin(admin.ModelAdmin):
>
>list_display = ('title',)
>
> admin.site.register(Client, ClientAdmin)
> class CategoryAdmin(admin.ModelAdmin):
>
>list_display = ('client', 'title',)
>
> admin.site.register(Category, CategoryAdmin)
> class SubcategoryAdmin(admin.ModelAdmin):
>
>list_display = ('client', 'category', 'title', )
>
> admin.site.register(Subcategory, SubcategoryAdmin)
> class ProjectAdmin(admin.ModelAdmin):
>
>list_display = ('client', 'category', 'subcategory', 'title', )
>
> admin.site.register(Project, ProjectAdmin)
> class TypeAdmin(admin.ModelAdmin):
>
>list_display = ('client', 'title', )
>
> admin.site.register(Type, TypeAdmin)
> class PageAdmin(admin.ModelAdmin):
>   list_display = ('client', )
>
> admin.site.register(Page, PageAdmin)
>
> FOREIGN KEYS cannot be in list_display? How to optimize them?
>
> On Monday, 24 September 2012 19:17:45 UTC-4, rentgeeen wrote:
>>
>> Have a SQL problem, adding this model all works correctly, the problem is
>> in ADMIN.
>>
>> When I add the data just few to each table, by clicking on TYPE & PAGE in
>> ADMIN the page is loading so slow, installed debug_toolbar and SQL took 17
>> seconds for the TYPE. When I tried the PAGE it gave me timeout, my question
>> is what is wrong with my model? Is it constructed bad?
>>
>> My goal is this lets say example:
>>
>> www.example.com/audi/4doors/s4/sport/red/audi-url
>>
>> basically all 6 urls are dynamic that I would specify in the each table
>> and would be in the PAGE as dropdowns also in others. What is the optimal
>> way to do that or optimize the model?
>>
>> Here is a screenshot of TYPE page loading:
>>
>> screenshot: http://cl.ly/image/2931040E0t35
>>
>> Records:
>>
>> auto_client = 3 rows
>>
>> auto_category = 2 rows
>>
>> auto_subcategory = 2 rows
>>
>> auto_project = 5 rows
>>
>> auto_type = 2 rows
>>
>> auto_page = 0 - because cliking on auto_page it times out because of SQL
>> query. Basically togehter like 14 records thats nothing :)
>>
>> here is also mysql query in PHPmyadmin: cl.ly/image/2S320h3d0P0J 17
>> seconds
>>
>> Please help thanks
>>
>>
>> from django.db import models
>>
>>
>> class Client(models.Model):
>> title = models.CharField(max_length=100, unique=True)
>> def __unicode__(self):
>> return self.title
>>
>> class Category(models.Model):
>> client = models.ForeignKey(Client, to_field='title')
>> title = models.CharField(max_length=200, unique=True)
>> def __unicode__(self):
>> return self.title
>>
>> class Subcategory(models.Model):
>> client = models.ForeignKey(Client, to_field='title')
>> category = models.ForeignKey(Category, to_field='title')
>> title = models.CharField(max_length=200, unique=True)
>> def __unicode__(self):
>> return self.title
>>
>> class Project(models.Model):
>> client = models.ForeignKey(Client, to_field='title')
>> category = models.ForeignKey(Category, to_field='title')
>> subcategory = models.ForeignKey(Subcategory, to_field='title')
>> title = models.CharField(max_length=200, unique=True)
>> def __unicode__(self):
>> return self.title
>>
>> class Type(models.Model):
>> client = models.ForeignKey(Client, to_field='title')
>> category = models.ForeignKey(Category, to_field='title')
>> subcategory = models.ForeignKey(Subcategory, to_field='title')
>> project = models.ForeignKey(Project, to_field='title')
>> title = models.CharField(max_length=200, unique=True)
>> def __unicode__(self):
>> return self.title
>>
>> class Page(models.Model):
>> client = models.ForeignKey(Client, to_field='title')
>> category = models.ForeignKey(Category, to_field='title')
>> subcategory = models.ForeignKey(Subcategory, to_field='title')
>> project = models.ForeignKey(Project, to_field='title')
>> type = models.ForeignKey(Type, to_field='title')
>> 

Re: A lots of foreign keys - Django Admin

2012-09-24 Thread rentgeeen
Also just found out when I remove Foreign Keys from admin.py from 
"list_display", it works blazing fast:


class ClientAdmin(admin.ModelAdmin):

list_display = ('title',)

admin.site.register(Client, ClientAdmin)
 class CategoryAdmin(admin.ModelAdmin):

list_display = ('client', 'title',)

admin.site.register(Category, CategoryAdmin)
 class SubcategoryAdmin(admin.ModelAdmin):

list_display = ('client', 'category', 'title', )

admin.site.register(Subcategory, SubcategoryAdmin)
 class ProjectAdmin(admin.ModelAdmin):

list_display = ('client', 'category', 'subcategory', 'title', )

admin.site.register(Project, ProjectAdmin)
 class TypeAdmin(admin.ModelAdmin):

list_display = ('client', 'title', )

admin.site.register(Type, TypeAdmin)
 class PageAdmin(admin.ModelAdmin):
   list_display = ('client', )
   
admin.site.register(Page, PageAdmin)

FOREIGN KEYS cannot be in list_display? How to optimize them?

On Monday, 24 September 2012 19:17:45 UTC-4, rentgeeen wrote:
>
> Have a SQL problem, adding this model all works correctly, the problem is 
> in ADMIN.
>
> When I add the data just few to each table, by clicking on TYPE & PAGE in 
> ADMIN the page is loading so slow, installed debug_toolbar and SQL took 17 
> seconds for the TYPE. When I tried the PAGE it gave me timeout, my question 
> is what is wrong with my model? Is it constructed bad?
>
> My goal is this lets say example:
>
> www.example.com/audi/4doors/s4/sport/red/audi-url
>
> basically all 6 urls are dynamic that I would specify in the each table 
> and would be in the PAGE as dropdowns also in others. What is the optimal 
> way to do that or optimize the model?
>
> Here is a screenshot of TYPE page loading:
>
> screenshot: http://cl.ly/image/2931040E0t35
>
> Records:
>
> auto_client = 3 rows
>
> auto_category = 2 rows
>
> auto_subcategory = 2 rows
>
> auto_project = 5 rows
>
> auto_type = 2 rows
>
> auto_page = 0 - because cliking on auto_page it times out because of SQL 
> query. Basically togehter like 14 records thats nothing :)
>
> here is also mysql query in PHPmyadmin: cl.ly/image/2S320h3d0P0J 17 
> seconds
>
> Please help thanks
>
>
> from django.db import models
>
>
> class Client(models.Model):
> title = models.CharField(max_length=100, unique=True)
> def __unicode__(self):
> return self.title
>
> class Category(models.Model):
> client = models.ForeignKey(Client, to_field='title')
> title = models.CharField(max_length=200, unique=True)
> def __unicode__(self):
> return self.title
>
> class Subcategory(models.Model):
> client = models.ForeignKey(Client, to_field='title')
> category = models.ForeignKey(Category, to_field='title')
> title = models.CharField(max_length=200, unique=True)
> def __unicode__(self):
> return self.title
>
> class Project(models.Model):
> client = models.ForeignKey(Client, to_field='title')
> category = models.ForeignKey(Category, to_field='title')
> subcategory = models.ForeignKey(Subcategory, to_field='title')
> title = models.CharField(max_length=200, unique=True)
> def __unicode__(self):
> return self.title
>
> class Type(models.Model):
> client = models.ForeignKey(Client, to_field='title')
> category = models.ForeignKey(Category, to_field='title')
> subcategory = models.ForeignKey(Subcategory, to_field='title')
> project = models.ForeignKey(Project, to_field='title')
> title = models.CharField(max_length=200, unique=True)
> def __unicode__(self):
> return self.title
>
> class Page(models.Model):
> client = models.ForeignKey(Client, to_field='title')
> category = models.ForeignKey(Category, to_field='title')
> subcategory = models.ForeignKey(Subcategory, to_field='title')
> project = models.ForeignKey(Project, to_field='title')
> type = models.ForeignKey(Type, to_field='title')
> pageurl = models.CharField(max_length=200)
>
> By cliking on TYPE this is the SQL output that takes 17 secs, cant click on 
> last PAGE because thats so long - timed out:
>
> SELECT `auto_type`.`id`, `auto_type`.`client_id`,
> `auto_type`.`category_id`, `auto_type`.`subcategory_id`,
> `auto_type`.`project_id`, `auto_type`.`title`, `auto_client`.`id`,
> `auto_client`.`title`, `auto_category`.`id`, `auto_category`.`client_id`,
> `auto_category`.`title`, T4.`id`, T4.`title`, `auto_subcategory`.`id`,
> `auto_subcategory`.`client_id`, `auto_subcategory`.`category_id`,
> `auto_subcategory`.`title`, T6.`id`, T6.`title`, T7.`id`, T7.`client_id`,
> T7.`title`, T8.`id`, T8.`title`, `auto_project`.`id`,
> `auto_project`.`client_id`, `auto_project`.`category_id`,
> `auto_project`.`subcategory_id`, `auto_project`.`title`, T10.`id`,
> T10.`title`, T11.`id`, T11.`client_id`, T11.`title`, T12.`id`,
> T12.`title`, T13.`id`, T13.`client_id`, T13.`category_id`, T13.`title`,
> T14.`id`, T14.`title`, T15.`id`, T15.`client_id`, T15.`title`, T16.`id`,
> 

A lots of foreign keys - Django Admin

2012-09-24 Thread rentgeeen


Have a SQL problem, adding this model all works correctly, the problem is 
in ADMIN.

When I add the data just few to each table, by clicking on TYPE & PAGE in 
ADMIN the page is loading so slow, installed debug_toolbar and SQL took 17 
seconds for the TYPE. When I tried the PAGE it gave me timeout, my question 
is what is wrong with my model? Is it constructed bad?

My goal is this lets say example:

www.example.com/audi/4doors/s4/sport/red/audi-url

basically all 6 urls are dynamic that I would specify in the each table and 
would be in the PAGE as dropdowns also in others. What is the optimal way 
to do that or optimize the model?

Here is a screenshot of TYPE page loading:

screenshot: http://cl.ly/image/2931040E0t35

Records:

auto_client = 3 rows

auto_category = 2 rows

auto_subcategory = 2 rows

auto_project = 5 rows

auto_type = 2 rows

auto_page = 0 - because cliking on auto_page it times out because of SQL 
query. Basically togehter like 14 records thats nothing :)

here is also mysql query in PHPmyadmin: cl.ly/image/2S320h3d0P0J 17 seconds

Please help thanks


from django.db import models


class Client(models.Model):
title = models.CharField(max_length=100, unique=True)
def __unicode__(self):
return self.title

class Category(models.Model):
client = models.ForeignKey(Client, to_field='title')
title = models.CharField(max_length=200, unique=True)
def __unicode__(self):
return self.title

class Subcategory(models.Model):
client = models.ForeignKey(Client, to_field='title')
category = models.ForeignKey(Category, to_field='title')
title = models.CharField(max_length=200, unique=True)
def __unicode__(self):
return self.title

class Project(models.Model):
client = models.ForeignKey(Client, to_field='title')
category = models.ForeignKey(Category, to_field='title')
subcategory = models.ForeignKey(Subcategory, to_field='title')
title = models.CharField(max_length=200, unique=True)
def __unicode__(self):
return self.title

class Type(models.Model):
client = models.ForeignKey(Client, to_field='title')
category = models.ForeignKey(Category, to_field='title')
subcategory = models.ForeignKey(Subcategory, to_field='title')
project = models.ForeignKey(Project, to_field='title')
title = models.CharField(max_length=200, unique=True)
def __unicode__(self):
return self.title

class Page(models.Model):
client = models.ForeignKey(Client, to_field='title')
category = models.ForeignKey(Category, to_field='title')
subcategory = models.ForeignKey(Subcategory, to_field='title')
project = models.ForeignKey(Project, to_field='title')
type = models.ForeignKey(Type, to_field='title')
pageurl = models.CharField(max_length=200)

By cliking on TYPE this is the SQL output that takes 17 secs, cant click on 
last PAGE because thats so long - timed out:

SELECT `auto_type`.`id`, `auto_type`.`client_id`,
`auto_type`.`category_id`, `auto_type`.`subcategory_id`,
`auto_type`.`project_id`, `auto_type`.`title`, `auto_client`.`id`,
`auto_client`.`title`, `auto_category`.`id`, `auto_category`.`client_id`,
`auto_category`.`title`, T4.`id`, T4.`title`, `auto_subcategory`.`id`,
`auto_subcategory`.`client_id`, `auto_subcategory`.`category_id`,
`auto_subcategory`.`title`, T6.`id`, T6.`title`, T7.`id`, T7.`client_id`,
T7.`title`, T8.`id`, T8.`title`, `auto_project`.`id`,
`auto_project`.`client_id`, `auto_project`.`category_id`,
`auto_project`.`subcategory_id`, `auto_project`.`title`, T10.`id`,
T10.`title`, T11.`id`, T11.`client_id`, T11.`title`, T12.`id`,
T12.`title`, T13.`id`, T13.`client_id`, T13.`category_id`, T13.`title`,
T14.`id`, T14.`title`, T15.`id`, T15.`client_id`, T15.`title`, T16.`id`,
T16.`title` FROM `auto_type` INNER JOIN `auto_client` ON
(`auto_type`.`client_id` = `auto_client`.`title`) INNER JOIN
`auto_category` ON (`auto_type`.`category_id` = `auto_category`.`title`)
INNER JOIN `auto_client` T4 ON (`auto_category`.`client_id` = T4.`title`)
INNER JOIN `auto_subcategory` ON (`auto_type`.`subcategory_id` =
`auto_subcategory`.`title`) INNER JOIN `auto_client` T6 ON
(`auto_subcategory`.`client_id` = T6.`title`) INNER JOIN `auto_category`
T7 ON (`auto_subcategory`.`category_id` = T7.`title`) INNER JOIN
`auto_client` T8 ON (T7.`client_id` = T8.`title`) INNER JOIN
`auto_project` ON (`auto_type`.`project_id` = `auto_project`.`title`)
INNER JOIN `auto_client` T10 ON (`auto_project`.`client_id` = T10.`title`)
INNER JOIN `auto_category` T11 ON (`auto_project`.`category_id` =
T11.`title`) INNER JOIN `auto_client` T12 ON (T11.`client_id` =
T12.`title`) INNER JOIN `auto_subcategory` T13 ON
(`auto_project`.`subcategory_id` = T13.`title`) INNER JOIN `auto_client`
T14 ON (T13.`client_id` = T14.`title`) INNER JOIN `auto_category` T15 ON
(T13.`category_id` = T15.`title`) INNER JOIN `auto_client` T16 ON
(T15.`client_id` = T16.`title`) ORDER BY `auto_type`.`id` DESC

-- 
You received this message 

Ordering the forms within a formset? (How to override __iter__())

2012-09-24 Thread Houmie
 

deals_formset_factory = modelformset_factory(Deal, form=DealCForm, extra=1, 
can_delete=True, max_num=5)   
deals_formset = deals_formset_factory(queryset=query)

Is there a way to say the one extra form shall always be the first form no 
matter how many more instance forms are within the deals_formset?

I found this bit in the 
documentation
:

Iterating over the formset will render the forms in the order they were 
created. You can change this order by providing an alternate implementation 
for the __iter__() method.

Formsets can also be indexed into, which returns the corresponding form. If 
you override __iter__, you will need to also override __getitem__ to have 
matching behavior.

As I am still a bit new to python/django, I don't know where to begin. Is 
there any short example how __iter__() and __getitem() override have to 
look like? 

many Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/2_mvgRg0R-AJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django on Bluehost

2012-09-24 Thread Alec Taylor
You will probably crap-out with Bitbucket. Go to a cloud provider instead.

For example, Red Hat OpenShift offers their IaaS platform for free (ATM
anyway).

On Mon, Sep 24, 2012 at 2:21 PM, Zach  wrote:

> Hey everyone,
> I have recently been setting up a Django 1.4.1 project with python 2.7.2
> and MySQL. I am using fcgi to deploy my project in this environment because
> mod_wsgi is not available through bluehost. After much frustration I have
> gotten my site up to display the "it works" page. Now for some strange
> reason I can not get it away from this page. I have set up the urls.py file
> for the main project along with adding my app into the Installed_Apps
> section of the settings.py file.
> My .htaccess file is the following
> *AddHandler fcgid-script .fcgi*
> *Options +SymLinksIfOwnerMatch*
> *RewriteEngine On*
> *RewriteBase /*
> *RewriteRule ^(media/.*)$ - [L]*
> *RewriteRule ^(adminmedia/.*)$ - [L]*
> *RewriteCond %{REQUEST_URI} !(mysite.fcgi)*
> *RewriteRule ^(.*)$ mysite.fcgi/$1 [L]*
>
> My mysite.fcgi is the following
> *#!/home1/propesn4/python27/bin/python*
> *import sys, os*
> *sys.path.insert(0, "/home1/propesn4/python27")*
> *os.environ['DJANGO_SETTINGS_MODULE'] = "project.settings"
> *
> *sys.path.append("/home1/propesn4/project/")*
> *from django.core.servers.fastcgi import runfastcgi*
> *runfastcgi(method="threaded", daemonize="false")*
> *
> *
> When I make changes to my django project I preform a *touch mysite.fcgi* so
> that the fcgi agent knows there has been changes.
> If anyone could lead me in the right direction I would really appreciate
> it!
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Aqyku-yyimsJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django on Bluehost

2012-09-24 Thread carlos
I configure many project in bluehost the ways i use is put the code in dir
home for example
/home/user/projects/mysite
in /home/user/public_html/django.fcgi and .htaccesss and the content is:
django.wsgi

#!/home3/user/bin/python

import sys, os
sys.path.insert(0,"/home3/user/projects/mysite")

from flup.server.fcgi import WSGIServer

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
from django.core.handlers.wsgi import WSGIHandler
WSGIServer(WSGIHandler()).run()

and .htaccess
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteBase /
RewriteRule ^(media/.*)$ - [L]
RewriteCond %{REQUEST_URI} !(django.fcgi)
RewriteRule ^(.*)$ django.fcgi/$1 [L]


that is all.

cheer



On Sun, Sep 23, 2012 at 10:21 PM, Zach  wrote:

> Hey everyone,
> I have recently been setting up a Django 1.4.1 project with python 2.7.2
> and MySQL. I am using fcgi to deploy my project in this environment because
> mod_wsgi is not available through bluehost. After much frustration I have
> gotten my site up to display the "it works" page. Now for some strange
> reason I can not get it away from this page. I have set up the urls.py file
> for the main project along with adding my app into the Installed_Apps
> section of the settings.py file.
> My .htaccess file is the following
> *AddHandler fcgid-script .fcgi*
> *Options +SymLinksIfOwnerMatch*
> *RewriteEngine On*
> *RewriteBase /*
> *RewriteRule ^(media/.*)$ - [L]*
> *RewriteRule ^(adminmedia/.*)$ - [L]*
> *RewriteCond %{REQUEST_URI} !(mysite.fcgi)*
> *RewriteRule ^(.*)$ mysite.fcgi/$1 [L]*
>
> My mysite.fcgi is the following
> *#!/home1/propesn4/python27/bin/python*
> *import sys, os*
> *sys.path.insert(0, "/home1/propesn4/python27")*
> *os.environ['DJANGO_SETTINGS_MODULE'] = "project.settings"
> *
> *sys.path.append("/home1/propesn4/project/")*
> *from django.core.servers.fastcgi import runfastcgi*
> *runfastcgi(method="threaded", daemonize="false")*
> *
> *
> When I make changes to my django project I preform a *touch mysite.fcgi* so
> that the fcgi agent knows there has been changes.
> If anyone could lead me in the right direction I would really appreciate
> it!
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Aqyku-yyimsJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



nested inline help

2012-09-24 Thread carlos
Hi, all

 which is the best way to create nested inline in the Django admin? i use
the stable version 1.4.1

thx

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



uso do csrf

2012-09-24 Thread Carlos Andre
Olá pessoal, estou com um pequeno problema na implementação de meu projeto.
Eu consegui usar no formulário o csrf isto só com o views e templates, mas
quando adicionei o forms e usei o csrf não deu certo!
implementei do mesmo modo que anterior mas sempre aparece o erro 403!
se poderem me ajudar obrigado a todos!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Getting Started

2012-09-24 Thread Jani Tiainen
It looks like you have older version of Django installed somewhere.

You definitely should go for virtualenv it saves lot of troubles in the
long run.

On Mon, Sep 24, 2012 at 7:07 PM, Greg Lindstrom wrote:

> Hello,
>
> I am having trouble getting started using Django 1.4.1 on my Windows 7
> machine.  Everything appears to be installed (I'm running Python 2.7 and
> have been programming in Python for over 10 years; I figure it's time to
> see what all the fuss is over "the web" :-).
>
> Reading through the tutorial on the Django page (the "polls" project), I
> start a new project using "django-admin.py startproject mysite".  It
> creates a new directory -- as promised -- but I'm in trouble, already!  My
> directory structure does not match the tutorial.  I expect:
>
> mysite/manage.py
> mysite/mysite/__init__.py
> mysite/mysite/manage.py
> mysite/mysite/settings.py
> mysite/mysite/urls.py
> mysite/mysite/wgsi.py
>
> and I get all of those.  But, I also get
>
> mysite/__init__.py
> mysite/setings.py
> mysite/urls.py
>
> giving me __init__.py, settings.py, and urls.py in both the "outter" and
> "inner" directories.  I'm I in the wrong tutorial?  The initital web server
> runs and I can edi the models.py file, but when I attempt the "python
> manage.py sql polls" command the settings file die snot know about "polls"
> (I added it to the applications).
>
> I'm eager to learn Django; can someone please give me a kick in the proper
> direction?
>
> --greg
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/fkNOGLcwvpQJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [OT] I've created a Django application that allows you to view flickr galleries with minimalist design

2012-09-24 Thread Ezequiel
On Saturday, September 22, 2012 6:14:16 PM UTC-3, Mando wrote:
>
> hey Great job that's very good is there any chance you would be sharing 
> the code?
>

Thank you Mando!
Yes, I'll put the code on github after some code cleanup. It's my firt 
python/django app and for now there is nothing interesting to see :)

Ezequiel.
http://flickrock.com/mikelpierre
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/tsPL2LUKeW0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Getting Started

2012-09-24 Thread Greg Lindstrom
Hello,
 
I am having trouble getting started using Django 1.4.1 on my Windows 7 
machine.  Everything appears to be installed (I'm running Python 2.7 and 
have been programming in Python for over 10 years; I figure it's time to 
see what all the fuss is over "the web" :-).
 
Reading through the tutorial on the Django page (the "polls" project), I 
start a new project using "django-admin.py startproject mysite".  It 
creates a new directory -- as promised -- but I'm in trouble, already!  My 
directory structure does not match the tutorial.  I expect:
 
mysite/manage.py
mysite/mysite/__init__.py
mysite/mysite/manage.py
mysite/mysite/settings.py
mysite/mysite/urls.py
mysite/mysite/wgsi.py
 
and I get all of those.  But, I also get
 
mysite/__init__.py
mysite/setings.py
mysite/urls.py
 
giving me __init__.py, settings.py, and urls.py in both the "outter" and 
"inner" directories.  I'm I in the wrong tutorial?  The initital web server 
runs and I can edi the models.py file, but when I attempt the "python 
manage.py sql polls" command the settings file die snot know about "polls" 
(I added it to the applications).
 
I'm eager to learn Django; can someone please give me a kick in the proper 
direction?
 
--greg

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/fkNOGLcwvpQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: content management in django

2012-09-24 Thread Paul Backhouse
I'm not sure that I fully understand your question, but, for the static
content, django flatpages
(https://docs.djangoproject.com/en/dev/ref/contrib/flatpages/) may be
what you are looking for.

News editing would have to be handled by your news editing app!
django-cms (https://www.django-cms.org/) may be a good first port of
call. There are WYSIWYG editors which can be easily integrated, eg
TinyMCE (http://django-tinymce.readthedocs.org/en/latest/index.html)




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: save() got an unexpected keyword argument 'force_insert'

2012-09-24 Thread Joel Goldstick
On Mon, Sep 24, 2012 at 12:51 AM, Laxmikant Gurnalkar
 wrote:
>
> Hi guys,
> Anybody knows why I'm at this stage ?
> Group.objects.using('db2').get_or_create(name='Maintenance Admin')
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line
> 383, in get_or_create
> obj.save(force_insert=True, using=self.db)
> TypeError: save() got an unexpected keyword argument 'force_insert'
>
>
> I'm getting this error on creating a new group on mydatabase2
> Not getting the exact reason behind this ...
> plz help ...
>
> Thanks in Advance
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/4Rosfupipe4J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

This is the first google entry for your error message:

https://code.djangoproject.com/ticket/8662

It looks like the docs were wrong, but they have been fixed.

-- 
Joel Goldstick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: content management in django

2012-09-24 Thread Jonas Geiregat
I would advise you to take a look at feincms, it has exactly what you need.


> Hello,
> 
> I'm converting a static website to a Django application and I need a piece of 
> advice from more experienced people what is the right way to store content.
> The website will have some static pages like "about","contacts", etc. and a 
> dynamic content like news and photo galleries that should be updated from the 
> web interface. So my best guess is that static pages should be implemented 
> using templates and news should be stored in a database. I believe this is a 
> common task so is there a better way to solve it? And how is news editing 
> implemented? Does the editor create an html in some html-editor and then 
> paste it into the database, or is a web-based WYSIWYG-editor usually used?
> 
> Thank you!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/_wtR7b_RXKYJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Can I simply disable the CSRF? crazy

2012-09-24 Thread Nicolas Patry
If you are access to the form (meaning you are in the dom), and if you 
don't mind using jQuery, there is the even simpler:


> $.post("/some/url", $("#someform").serialize(), function(data){
>   // Do whatever with data
> })


$("#someform").serialize() automatically adds the crsf_token which should 
be contained in your form. This makes a lot easier to validate your form 
via AJAX.

Cheers,
Nicolas Patry

On Monday, September 24, 2012 4:00:02 PM UTC+2, jondykeman wrote:
>
> +1 For doing it right from the beginning. 
>
> I was tempted to disable when trying to deal with AJAX especially early 
> on. Below is some code with jQuery so that you won't need to manually feed 
> the token through your AJAX.
>
>