Re: ModelForm based on User allows any username without checking

2012-04-09 Thread Pavan Verma
I went through django/contrib/auth/models.py to check the definition
of the User model. I don't see this file defining any restrictions on
what a username can be. So, I think the form is the place (and
possibly the only place) which defines and enforces restrictions on
what the username can be.

Interestingly, the help_text for User.username is the following:

help_text=_('Required. 30 characters or fewer. Letters,
numbers and '
'@/./+/-/_ characters'))

But this restriction in neither defined nor enforced in the User model
class.


> isn't it supposed to be automatic, coming from the restrictions of the model 
> since it's a ModelForm?

I didn't understand this comment. Why would you think ModelForm has
anything to do with it? As in, why would ModelForm know anything about
User.username.


thanks,
-pavan


On Apr 10, 12:53 am, Bastian  wrote:
> Yes that's what I ended up doing but isn't it supposed to be automatic,
> coming from the restrictions of the model since it's a ModelForm?
>
> On Thursday, April 5, 2012 7:51:14 PM UTC+2, Pavan Verma wrote:
>
> > Hi Bastian,
> > you need to define the restrictions on the username field. It can be
> > done by including the code below inside usernameForm. This code is
> > from django/contrib/auth/forms.py -> UserCreationForm, you can refer
> > it to understand further.
>
> >     username = forms.RegexField(label="Username", max_length=30,
> >         regex=r'^[\w.@+-]+$',
> >         help_text="Required. 30 characters or fewer. Letters, digits
> > and "
> >                       "@/./+/-/_ only.",
> >         error_messages={
> >             'invalid': "This value may contain only letters, numbers
> > and "
> >                          "@/./+/-/_ characters."})
>
> > thanks,
> > -pavan
>
> > On Apr 4, 7:36 pm, Bastian  wrote:
> > > Hi,
>
> > > I have a form that asks the registering user to choose a username. That
> > > form is a ModelForm based on the django.contrib.auth.models Users:
>
> > > class usernameForm(forms.ModelForm):
> > >     class Meta:
> > >         model = User
> > >         fields = ('username', )
>
> > > The strange thing is that when it appears on the page it comes with the
> > > warning that says no more than 30 characters... but it actually does not
> > > check anything. I tried to enter whatever username, with spaces and ()
> > and
> > > in the view when I ask if form.is_valid() it returns True all the time!
>
> > > Obviously this must be a mistake on my side somewhere but on such a
> > simple
> > > setup I don't see where I am wrong, any idea welcome.

-- 
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.



Force logout a user in signed cookie mode

2012-04-09 Thread Cherian
Hi all,

In the signed cookie mode is it possible for me force logout an
account?
Say I login from two places, and I need to logout my account from the
one access I forgot to logout in a public internet café. Can I do that
from my current login?
>From my testing I could not do this. But there might be an override
key I am missing. Also it’s quite possible that I since there is no
session key on the server side to reset, this functionality might not
be there.
Can someone help?

-Cherian

-- 
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: adding html5 field attributes to a model form

2012-04-09 Thread BlackKnight
Custom widget would be enough


in your forms.py

from django.forms import Input

class EmailInput(Input):
input_type = 'email'

class AddressForm(ModelForm):
contact_email = forms.CharField(widget=EmailInput)

On Apr 9, 11:37 pm, Lee Hinde  wrote:
> Thanks. I'll check that out.
>
> On Apr 9, 2012, at 7:32 PM, creecode wrote:
>
>
>
>
>
>
>
> > Ah I see.  I haven't looked deeper in the code I'd guess the type is being 
> > set after you set it deeper in the machinery based on field class?  Perhaps 
> > a custom field could accomplish your goal?
>
> > On Monday, April 9, 2012 7:17:56 PM UTC-7, Lee Hinde wrote:
>
> > Thanks for the response, Creecode,
>
> > I've used that for adding class attributes just fine, but in this case I'm 
> > trying to change the field 'type' and that's what doesn't seem to work.
>
> > Toodle-l.
> > creecode

-- 
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.



Django admin - How to disable "Delete each record" option for all the models at once

2012-04-09 Thread girish shabadimath
Hi all,
Is there a way to remove "Delete each record" option for all the models in
admin?
We have option to disable delete_selected action using -
"admin.site.disable_action('delete_selected')". Looking for same feature to
do on each record (other then altering ModelAdmin's has_delete_permission
method)
-- 
Girish M S

-- 
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.



YAML Fixture is not working. DeserializationError

2012-04-09 Thread abisson
Good afternoon,

I am trying to do: python manage.py syncdb and I always get this error:

Problem installing fixture '.../translations/fixtures/initial_data.yaml': 
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/commands/loaddata.py",
 
line 190, in handle
for obj in objects:
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/serializers/pyyaml.py",
 
line 62, in Deserializer
raise DeserializationError(e)
DeserializationError: mapping values are not allowed here
  in "/.../translations/fixtures/initial_data.yaml", line 2, column 7

*Model:*

from django.db import models

class Language(models.Model):
code = models.CharField(max_length=2)
display_name = models.CharField(max_length=16, blank=False)

def __unicode__(self):
return self.display_name


*Fixture:*

- model: translations.Language
pk: 1
fields:
code: fr
display_name: Français
- model: translations.Language
pk: 2
fields:
code: en
display_name: English


I am running PyYAML 3.10! Any ideas?! :(

Thanks a lot,

Antoine


-- 
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/-/fBwygK-aD9oJ.
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 tutorial

2012-04-09 Thread Ed McLaughlin
_mysql.so is in there. When I try using sqlite I get this:

Eds-MacBook-Air:mysite3 edmclaugh76$ python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File "/Library/Python/2.7/site-packages/django/core/management/
__init__.py", line 443, in execute_from_command_line
utility.execute()
  File "/Library/Python/2.7/site-packages/django/core/management/
__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.7/site-packages/django/core/management/
base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/Library/Python/2.7/site-packages/django/core/management/
base.py", line 232, in execute
output = self.handle(*args, **options)
  File "/Library/Python/2.7/site-packages/django/core/management/
base.py", line 371, in handle
return self.handle_noargs(**options)
  File "/Library/Python/2.7/site-packages/django/core/management/
commands/syncdb.py", line 57, in handle_noargs
cursor = connection.cursor()
  File "/Library/Python/2.7/site-packages/django/db/backends/
__init__.py", line 306, in cursor
cursor = self.make_debug_cursor(self._cursor())
  File "/Library/Python/2.7/site-packages/django/db/backends/sqlite3/
base.py", line 281, in _cursor
self._sqlite_create_connection()
  File "/Library/Python/2.7/site-packages/django/db/backends/sqlite3/
base.py", line 271, in _sqlite_create_connection
self.connection = Database.connect(**kwargs)
sqlite3.OperationalError: unable to open database file


Any ideas? I really appreciate the help!

On Apr 9, 10:16 pm, Mario Gudelj  wrote:
> Go to 
> /Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.7-inte 
> l.egg/
> on your Mac and see if _mysql.so is int there. You may need to re-install
> MySQL_python connector. Maybe this can 
> helphttp://www.brambraakman.com/blog/comments/installing_mysql_python_mys...
>
> Otherwise, you can always use SQlite for dev environment until you go to
> production. I find it a lot easier to manage.
>
> On 10 April 2012 10:54, Ed McLaughlin  wrote:
>
>
>
>
>
>
>
> > Hello! I am working through the Django tutorial (
> >https://docs.djangoproject.com/en/1.4/intro/tutorial01/) and I have
> > hit a roadblock in the 'database setup' portion of part 1. When I
> > enter the command 'python manage.py syncdb' I get the error below. I
> > believe I properly installed MySQL Community Server and mysqldb
> > Any help would be GREATLY appreciated.
>
> > Eds-MacBook-Air:mysite edmclaugh76$ python manage.py syncdb
> > Traceback (most recent call last):
> >  File "manage.py", line 10, in 
> >    execute_from_command_line(sys.argv)
> >  File "/Library/Python/2.7/site-packages/django/core/management/
> > __init__.py", line 443, in execute_from_command_line
> >    utility.execute()
> >  File "/Library/Python/2.7/site-packages/django/core/management/
> > __init__.py", line 382, in execute
> >    self.fetch_command(subcommand).run_from_argv(self.argv)
> >  File "/Library/Python/2.7/site-packages/django/core/management/
> > __init__.py", line 261, in fetch_command
> >    klass = load_command_class(app_name, subcommand)
> >  File "/Library/Python/2.7/site-packages/django/core/management/
> > __init__.py", line 69, in load_command_class
> >    module = import_module('%s.management.commands.%s' % (app_name,
> > name))
> >  File "/Library/Python/2.7/site-packages/django/utils/importlib.py",
> > line 35, in import_module
> >    __import__(name)
> >  File "/Library/Python/2.7/site-packages/django/core/management/
> > commands/syncdb.py", line 8, in 
> >    from django.core.management.sql import custom_sql_for_model,
> > emit_post_sync_signal
> >  File "/Library/Python/2.7/site-packages/django/core/management/
> > sql.py", line 6, in 
> >    from django.db import models
> >  File "/Library/Python/2.7/site-packages/django/db/__init__.py", line
> > 40, in 
> >    backend = load_backend(connection.settings_dict['ENGINE'])
> >  File "/Library/Python/2.7/site-packages/django/db/__init__.py", line
> > 34, in __getattr__
> >    return getattr(connections[DEFAULT_DB_ALIAS], item)
> >  File "/Library/Python/2.7/site-packages/django/db/utils.py", line
> > 92, in __getitem__
> >    backend = load_backend(db['ENGINE'])
> >  File "/Library/Python/2.7/site-packages/django/db/utils.py", line
> > 24, in load_backend
> >    return import_module('.base', backend_name)
> >  File "/Library/Python/2.7/site-packages/django/utils/importlib.py",
> > line 35, in import_module
> >    __import__(name)
> >  File "/Library/Python/2.7/site-packages/django/db/backends/mysql/
> > base.py", line 16, in 
> >    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> > django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> > module: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.3-
> > py2.7-macosx-10.7-intel.egg/_mysql.so, 2): Library not loaded:
> >

Re: adding html5 field attributes to a model form

2012-04-09 Thread Lee Hinde
Thanks. I'll check that out.

On Apr 9, 2012, at 7:32 PM, creecode wrote:

> Ah I see.  I haven't looked deeper in the code I'd guess the type is being 
> set after you set it deeper in the machinery based on field class?  Perhaps a 
> custom field could accomplish your goal?
> 
> On Monday, April 9, 2012 7:17:56 PM UTC-7, Lee Hinde wrote:
> 
> Thanks for the response, Creecode,
> 
> I've used that for adding class attributes just fine, but in this case I'm 
> trying to change the field 'type' and that's what doesn't seem to work.
> 
> Toodle-l.
> creecode
> 
> 

-- 
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: adding html5 field attributes to a model form

2012-04-09 Thread creecode
Ah I see.  I haven't looked deeper in the code I'd guess the type is being 
set after you set it deeper in the machinery based on field class?  Perhaps 
a custom field could accomplish your goal?

On Monday, April 9, 2012 7:17:56 PM UTC-7, Lee Hinde wrote:
>
>
> Thanks for the response, Creecode,
>
> I've used that for adding class attributes just fine, but in this case I'm 
> trying to change the field 'type' and that's what doesn't seem to work.
>

Toodle-l.
creecode

-- 
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/-/x1LoD_TXVwwJ.
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: adding html5 field attributes to a model form

2012-04-09 Thread Lee Hinde

On Apr 9, 2012, at 6:53 PM, creecode wrote:

> Hello Lee,
> 
> On Monday, April 9, 2012 6:14:08 PM UTC-7, Lee Hinde wrote:
> 
> I'm trying to edit the field type in a form that is using the html5 doctype. 
> I've tried two ways:
> 
> Neither works. 
> 
> Am I looking in the wrong place?
> 
> I use both those techniques and they work great for me.  I've use them on 
> many forms for a project I'm working on now.  Some examples from my code...
> 
> brand_name = forms.CharField ( label = _( 'Brand Name' ), max_length = 
> 128,
> widget = forms.TextInput ( attrs = { 'class' : 'span6', 'placeholder' 
> :
> 'enter brand name', } ) )
> 
> ...and...
> 
> def __init__ ( self, *args, **kwargs ):
> 
> super ( AmountPerServing1Form, self ).__init__ ( *args, **kwargs )
> 
> for key in self.fields:
> 
> field = self.fields [ key ]
> 
> field.widget.attrs [ 'class' ] = 'span7'
> 

Thanks for the response, Creecode,

I've used that for adding class attributes just fine, but in this case I'm 
trying to change the field 'type' and that's what doesn't seem to work.


> I don't see anything wrong with your syntax.  Have you tried the usual 
> things?  Make sure you save the file your're editing, restart the server, 
> etc?  And still the form didn't show up with your changes?
> 
> Could there be some browser or other caching going on between you and the 
> server?
> 
> Are you sub-classing those forms for using them directly?
> 
> Toodle-lo
> creecode
> 



-- 
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 tutorial

2012-04-09 Thread Mario Gudelj
Go to 
/Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg/
on your Mac and see if _mysql.so is int there. You may need to re-install
MySQL_python connector. Maybe this can help
http://www.brambraakman.com/blog/comments/installing_mysql_python_mysqldb_on_snow_leopard_mac_os_x_106/

Otherwise, you can always use SQlite for dev environment until you go to
production. I find it a lot easier to manage.

On 10 April 2012 10:54, Ed McLaughlin  wrote:

> Hello! I am working through the Django tutorial (
> https://docs.djangoproject.com/en/1.4/intro/tutorial01/ ) and I have
> hit a roadblock in the 'database setup' portion of part 1. When I
> enter the command 'python manage.py syncdb' I get the error below. I
> believe I properly installed MySQL Community Server and mysqldb
> Any help would be GREATLY appreciated.
>
> Eds-MacBook-Air:mysite edmclaugh76$ python manage.py syncdb
> Traceback (most recent call last):
>  File "manage.py", line 10, in 
>execute_from_command_line(sys.argv)
>  File "/Library/Python/2.7/site-packages/django/core/management/
> __init__.py", line 443, in execute_from_command_line
>utility.execute()
>  File "/Library/Python/2.7/site-packages/django/core/management/
> __init__.py", line 382, in execute
>self.fetch_command(subcommand).run_from_argv(self.argv)
>  File "/Library/Python/2.7/site-packages/django/core/management/
> __init__.py", line 261, in fetch_command
>klass = load_command_class(app_name, subcommand)
>  File "/Library/Python/2.7/site-packages/django/core/management/
> __init__.py", line 69, in load_command_class
>module = import_module('%s.management.commands.%s' % (app_name,
> name))
>  File "/Library/Python/2.7/site-packages/django/utils/importlib.py",
> line 35, in import_module
>__import__(name)
>  File "/Library/Python/2.7/site-packages/django/core/management/
> commands/syncdb.py", line 8, in 
>from django.core.management.sql import custom_sql_for_model,
> emit_post_sync_signal
>  File "/Library/Python/2.7/site-packages/django/core/management/
> sql.py", line 6, in 
>from django.db import models
>  File "/Library/Python/2.7/site-packages/django/db/__init__.py", line
> 40, in 
>backend = load_backend(connection.settings_dict['ENGINE'])
>  File "/Library/Python/2.7/site-packages/django/db/__init__.py", line
> 34, in __getattr__
>return getattr(connections[DEFAULT_DB_ALIAS], item)
>  File "/Library/Python/2.7/site-packages/django/db/utils.py", line
> 92, in __getitem__
>backend = load_backend(db['ENGINE'])
>  File "/Library/Python/2.7/site-packages/django/db/utils.py", line
> 24, in load_backend
>return import_module('.base', backend_name)
>  File "/Library/Python/2.7/site-packages/django/utils/importlib.py",
> line 35, in import_module
>__import__(name)
>  File "/Library/Python/2.7/site-packages/django/db/backends/mysql/
> base.py", line 16, in 
>raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.3-
> py2.7-macosx-10.7-intel.egg/_mysql.so, 2): Library not loaded:
> libmysqlclient.18.dylib
>  Referenced from: /Library/Python/2.7/site-packages/
> MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg/_mysql.so
>  Reason: image not found
> Eds-MacBook-Air:mysite edmclaugh76$
>
> Thanks!!!
>
> --
> 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.
>
>

-- 
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.



Django tutorial

2012-04-09 Thread Ed McLaughlin
Hello! I am working through the Django tutorial (
https://docs.djangoproject.com/en/1.4/intro/tutorial01/ ) and I have
hit a roadblock in the 'database setup' portion of part 1. When I
enter the command 'python manage.py syncdb' I get the error below. I
believe I properly installed MySQL Community Server and mysqldb
Any help would be GREATLY appreciated.

Eds-MacBook-Air:mysite edmclaugh76$ python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File "/Library/Python/2.7/site-packages/django/core/management/
__init__.py", line 443, in execute_from_command_line
utility.execute()
  File "/Library/Python/2.7/site-packages/django/core/management/
__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.7/site-packages/django/core/management/
__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
  File "/Library/Python/2.7/site-packages/django/core/management/
__init__.py", line 69, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name,
name))
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py",
line 35, in import_module
__import__(name)
  File "/Library/Python/2.7/site-packages/django/core/management/
commands/syncdb.py", line 8, in 
from django.core.management.sql import custom_sql_for_model,
emit_post_sync_signal
  File "/Library/Python/2.7/site-packages/django/core/management/
sql.py", line 6, in 
from django.db import models
  File "/Library/Python/2.7/site-packages/django/db/__init__.py", line
40, in 
backend = load_backend(connection.settings_dict['ENGINE'])
  File "/Library/Python/2.7/site-packages/django/db/__init__.py", line
34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/Library/Python/2.7/site-packages/django/db/utils.py", line
92, in __getitem__
backend = load_backend(db['ENGINE'])
  File "/Library/Python/2.7/site-packages/django/db/utils.py", line
24, in load_backend
return import_module('.base', backend_name)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py",
line 35, in import_module
__import__(name)
  File "/Library/Python/2.7/site-packages/django/db/backends/mysql/
base.py", line 16, in 
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
module: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.3-
py2.7-macosx-10.7-intel.egg/_mysql.so, 2): Library not loaded:
libmysqlclient.18.dylib
  Referenced from: /Library/Python/2.7/site-packages/
MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg/_mysql.so
  Reason: image not found
Eds-MacBook-Air:mysite edmclaugh76$

Thanks!!!

-- 
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: adding html5 field attributes to a model form

2012-04-09 Thread creecode
Hello Lee,

On Monday, April 9, 2012 6:14:08 PM UTC-7, Lee Hinde wrote:

I'm trying to edit the field type in a form that is using the html5 
> doctype. I've tried two ways:
>
> Neither works. 
>
> Am I looking in the wrong place?
>

I use both those techniques and they work great for me.  I've use them on 
many forms for a project I'm working on now.  Some examples from my code...

brand_name = forms.CharField ( label = _( 'Brand Name' ), max_length = 
128,
widget = forms.TextInput ( attrs = { 'class' : 'span6', 
'placeholder' :
'enter brand name', } ) )

...and...

def __init__ ( self, *args, **kwargs ):

super ( AmountPerServing1Form, self ).__init__ ( *args, **kwargs )

for key in self.fields:

field = self.fields [ key ]

field.widget.attrs [ 'class' ] = 'span7'

I don't see anything wrong with your syntax.  Have you tried the usual 
things?  Make sure you save the file your're editing, restart the server, 
etc?  And still the form didn't show up with your changes?

Could there be some browser or other caching going on between you and the 
server?

Are you sub-classing those forms for using them directly?

Toodle-lo
creecode

-- 
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/-/k6DJ30Z_ZWsJ.
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.



adding html5 field attributes to a model form

2012-04-09 Thread Lee Hinde
I'm trying to edit the field type in a form that is using the html5 
doctype. I've tried two ways:

class AddressForm(ModelForm):
contact_email = forms.TextInput(attrs={'type': 'email'})

and 

class AddressForm(ModelForm):
def __init__(self, *args, **kwargs):
super(AddressForm, self).__init__(*args, **kwargs)
self.fields['contact_email'].widget.attrs["type"] = 'email'

Neither works. 

Am I looking in the wrong place?


-- 
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/-/wpLL-DHz5fQJ.
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: Much the same code, different businesses

2012-04-09 Thread Nick Mellor
Doug,

Many thanks for your response. I'm leaning towards your 3rd option,
initially using subdomains rather than full domain names for each
business.

Best wishes,

Nick

On Mar 27, 10:48 am, Doug Ballance  wrote:
> There are a few choices that I'm familiar with.
>
> 1) Create a separate project/settings file for each of your stores,
> overriding templates as needed by placing assigning a template path
> for the project.  I think this is pretty much the recommended way to
> do things, especially if the number of sites are reasonably small.  It
> offers great data isolation (using a different database for each), and
> it allows you to use all kinds of django apps and plugins.  For mass
> hosting, this is going to require more resources since you'll have
> workers for each site rather than a shared pool of workers.
>
> 2) Do some 'strange things', such as changing database or schema on a
> per-request basis using threadlocals and a middleware. This offers
> much of the capability of 1, but there may be compatibility issues
> (module level caching for example) and tricky foreignkey
> restrictions.    http://tidbids.posterous.com/saas-with-django-and-postgresql
> That post, and some of the comments will probably be of interest to
> you.
>
> 2) Do your own multi-tenant user setup.  There isn't anything built in
> for this, and as a result you lose a lot of the built in functionality
> like the admin as well as any hope of using user aware third-party
> apps.  This is the way I ended up going.  We use a custom template
> loader/middleware to check for site specific templates, site specific
> caching, and a custom siteuser/site framework.  All data is stored in
> the same database, with ownership linked back to the custom siteusers/
> sites and permission checking related to the views.  We keep the
> django user and sites framework as well, but use it/the admin for
> administration use only.  This is the most complicated path, but I
> think the advantages make it worth it for a large number of sites. We
> can add sites using an admin interface, and use fewer resources since
> caching and workers are all shared.

-- 
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: Advice on installing Django in a fresh OSX Lion machine

2012-04-09 Thread Paulo
So I follow your advice and did sudo easy_install pip and sudo pip install 
virtualenvwrapper.
Then I instaled homebrew and wget as mentioned in the site. And then I hit 
the wall. 
When I tried to python setup.py install --prefix=~/.local the return was a 
error:

Before install bootstrap.
Scanning installed packages
Setuptools installation detected at 
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Not patching, --root or --prefix is installing Distribute in another 
location
running install
Checking .pth file support in 
/Users/Paulo/.local/lib/python2.7/site-packages/
/usr/bin/python -E -c pass
TEST FAILED: /Users/Paulo/.local/lib/python2.7/site-packages/ does NOT 
support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/Users/Paulo/.local/lib/python2.7/site-packages/

and your PYTHONPATH environment variable currently contains:

''

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable.  (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:

  
http://packages.python.org/distribute/easy_install.html#custom-installation-locations

Please make the appropriate changes for your system and try again.

I dont know how to fix it. The site's tutorial doesn't mention any path 
untill that point and I am very lost here.
Any help please?
Thanks in advance


Thanks for the reply.
>
> Segunda-feira, 9 de Abril de 2012 16:23:09 UTC+1, shacker escreveu:
>>
>> On Monday, April 9, 2012 5:19:28 AM UTC-7, Paulo wrote:
>>>
>>> Im new both to Python and Django and I'm afraid of messing thins up 
>>> before I even start. 
>>> Lion ships with Python 2.7.1  but I see that 2.7.2 is available in the 
>>> official site. Should I download .dmg file from the site to update to 
>>> version 2.7.2? 
>>>
>>
>> I personally wouldn't bother messing with the default python for such a 
>> minor update on your local dev machine. Your steps should be:
>>
>> sudo easy_install pip
>> sudo pip install virtualenvwrapper
>>   [Follow its post-setup instructions, then]
>> mkvirtualenv yoursite
>> workon yoursite
>> pip install django
>>
>>
>>

-- 
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/-/Zd4YWkTYl3MJ.
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: Upgrading django on a mac

2012-04-09 Thread Larry Martell
On Mon, Apr 9, 2012 at 4:53 PM, William Deegan  wrote:
> Larry,
>
> Why not use virtualenv? Or buildout?

I am not familiar with either one of those. I use my mac for
development for a specific client. I need my environment to match
their's as much as possible. They had been using -r 13034 from SVN and
they just upgraded to 1.4 from git. So I  wanted to do the same.


> On Apr 7, 2012, at 3:02 PM, Jonathan Baker wrote:
>
> Ah, good to know. Apologies, but I glanced over your original code to
> quickly and thought you renamed the directory. Glad it worked out.
>
> On Sat, Apr 7, 2012 at 3:54 PM, Larry Martell 
> wrote:
>>
>> On Sat, Apr 7, 2012 at 3:46 PM, Jonathan Baker
>>  wrote:
>> > I'm guessing that your $PATH is configured to look for django in it's
>> > old
>> > location, and not the new one.
>>
>> No it's not that (the new location is the same as the old). But I
>> figured it out - the django python package is apparently a
>> subdirectory of the git repository. I did this:
>>
>> mv django django.git
>> ln -s django.git/django django
>>
>> And now it's finding it.
>>
>>
>> >
>> > On Sat, Apr 7, 2012 at 3:33 PM, Larry Martell 
>> > wrote:
>> >>
>> >> I'm on a mac, running Mac OS X Version 10.5.8 (Leopard). I was running
>> >> django -r 13034 that I got from SVN. I am trying to upgrade to 1.4
>> >> from git. After I upgrade, python can no longer find django. Here's
>> >> what I did:
>> >>
>> >> $ cd /usr/local/lib/python2.6/dist-packages
>> >> $ sudo mv django/ django-13034
>> >> $ sudo git clone https://github.com/django/django.git django
>> >> $ python
>> >> Python 2.6.7 (r267:88850, Jan 11 2012, 06:42:34)
>> >> [GCC 4.0.1 (Apple Inc. build 5490)] on darwin
>> >> Type "help", "copyright", "credits" or "license" for more information.
>> >> >>> import django
>> >> Traceback (most recent call last):
>> >>  File "", line 1, in 
>> >> ImportError: No module named django
>> >>
>> >> If I switch back:
>> >>
>> >> $ sudo mv django django1.4
>> >> $ sudo mv django-13034/ django
>> >>
>> >> It again finds it:
>> >>
>> >> $ python
>> >> Python 2.6.7 (r267:88850, Jan 11 2012, 06:42:34)
>> >> [GCC 4.0.1 (Apple Inc. build 5490)] on darwin
>> >> Type "help", "copyright", "credits" or "license" for more information.
>> >> >>> import django
>> >> >>> ^D
>> >>
>> >> Anyone know what's wrong?
>> >>
>> >> --
>> >> 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.
>> >>
>> >
>> >
>> >
>> > --
>> > Jonathan D. Baker
>> > Web Developer
>> > http://jonathandbaker.com
>> > 303.257.4144
>> >
>> > --
>> > 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.
>>
>> --
>> 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.
>>
>
>
>
> --
> Jonathan D. Baker
> Web Developer
> http://jonathandbaker.com
> 303.257.4144
>
> --
> 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.
>
>
> --
> 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.

-- 
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: Upgrading django on a mac

2012-04-09 Thread William Deegan
Larry,

Why not use virtualenv? Or buildout?

-Bill
On Apr 7, 2012, at 3:02 PM, Jonathan Baker wrote:

> Ah, good to know. Apologies, but I glanced over your original code to quickly 
> and thought you renamed the directory. Glad it worked out.
> 
> On Sat, Apr 7, 2012 at 3:54 PM, Larry Martell  wrote:
> On Sat, Apr 7, 2012 at 3:46 PM, Jonathan Baker
>  wrote:
> > I'm guessing that your $PATH is configured to look for django in it's old
> > location, and not the new one.
> 
> No it's not that (the new location is the same as the old). But I
> figured it out - the django python package is apparently a
> subdirectory of the git repository. I did this:
> 
> mv django django.git
> ln -s django.git/django django
> 
> And now it's finding it.
> 
> 
> >
> > On Sat, Apr 7, 2012 at 3:33 PM, Larry Martell 
> > wrote:
> >>
> >> I'm on a mac, running Mac OS X Version 10.5.8 (Leopard). I was running
> >> django -r 13034 that I got from SVN. I am trying to upgrade to 1.4
> >> from git. After I upgrade, python can no longer find django. Here's
> >> what I did:
> >>
> >> $ cd /usr/local/lib/python2.6/dist-packages
> >> $ sudo mv django/ django-13034
> >> $ sudo git clone https://github.com/django/django.git django
> >> $ python
> >> Python 2.6.7 (r267:88850, Jan 11 2012, 06:42:34)
> >> [GCC 4.0.1 (Apple Inc. build 5490)] on darwin
> >> Type "help", "copyright", "credits" or "license" for more information.
> >> >>> import django
> >> Traceback (most recent call last):
> >>  File "", line 1, in 
> >> ImportError: No module named django
> >>
> >> If I switch back:
> >>
> >> $ sudo mv django django1.4
> >> $ sudo mv django-13034/ django
> >>
> >> It again finds it:
> >>
> >> $ python
> >> Python 2.6.7 (r267:88850, Jan 11 2012, 06:42:34)
> >> [GCC 4.0.1 (Apple Inc. build 5490)] on darwin
> >> Type "help", "copyright", "credits" or "license" for more information.
> >> >>> import django
> >> >>> ^D
> >>
> >> Anyone know what's wrong?
> >>
> >> --
> >> 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.
> >>
> >
> >
> >
> > --
> > Jonathan D. Baker
> > Web Developer
> > http://jonathandbaker.com
> > 303.257.4144
> >
> > --
> > 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.
> 
> --
> 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.
> 
> 
> 
> 
> -- 
> Jonathan D. Baker
> Web Developer
> http://jonathandbaker.com
> 303.257.4144
> 
> -- 
> 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.

-- 
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: Advice on installing Django in a fresh OSX Lion machine

2012-04-09 Thread Paulo
Thanks for the reply.

Segunda-feira, 9 de Abril de 2012 16:23:09 UTC+1, shacker escreveu:
>
> On Monday, April 9, 2012 5:19:28 AM UTC-7, Paulo wrote:
>>
>> Im new both to Python and Django and I'm afraid of messing thins up 
>> before I even start. 
>> Lion ships with Python 2.7.1  but I see that 2.7.2 is available in the 
>> official site. Should I download .dmg file from the site to update to 
>> version 2.7.2? 
>>
>
> I personally wouldn't bother messing with the default python for such a 
> minor update on your local dev machine. Your steps should be:
>
> sudo easy_install pip
> sudo pip install virtualenvwrapper
>   [Follow its post-setup instructions, then]
> mkvirtualenv yoursite
> workon yoursite
> pip install django
>
>
>

-- 
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/-/lKbDoVUkJ8sJ.
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: ModelForm based on User allows any username without checking

2012-04-09 Thread Bastian
Yes that's what I ended up doing but isn't it supposed to be automatic, 
coming from the restrictions of the model since it's a ModelForm?

On Thursday, April 5, 2012 7:51:14 PM UTC+2, Pavan Verma wrote:
>
> Hi Bastian, 
> you need to define the restrictions on the username field. It can be 
> done by including the code below inside usernameForm. This code is 
> from django/contrib/auth/forms.py -> UserCreationForm, you can refer 
> it to understand further. 
>
> username = forms.RegexField(label="Username", max_length=30, 
> regex=r'^[\w.@+-]+$', 
> help_text="Required. 30 characters or fewer. Letters, digits 
> and " 
>   "@/./+/-/_ only.", 
> error_messages={ 
> 'invalid': "This value may contain only letters, numbers 
> and " 
>  "@/./+/-/_ characters."}) 
>
> thanks, 
> -pavan 
>
> On Apr 4, 7:36 pm, Bastian  wrote: 
> > Hi, 
> > 
> > I have a form that asks the registering user to choose a username. That 
> > form is a ModelForm based on the django.contrib.auth.models Users: 
> > 
> > class usernameForm(forms.ModelForm): 
> > class Meta: 
> > model = User 
> > fields = ('username', ) 
> > 
> > The strange thing is that when it appears on the page it comes with the 
> > warning that says no more than 30 characters... but it actually does not 
> > check anything. I tried to enter whatever username, with spaces and () 
> and 
> > in the view when I ask if form.is_valid() it returns True all the time! 
> > 
> > Obviously this must be a mistake on my side somewhere but on such a 
> simple 
> > setup I don't see where I am wrong, any idea welcome.

-- 
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/-/Ab9goWGkzSAJ.
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: How to install django-mce?

2012-04-09 Thread Roy Smith


On Sunday, April 8, 2012 4:34:26 PM UTC-4, Roy Smith wrote:
>
> I'm trying to install django-tinymce 1.5.1b2 into a django-1.3 site.  The 
> installation instructions say:
>
> "Copy the jscripts/tiny_mce directory from the TinyMCE distribution into 
> a directory named js in your media root. You can override the location in 
> your settings (see below)."
>
> But there is no such directory. There are:
>
> ./media/tiny_mce/plugins/preview/jscripts
> ./static/tiny_mce/plugins/preview/jscripts
>
> directories, but no tiny_mce directory under those.  Even odder, the media 
> and static trees look like identical copies of each other.  Also, it seems 
> like the javascript files should go under my static directory, not my media 
> directory.  I'm guessing the installation directions predate django 1.3 and 
> collectstatic?
>
> So, what exactly am I supposed to install where?
>

On Sunday, April 8, 2012 4:34:26 PM UTC-4, Roy Smith wrote:
>
> I'm trying to install django-tinymce 1.5.1b2 into a django-1.3 site.  The 
> installation instructions say:
>
> "Copy the jscripts/tiny_mce directory from the TinyMCE distribution into 
> a directory named js in your media root. You can override the location in 
> your settings (see below)."
>
> But there is no such directory. There are:
>
> ./media/tiny_mce/plugins/preview/jscripts
> ./static/tiny_mce/plugins/preview/jscripts
>
> directories, but no tiny_mce directory under those.  Even odder, the media 
> and static trees look like identical copies of each other.  Also, it seems 
> like the javascript files should go under my static directory, not my media 
> directory.  I'm guessing the installation directions predate django 1.3 and 
> collectstatic?
>
> So, what exactly am I supposed to install where?
>

On Sunday, April 8, 2012 4:34:26 PM UTC-4, Roy Smith wrote:
>
> I'm trying to install django-tinymce 1.5.1b2 into a django-1.3 site.  The 
> installation instructions say:
>
> "Copy the jscripts/tiny_mce directory from the TinyMCE distribution into 
> a directory named js in your media root. You can override the location in 
> your settings (see below)."
>
> But there is no such directory. There are:
>
> ./media/tiny_mce/plugins/preview/jscripts
> ./static/tiny_mce/plugins/preview/jscripts
>
> directories, but no tiny_mce directory under those.  Even odder, the media 
> and static trees look like identical copies of each other.  Also, it seems 
> like the javascript files should go under my static directory, not my media 
> directory.  I'm guessing the installation directions predate django 1.3 and 
> collectstatic?
>
> So, what exactly am I supposed to install where?
>

On Sunday, April 8, 2012 4:34:26 PM UTC-4, Roy Smith wrote:
>
> I'm trying to install django-tinymce 1.5.1b2 into a django-1.3 site.  The 
> installation instructions say:
>
> "Copy the jscripts/tiny_mce directory from the TinyMCE distribution into 
> a directory named js in your media root. You can override the location in 
> your settings (see below)."
>
> But there is no such directory. There are:
>
> ./media/tiny_mce/plugins/preview/jscripts
> ./static/tiny_mce/plugins/preview/jscripts
>
> directories, but no tiny_mce directory under those.  Even odder, the media 
> and static trees look like identical copies of each other.  Also, it seems 
> like the javascript files should go under my static directory, not my media 
> directory.  I'm guessing the installation directions predate django 1.3 and 
> collectstatic?
>
> So, what exactly am I supposed to install where?
>

On Sunday, April 8, 2012 4:34:26 PM UTC-4, Roy Smith wrote:
>
> I'm trying to install django-tinymce 1.5.1b2 into a django-1.3 site.  The 
> installation instructions say:
>
> "Copy the jscripts/tiny_mce directory from the TinyMCE distribution into 
> a directory named js in your media root. You can override the location in 
> your settings (see below)."
>
> But there is no such directory. There are:
>
> ./media/tiny_mce/plugins/preview/jscripts
> ./static/tiny_mce/plugins/preview/jscripts
>
> directories, but no tiny_mce directory under those.  Even odder, the media 
> and static trees look like identical copies of each other.  Also, it seems 
> like the javascript files should go under my static directory, not my media 
> directory.  I'm guessing the installation directions predate django 1.3 and 
> collectstatic?
>
> So, what exactly am I supposed to install where?
>

-- 
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/-/yTiCOtVcr9cJ.
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: How to install django-mce?

2012-04-09 Thread Roy Smith

>
> docs are little out of date but should work.
> http://django-tinymce.readthedocs.org/en/latest/installation.html
>

Thanks for the help.  The critical item was, "If you are using 
django-staticfiles you can skip this step".  I added 'tinymce' to 
INSTALLED_APPS, set

TINYMCE_DEFAULT_CONFIG = {
"width": "100%",
"height": "400px",
"theme": "advanced",
"relative_urls": False,
}

and ran manage.py collectstatic.  Works like a charm.  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/-/BuRatx8fOEUJ.
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: Hosting Django website

2012-04-09 Thread megaBos
I recommend using webfaction, they have excellent documentation and
are very flexible. http://bit.ly/Hnbm6A

-- 
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: Question about threading a view[REPOSTED]

2012-04-09 Thread Shawn Milochik
The best solution for this, in my opinion and experience, is to use 
supervisord. It's easy, requires no root access, and allows you to 
control all your long-running processes (Django app, celery, Redis, 
MongoDB, etc.) from one place.



--
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: UnboundLocalError: local variable 'KeyError' referenced before assignment

2012-04-09 Thread Casey Greene
Great point Karen.  It hadn't occurred to me that it could be a later
occurrence that could lead to python thinking it was local.  Later:
except ValueError, KeyError

After changing it to:
except (ValueError, KeyError)
the issue is resolved.

Thanks so much!
Casey

On Mon, Apr 9, 2012 at 11:20 AM, Karen Tracey  wrote:
> On Mon, Apr 9, 2012 at 11:09 AM, Casey Greene  wrote:
>> I have this very baffling error that I'm dealing with at the moment.
>> I'm maintaining someone else's code and I'm getting this error for
>> some queries with a try, except block in a view.  It seems that the
>> queries that lead to the error are ones where there is, in fact, a
>> KeyError.  I've actually manged to narrow it down to a pretty simple
>> test case though.  Within the view, I can do this (first few lines):
>>
>> def gene_view(request, slug=None, gene=None, org=None, template=None):
>>   print(KeyError)
>>
>> and I get this exception with django 1.4 (if it matters):
>> UnboundLocalError at /predictions/gene/
>> local variable 'KeyError' referenced before assignment
>
> Python thinks KeyError is a local variable, thus it sounds like code
> in the view subsequent to where KeyError is caught makes an assignment
> to KeyError. So search later in the view for where KeyError is
> mis-assigned.
>
> Karen
> --
> http://tracey.org/kmt/
>
> --
> 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.
>

-- 
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: Advice on installing Django in a fresh OSX Lion machine

2012-04-09 Thread shacker
On Monday, April 9, 2012 5:19:28 AM UTC-7, Paulo wrote:
>
> Im new both to Python and Django and I'm afraid of messing thins up 
> before I even start. 
> Lion ships with Python 2.7.1  but I see that 2.7.2 is available in the 
> official site. Should I download .dmg file from the site to update to 
> version 2.7.2? 
>

I personally wouldn't bother messing with the default python for such a 
minor update on your local dev machine. Your steps should be:

sudo easy_install pip
sudo pip install virtualenvwrapper
  [Follow its post-setup instructions, then]
mkvirtualenv yoursite
workon yoursite
pip install django


-- 
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/-/0wEzywC490MJ.
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: UnboundLocalError: local variable 'KeyError' referenced before assignment

2012-04-09 Thread Karen Tracey
On Mon, Apr 9, 2012 at 11:09 AM, Casey Greene  wrote:
> I have this very baffling error that I'm dealing with at the moment.
> I'm maintaining someone else's code and I'm getting this error for
> some queries with a try, except block in a view.  It seems that the
> queries that lead to the error are ones where there is, in fact, a
> KeyError.  I've actually manged to narrow it down to a pretty simple
> test case though.  Within the view, I can do this (first few lines):
>
> def gene_view(request, slug=None, gene=None, org=None, template=None):
>   print(KeyError)
>
> and I get this exception with django 1.4 (if it matters):
> UnboundLocalError at /predictions/gene/
> local variable 'KeyError' referenced before assignment

Python thinks KeyError is a local variable, thus it sounds like code
in the view subsequent to where KeyError is caught makes an assignment
to KeyError. So search later in the view for where KeyError is
mis-assigned.

Karen
-- 
http://tracey.org/kmt/

-- 
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: Question about threading a view[REPOSTED]

2012-04-09 Thread Arruda
Thanks everyone, I'd like to say that I ended up using django-celery + 
RabbitMQ server.
But had some problems trying to make celery run as daemon.
After sometime I discovered what need to be done(didn't like the docs in 
this part... found them misleading), everything is working great.

Even made a post about this:
http://www.arruda.blog.br/programacao/django-celery-in-daemon/

Thanks

Em terça-feira, 20 de março de 2012 12h11min11s UTC-3, Jani Tiainen 
escreveu:
>
> Hi,
>
> Your solution will work perfectly in single process environment (For 
> example with manage.py runserver )
>
> But when you put your app behind webserver you usually invoke several 
> processes. For example if you're using single round-robin loadbalancing
> over 5 different Django instances.
>
> What would happen if Django instances are restarted after n cycles (like 
> our wsgi django instances are restarted after 1000 requests). Can you 
> guarantee that your thread survives?
>
> If you do "massive" scaling: what happens if you have multiple servers, 
> how can you guarantee that consecutive requests from single user goes to 
> same server and same process?
>
> That is why there exists things like django-celery and rabbitmq (message 
> broker). How they work is already explained to you.
>
> 20.3.2012 16:52, Arruda kirjoitti:
> > Thanks every one, I've manage to work this around.
> > The solution might not be the best, but it's working:
> > In the view I call the *do_something_slow()* in a new thread, and in the
> > end of it(after the role process is done) it change the model of a class
> > to add the feedback.
> > While the thread is running it renders the template to the user(with a
> > *"Loading..."* message).
> > Then I've made a *ajax_get_feed_back() *view to get this feedback.
> >
> > In the template, I made a simple JS that every second tries to get the
> > feedback via ajax.
> > And if it gets the feedback it stops requesting it.
> > =)
> >
> > But I still wanted to know how to use the celery in this case =/
> > But got very lost in that, does any one have a example(code) of
> > something similar to do with it?
> > In the docs I only found examples of process that are kind of tasks...
> > to run every hour, or things like that.
> >
> > Em segunda-feira, 19 de mar�o de 2012 15h18min09s UTC-3, Arruda 
> escreveu:
> >
> > *(I've created a topic like this a few minutes ago, but was using
> > the old google groups, and now it's broken. So I created a new one
> > using the new google groups).*
> > Hi, I'll try to explain the best I can my problem, and I don't know 
> if
> > what I'm trying to archive is the best way to get where I want, but
> > here is it:
> > I want that a specific view to run in a new thread, ex:
> > *def foo(request):
> > do_something_slow()
> > return httpResponse*
> >
> > But I DON'T want that a new thread is run inside the view, the view 
> it
> > self should be runned in another thread, ex:
> > *
> > def foo(request):
> > t = thread(target=do_something_slow())
> > t.daemon = True
> > t.start()
> >
> > return httpResponse
> > *
> > This way when a user A access any page the site will load, even if a
> > user B is accessing the 'foo' view.
> > But the B user when access the view 'foo' will load it just a if if
> > was a normal view( will be slow and will render the response just
> > after do_something_slow() finished running).
> >
> > I don't know if this is what I want, but I believe that there is
> > another way around:
> > when user B calls foo view, it will render to him a page with a JS(I
> > don't know JS either, so correct me if I'm talking nonsense) that say
> > its "Loading..."
> > And after the do_someting_slow() finished running if will change the
> > content of the page to whatever the result of "do_something_slow" 
> was.
> >
> > Thanks for the attention.
> >
> > --
> > 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/-/ST6KqE0uPqsJ.
> > 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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/__-Eyqv2_4cJ.
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.



UnboundLocalError: local variable 'KeyError' referenced before assignment

2012-04-09 Thread Casey Greene
I have this very baffling error that I'm dealing with at the moment.
I'm maintaining someone else's code and I'm getting this error for
some queries with a try, except block in a view.  It seems that the
queries that lead to the error are ones where there is, in fact, a
KeyError.  I've actually manged to narrow it down to a pretty simple
test case though.  Within the view, I can do this (first few lines):

def gene_view(request, slug=None, gene=None, org=None, template=None):
   print(KeyError)

and I get this exception with django 1.4 (if it matters):
UnboundLocalError at /predictions/gene/
local variable 'KeyError' referenced before assignment



In ./manage.py shell though, I can do:
./manage.py shell
Python 2.7.2+ (default, Oct  4 2011, 20:06:09)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> print(KeyError)

>>> import urls
>>> print(KeyError)

>>> import predictions.views
>>> print(KeyError)

>>> import predictions.urls
>>> print(KeyError)


I was expecting that if there was some redefinition of KeyError that
one of those would also give the exception.  I've also tried this,
just for kicks:

>>> from urls import *
>>> print(KeyError)

>>> from predictions.views import *
>>> print(KeyError)

>>> from predictions.urls import *
>>> print(KeyError)

>>>

I'm not really sure where to start tracking this down.  I'm under the
impression that KeyError is one of the built in python exceptions, and
so it should really never be unbound.

Thanks for your help!
Casey

-- 
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: Hosting Django website

2012-04-09 Thread eduardoorige
I using heroku for host my django sites. Good and free. Try it.

www.heroku.com

Em domingo, 8 de abril de 2012 10h59min51s UTC-3, KasunLak escreveu:
>
> Hi all, 
>
> I have created a website using django. I want to host it now. Can you 
> suggest me a best way to host it? I have noticed it is possible to 
> host in tomcat on top of jython, is this recommended or have any 
> issues? 
>
> thanks in advance, 
> Kasun

-- 
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/-/CCSOd4_iNvAJ.
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: Hosting Django website

2012-04-09 Thread rockvilla
I myself was finding it hard to find nice and easy hosting service for 
Django. I use OpenShift Cloud  for 
hosting my Django powered website. Its free to use that service and really 
very easy. You just have to register yourself there. If you need any 
further help regarding OpenShift do email me at bnagaon...@gmail.com.

On Sunday, April 8, 2012 7:29:51 PM UTC+5:30, KasunLak wrote:
>
> Hi all, 
>
> I have created a website using django. I want to host it now. Can you 
> suggest me a best way to host it? I have noticed it is possible to 
> host in tomcat on top of jython, is this recommended or have any 
> issues? 
>
> thanks in advance, 
> Kasun

-- 
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/-/4vn9IxM6yiIJ.
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.



Web Application Engineer opening - Boston MA or Managua, Nicaragua

2012-04-09 Thread Sanjay Jain
Django developers may be interested in this opening in Boston or
Managua.

http://www.quoininc.com/quoin/quoin-about/jobs/python-django-rails-engineer-boston.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: admin page and basic view not showing

2012-04-09 Thread LordMaKo
 hey guys,

got it working!

the problem was the path for my db, i changed it in settings.py and it
works now!

/home/ubuntu/djangoProj/micopiloto/

so all working now ;)

ok here we go!

On Apr 9, 11:05 pm, LordMaKo  wrote:
> hi thanks!,
> yes,
> I can see the hello world view now!
>
> views.py:
>  from django.http import HttpResponse
>
>     def view(request):
>         return HttpResponse('Hello Worlsss9d!')
>
> but still cant see the admin site page,
>
> i have chmod 777 the db and the root folder for the db, and chown root
> too this file and folder,
> but get this error:
> Exception Value:
> unable to open database file
>
> I have searched a bit and its about the permissions of sqlite3??, so
> what to do to show the admin?,
> or what else could i be missing?
>
> thanks!
>
> On Apr 9, 10:25 pm, kenneth gonsalves  wrote:
>
>
>
>
>
>
>
> > On Mon, 2012-04-09 at 02:24 -0700, LordMaKo wrote:
> > > so what im i missing?, as stated before i can see the "it worked"
> > > page, but not the admin site or the basic view,
>
> > have you created admin.py? and registered the models there?
> > --
> > regards
> > Kenneth Gonsalves

-- 
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: admin page and basic view not showing

2012-04-09 Thread LordMaKo
hi thanks!,
yes,
I can see the hello world view now!

views.py:
 from django.http import HttpResponse

def view(request):
return HttpResponse('Hello Worlsss9d!')


but still cant see the admin site page,

i have chmod 777 the db and the root folder for the db, and chown root
too this file and folder,
but get this error:
Exception Value:
unable to open database file

I have searched a bit and its about the permissions of sqlite3??, so
what to do to show the admin?,
or what else could i be missing?

thanks!

On Apr 9, 10:25 pm, kenneth gonsalves  wrote:
> On Mon, 2012-04-09 at 02:24 -0700, LordMaKo wrote:
> > so what im i missing?, as stated before i can see the "it worked"
> > page, but not the admin site or the basic view,
>
> have you created admin.py? and registered the models there?
> --
> regards
> Kenneth Gonsalves

-- 
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: admin page and basic view not showing

2012-04-09 Thread kenneth gonsalves
On Mon, 2012-04-09 at 02:24 -0700, LordMaKo wrote:
> so what im i missing?, as stated before i can see the "it worked"
> page, but not the admin site or the basic view, 

have you created admin.py? and registered the models there?
-- 
regards
Kenneth Gonsalves

-- 
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.



Advice on installing Django in a fresh OSX Lion machine

2012-04-09 Thread Paulo
Im new both to Python and Django and I'm afraid of messing thins up
before I even start.
Lion ships with Python 2.7.1  but I see that 2.7.2 is available in the
official site. Should I download .dmg file from the site to update to
version 2.7.2?
I found this tutorial [1] and I really like the idea of a virtual
development "folder" so I don't mess things up in my system. Could I
get some advice on that site tutorial?
Like I said, I'm new to python and only read the Byte of Python book
so far, but I want to move to web because Im tired of being a CMS
tweaker. Is Django a good choice for that or should I try another
framework? (I want to build my portfolio site and use it as a learning
process)

Thanks in advance and excuse my poor english

[1] - 
http://hackercodex.com/2011/08/30/python-install-django-on-mac-osx-lion-10.7/

-- 
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: Hosting Django website

2012-04-09 Thread samuelm...@gmail.com
You can try the hosting Alwaysdata [1], I have several projects with this
server and it's great.

The characteristics of the hosting you can see on the same page [2]. You
have a free web space from 10 MB to start testing Django, but you could
have a greater capacity for a low cost.

[1] https://www.alwaysdata.com/
[2] https://www.alwaysdata.com/features/infrastructure/

-- 
---
 .~.
/ v \
  //  \\
 /()\
^`~'^


2012/4/8 KasunLak 

> Hi all,
>
> I have created a website using django. I want to host it now. Can you
> suggest me a best way to host it? I have noticed it is possible to
> host in tomcat on top of jython, is this recommended or have any
> issues?
>
> thanks in advance,
> Kasun
>
> --
> 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.
>
>

-- 
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.



admin page and basic view not showing

2012-04-09 Thread LordMaKo
hi, I have a django test in an amazon ec2 server,

the "it worked!" page shows fine , 
http://ec2-107-20-20-19.compute-1.amazonaws.com/

but i only get this "it worked page"


I have already setted my db, and uncommented the necessary lines in
settings to see the admin site
[but cannot see it!]


settings.py: [/home/ubuntu/djangoProj/micopiloto]
# Django settings for micopiloto project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_em...@example.com'),
)

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'thadb',  # Or path to database
file if using sqlite3.
'USER': '',  # Not used with sqlite3.
'PASSWORD': '',  # Not used with sqlite3.
'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for
default. Not used with sqlite3.
}
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as
your
# system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as
not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True

# Absolute filesystem path to the directory that will hold user-
uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use
a
# trailing slash.
# Examples: "http://media.lawrence.com/media/";, "http://example.com/
media/"
MEDIA_URL = ''

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static
files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/";
STATIC_URL = '/static/'

# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/";, "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/
static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = '2&g_&k=+^(0t)1xf82m^=#0u6v1e!)nn7ixq*+2^h%4$mwlrsm'

# List of callables that know how to import templates from various
sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)

ROOT_URLCONF = 'micopiloto.urls'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/
django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'portfolio'
)

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to 

any golfers around?

2012-04-09 Thread kenneth gonsalves
hi,

I have developed and for the past 4 years been maintaining a golf
scoring and handicapping app - http://bitbucket.org/lawgon/djangogolf ,
this was developed for my club and is now in use in three clubs. We have
conducted over a 100 tournaments with wide variety of formats, including
one at the national level without a hitch so far. I wonder if any one
here would like to try it out or work on it. I can provide a live sql
dump of real data offlist. Although it is more or less bug free, the UI
sucks - and the code needs refactoring. Am working on these but would
love help ...
-- 
regards
Kenneth Gonsalves

-- 
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.



Admin area hyperlinks to sub categories

2012-04-09 Thread Swaroop Shankar V
Hi all,
I have 2 models one is Category and another one is Book. Books will
be assigned to a category. So on the admin area i want to display a link on
the dashboard which will take the user to a page where all the categories
will be listed. On clicking on to any of the category user should be taken
to a page where the books assigned under that category is displayed. How
can i accomplish the same.

Thanks and Regards,

Swaroop Shankar V

-- 
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: Improving Site Performance

2012-04-09 Thread Swaroop Shankar V
Thanks Phang, I have not yet checked into the query caching in django. Will
check and will see if it would improve the performance. Thanks a lot for
your reply :)

Thanks and Regards,
Swaroop Shankar V



On Sat, Apr 7, 2012 at 4:04 PM, Phang Mulianto  wrote:

> Well.. i think the lazy query is on action.
>
> The query executed to get the data from database to be use in your view,
> if you said requestContext(..)
>
> if you remove it, of course the data will not available in your
> view/template.
>
> To reduce the query executed everytime you call the page, try use query
> caching..
> one quick way without change code is use some cache like johnny-cache..it
> will automaticly cache your query and unvalidate it if your data changes.
>
> i used it to.. and try load your page more than once, you will see in the
> debug toolbar, the query is reduced in the second and next load...that is
> the cache in action..
>
> hope help..
>
>  On Thu, Apr 5, 2012 at 3:41 PM, Swaroop Shankar V wrote:
>
>>  Hi All,
>> Am developing a site using django and it is almost ready to be launched.
>> Right now am trying to optimize the performance of the site. I have
>> installed the django debug toolbar and when i checked the number of queries
>> being exicuted on the homepage i could see there are 74 queries
>> being executed. On debugging I could see that most of the queries  are
>> through the context_instance=RequestContext(request) that am passing to a
>> view. When I removed it I could see the queries where reduced to 24, which
>> improved the performance, but I end up in an error
>>
>> Caught KeyError while rendering: 'request'
>>
>> this is happening because the homepage is rendering a custom template tag 
>> which requires the request object available (to access the currently logged 
>> in user details). So is there any way to avoid using 
>> context_instance=RequestContext(request) and still make the request object 
>> accessible in the custom template tag?
>>
>>
>>
>> Thanks and Regards,
>> Swaroop Shankar V
>>
>>  --
>> 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.
>>
>
>  --
> 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.
>

-- 
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.