Re:

2013-02-18 Thread Pankaj Singh
Right. 'UsernaBaseProfile' should be 'UserenaBaseProfile'.

Sincerely,
Pankaj Singh
http://about.me/psjinx


On Tue, Feb 19, 2013 at 12:53 PM, Zhao Quan  wrote:

> thanks I resolve that issue,
> seems the parameter miss a 'e'.
>
>
> On Tue, Feb 19, 2013 at 3:15 PM, Zhao Quan  wrote:
>
>> thanks Pankaj for replay my question so quickly. :)
>>
>> I already add this code in models.py
>> code as below.
>> I place it under path "mysite/accounts/models.py"
>>
>> models.py
>> from django.db import models
>>
>> # Create your models here.
>> from django.contrib.auth.models import User
>> from django.utils.translation import ugettext as _
>> from userena.models import UserenaBaseProfile
>>
>> class MyProfile(UsernaBaseProfile):
>>   user = models.OneToOneField(User,
>>   unique=True,
>>   verbose_name=_('user'),
>>   related_name='my_profile')
>>   favourite_snack = models.CharField(_('favourite snack'),
>>  max_length=5)
>>
>> So many thanks for u,
>> Felix Zhao
>>
>>
>> On Tue, Feb 19, 2013 at 3:10 PM, Pankaj Singh  wrote:
>>
>>> Hey,
>>>
>>> You need to import UserenaBaseProfile in your models.py before defining
>>> MyProfile class.
>>>
>>> from userena.models import UserenaBaseProfile
>>>
>>> http://docs.django-userena.org/en/latest/installation.html#profiles
>>>
>>> Sincerely,
>>> Pankaj Singh
>>> http://about.me/psjinx
>>>
>>>
>>> On Tue, Feb 19, 2013 at 12:36 PM, Zhao Quan wrote:
>>>
 Hi all,

 I fish for django.
 So, I want to use some code to handle use login and registion issue.
 I find the code name "django-userena"

 But, after I follow the guide to setup.
 http://docs.django-userena.org/en/latest/installation.html
  I get exception like this: NameError: name 'UsernaBaseProfile' is not
 defined

 detial info as below
 -

 ~/djcode/mysite$ ./manage.py check_permissions
 Traceback (most recent call last):
   File "./manage.py", line 10, in 
 execute_from_command_line(sys.argv)
   File
 "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
 line 443, in execute_from_command_line
 utility.execute()
   File
 "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
 line 382, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File
 "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
 line 196, in run_from_argv
 self.execute(*args, **options.__dict__)
   File
 "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
 line 231, in execute
 self.validate()
   File
 "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
 line 266, in validate
 num_errors = get_validation_errors(s, app)
   File
 "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py",
 line 30, in get_validation_errors
 for (app_name, error) in get_app_errors().items():
   File
 "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
 158, in get_app_errors
 self._populate()
   File
 "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
 64, in _populate
 self.load_app(app_name, True)
   File
 "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
 88, in load_app
 models = import_module('.models', app_name)
   File
 "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line
 35, in import_module
 __import__(name)
   File "/home/quanzhao/djcode/mysite/accounts/models.py", line 8, in
 
 class MyProfile(UsernaBaseProfile):
 NameError: name 'UsernaBaseProfile' is not defined

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



>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at 

Re:

2013-02-18 Thread Zhao Quan
thanks I resolve that issue,
seems the parameter miss a 'e'.


On Tue, Feb 19, 2013 at 3:15 PM, Zhao Quan  wrote:

> thanks Pankaj for replay my question so quickly. :)
>
> I already add this code in models.py
> code as below.
> I place it under path "mysite/accounts/models.py"
>
> models.py
> from django.db import models
>
> # Create your models here.
> from django.contrib.auth.models import User
> from django.utils.translation import ugettext as _
> from userena.models import UserenaBaseProfile
>
> class MyProfile(UsernaBaseProfile):
>   user = models.OneToOneField(User,
>   unique=True,
>   verbose_name=_('user'),
>   related_name='my_profile')
>   favourite_snack = models.CharField(_('favourite snack'),
>  max_length=5)
>
> So many thanks for u,
> Felix Zhao
>
>
> On Tue, Feb 19, 2013 at 3:10 PM, Pankaj Singh  wrote:
>
>> Hey,
>>
>> You need to import UserenaBaseProfile in your models.py before defining
>> MyProfile class.
>>
>> from userena.models import UserenaBaseProfile
>>
>> http://docs.django-userena.org/en/latest/installation.html#profiles
>>
>> Sincerely,
>> Pankaj Singh
>> http://about.me/psjinx
>>
>>
>> On Tue, Feb 19, 2013 at 12:36 PM, Zhao Quan  wrote:
>>
>>> Hi all,
>>>
>>> I fish for django.
>>> So, I want to use some code to handle use login and registion issue.
>>> I find the code name "django-userena"
>>>
>>> But, after I follow the guide to setup.
>>> http://docs.django-userena.org/en/latest/installation.html
>>>  I get exception like this: NameError: name 'UsernaBaseProfile' is not
>>> defined
>>>
>>> detial info as below
>>> -
>>>
>>> ~/djcode/mysite$ ./manage.py check_permissions
>>> Traceback (most recent call last):
>>>   File "./manage.py", line 10, in 
>>> execute_from_command_line(sys.argv)
>>>   File
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
>>> line 443, in execute_from_command_line
>>> utility.execute()
>>>   File
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
>>> line 382, in execute
>>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>>   File
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
>>> line 196, in run_from_argv
>>> self.execute(*args, **options.__dict__)
>>>   File
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
>>> line 231, in execute
>>> self.validate()
>>>   File
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
>>> line 266, in validate
>>> num_errors = get_validation_errors(s, app)
>>>   File
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py",
>>> line 30, in get_validation_errors
>>> for (app_name, error) in get_app_errors().items():
>>>   File
>>> "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
>>> 158, in get_app_errors
>>> self._populate()
>>>   File
>>> "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
>>> 64, in _populate
>>> self.load_app(app_name, True)
>>>   File
>>> "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
>>> 88, in load_app
>>> models = import_module('.models', app_name)
>>>   File
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line
>>> 35, in import_module
>>> __import__(name)
>>>   File "/home/quanzhao/djcode/mysite/accounts/models.py", line 8, in
>>> 
>>> class MyProfile(UsernaBaseProfile):
>>> NameError: name 'UsernaBaseProfile' is not defined
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 

Re:

2013-02-18 Thread Zhao Quan
thanks Pankaj for replay my question so quickly. :)

I already add this code in models.py
code as below.
I place it under path "mysite/accounts/models.py"
models.py
from django.db import models

# Create your models here.
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from userena.models import UserenaBaseProfile

class MyProfile(UsernaBaseProfile):
  user = models.OneToOneField(User,
  unique=True,
  verbose_name=_('user'),
  related_name='my_profile')
  favourite_snack = models.CharField(_('favourite snack'),
 max_length=5)

So many thanks for u,
Felix Zhao


On Tue, Feb 19, 2013 at 3:10 PM, Pankaj Singh  wrote:

> Hey,
>
> You need to import UserenaBaseProfile in your models.py before defining
> MyProfile class.
>
> from userena.models import UserenaBaseProfile
>
> http://docs.django-userena.org/en/latest/installation.html#profiles
>
> Sincerely,
> Pankaj Singh
> http://about.me/psjinx
>
>
> On Tue, Feb 19, 2013 at 12:36 PM, Zhao Quan  wrote:
>
>> Hi all,
>>
>> I fish for django.
>> So, I want to use some code to handle use login and registion issue.
>> I find the code name "django-userena"
>>
>> But, after I follow the guide to setup.
>> http://docs.django-userena.org/en/latest/installation.html
>>  I get exception like this: NameError: name 'UsernaBaseProfile' is not
>> defined
>>
>> detial info as below
>> -
>>
>> ~/djcode/mysite$ ./manage.py check_permissions
>> Traceback (most recent call last):
>>   File "./manage.py", line 10, in 
>> execute_from_command_line(sys.argv)
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
>> line 443, in execute_from_command_line
>> utility.execute()
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
>> line 382, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
>> line 196, in run_from_argv
>> self.execute(*args, **options.__dict__)
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
>> line 231, in execute
>> self.validate()
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
>> line 266, in validate
>> num_errors = get_validation_errors(s, app)
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py",
>> line 30, in get_validation_errors
>> for (app_name, error) in get_app_errors().items():
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
>> 158, in get_app_errors
>> self._populate()
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
>> 64, in _populate
>> self.load_app(app_name, True)
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
>> 88, in load_app
>> models = import_module('.models', app_name)
>>   File
>> "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line
>> 35, in import_module
>> __import__(name)
>>   File "/home/quanzhao/djcode/mysite/accounts/models.py", line 8, in
>> 
>> class MyProfile(UsernaBaseProfile):
>> NameError: name 'UsernaBaseProfile' is not defined
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Re:

2013-02-18 Thread Pankaj Singh
Hey,

You need to import UserenaBaseProfile in your models.py before defining
MyProfile class.

from userena.models import UserenaBaseProfile

http://docs.django-userena.org/en/latest/installation.html#profiles

Sincerely,
Pankaj Singh
http://about.me/psjinx


On Tue, Feb 19, 2013 at 12:36 PM, Zhao Quan  wrote:

> Hi all,
>
> I fish for django.
> So, I want to use some code to handle use login and registion issue.
> I find the code name "django-userena"
>
> But, after I follow the guide to setup.
> http://docs.django-userena.org/en/latest/installation.html
>  I get exception like this: NameError: name 'UsernaBaseProfile' is not
> defined
>
> detial info as below
> -
>
> ~/djcode/mysite$ ./manage.py check_permissions
> Traceback (most recent call last):
>   File "./manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
> line 443, in execute_from_command_line
> utility.execute()
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
> line 382, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
> line 196, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
> line 231, in execute
> self.validate()
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
> line 266, in validate
> num_errors = get_validation_errors(s, app)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py",
> line 30, in get_validation_errors
> for (app_name, error) in get_app_errors().items():
>   File
> "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
> 158, in get_app_errors
> self._populate()
>   File
> "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
> 64, in _populate
> self.load_app(app_name, True)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
> 88, in load_app
> models = import_module('.models', app_name)
>   File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py",
> line 35, in import_module
> __import__(name)
>   File "/home/quanzhao/djcode/mysite/accounts/models.py", line 8, in
> 
> class MyProfile(UsernaBaseProfile):
> NameError: name 'UsernaBaseProfile' is not defined
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




[no subject]

2013-02-18 Thread Zhao Quan
Hi all,

I fish for django.
So, I want to use some code to handle use login and registion issue.
I find the code name "django-userena"

But, after I follow the guide to setup.
http://docs.django-userena.org/en/latest/installation.html
I get exception like this: NameError: name 'UsernaBaseProfile' is not
defined

detial info as below
-

~/djcode/mysite$ ./manage.py check_permissions
Traceback (most recent call last):
  File "./manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File
"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
line 443, in execute_from_command_line
utility.execute()
  File
"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
line 196, in run_from_argv
self.execute(*args, **options.__dict__)
  File
"/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
line 231, in execute
self.validate()
  File
"/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
line 266, in validate
num_errors = get_validation_errors(s, app)
  File
"/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py",
line 30, in get_validation_errors
for (app_name, error) in get_app_errors().items():
  File
"/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
158, in get_app_errors
self._populate()
  File
"/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
64, in _populate
self.load_app(app_name, True)
  File
"/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line
88, in load_app
models = import_module('.models', app_name)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py",
line 35, in import_module
__import__(name)
  File "/home/quanzhao/djcode/mysite/accounts/models.py", line 8, in

class MyProfile(UsernaBaseProfile):
NameError: name 'UsernaBaseProfile' is not defined

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




Re: Custom Http404 like exception

2013-02-18 Thread Serge G. Spaolonzi
Thanks, It worked.

On Mon, Feb 18, 2013 at 1:00 PM, Tom Evans  wrote:

> On Mon, Feb 18, 2013 at 2:41 PM, Serge G. Spaolonzi 
> wrote:
> > Thanks Pankaj,  In this case I could not use an HttpResponse because the
> > helper method I am developing doesn't return a respose it returns a dict
> or
> > raises an exception if the user is not authenticated.
> > For example:
> >
> > def get_server_time(request):
> >   time_dictionary = helper_method()
> >   #Rest of the view here
> >
> > def helper_method():
> >  if user.is_authenticated():
> > return {'server_time': server_time()}
> >  else:
> > raise HttpCustomException(redirect='this_login_for_this_method')
> >
> > The goal is to return the dictionary or redirect the user to a specific
> > login screen (there would be several login screens).
> > The idea is to encapsulate all this functionality in the helper method so
> > the views dont have to implement the authentication part or write a
> > try/catch/redirect in all the views.
> >
>
> Hi Serge
>
> If an unhandled exception is raised from view code, then before
> generating a default error response, Django will first call any
> middleware that has a process_exception method, and if a response is
> returned from any of them, will use that response rather than proceed
> with it's standard error reporting.
>
> Therefore, you can simply define some middleware to handle project
> specific exceptions in a similar manner to Http404.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Serge G. Spaolonzi
Cobalys Systems
http://www.cobalys.com

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




Re: How to make django's mysql connections to use utf8mb4 ?

2013-02-18 Thread Peter of the Norse
Triple check your encoding type on the database and table. MySQL is 
often stupid about encoding, and when Django tries to do the right 
thing, it fails. I once converted a MySQL database from PHP to Django, 
and ran into a similar problem. Everything on the old database was 
marked Latin1, but web browsers were treating it as UTF-8. MySQL was 
more than happy to store invalid data, but when it came time to view the 
data with Django, all we got were random characters and question marks. 
They were trying to convert Latin1 into UTF-8 and failing. phpMyAdmin 
did the wrong thing too.


On 1/24/2013 12:59 AM, Adrián Espinosa wrote:

Hello,

I struggled with this once, although not through Django. I tried a lot 
of things, and I couldn't get MySQL to properly store emojis, or 
japanese/chinese characters for example.


As my project was just starting, I switched to postgresql, and it just 
worked. I did nothing fancy to get it to work and I have succesfully 
stored all kind of characters.


I'm also interested in the right solution for MySQL, but if you don't 
want to spend a lot of time or anything else, you might want to try 
with postgresql.


Best regards

On Wednesday, January 23, 2013 10:07:07 PM UTC+1, Chen Xu wrote:

I saved some Emoji icons to MySQL Database,the icons have been
saved correctly. Since I can see them from MySQL Shell when I type
'select message_text from messages'

However, when I do Message.object.get(ph=5).message_text, it shows
me a bunch question marks.

Could someone please help?

Thanks

-- 
⚡ Chen Xu ⚡


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

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.


--
Peter of the Norse

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




Re: Django Project on Heroku

2013-02-18 Thread Russell Keith-Magee
Hi Jingiqang Zhang,

I'm not clear on what you've done here.

If you're proposing this as a new format/style for the Django project
website, I have to advise that this is not a good start - it doesn't match
any of the Django project's style guidelines (our trademark colours and
fonts, for example).

You're free to propose new designs for Djangoproject.org if you want;
however, you should also be advised that the Django Software Foundation has
contracted a web design company to develop a new djangoproject website.

If you're proposing something else, I'm going to have to ask you to take
down the site, and approach the DSF to ask permission for what you're
looking to do. What you've presented at the moment violates the Django
trademark, and violates copyright by appropriating Django content without
permission.

Yours
Russ Magee %-)

On Mon, Feb 18, 2013 at 10:42 PM, Jingqiang Zhang
wrote:

> http://djangoproject.herokuapp.com/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




does LiveServerTestCase work with gunicorn

2013-02-18 Thread calum mchaffie


I am running an app in django with gunicorn. I am trying to use selenium to 
test my app but have run into a problem.

I need to create a test server like is done with djangos LiveServerTestCase 
that will work with gunicorn.

Does anyone have any ideas of how i could do this?

note: could also use someone confirming for me that LiveServerTestCase is 
executed as a thread not a process

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




Re: Error passing data from views to template

2013-02-18 Thread Tiago Carvalho
Thank you very much both (Jason and psjinx).

It resolved my problem.

This was my first post in this Django users group. Nice to see that Django 
has such a helpfull community users.



On Monday, February 18, 2013 5:25:53 PM UTC, Jason Arnst-Goodrich wrote:
>
> return render_to_response('home/about.html', data, 
> 'context_instance=RequestContext(request)')
>
> Change that to:
>
> return render_to_response('home/about.html', data, 
> context_instance=RequestContext(request))
>
> The context_instance is an optional keyword argument. Right now you're 
> passing it as a positional string due to the quotes.
>
> On Sunday, February 17, 2013 10:34:12 AM UTC-8, Tiago Carvalho wrote:
>>
>> Hello,
>>
>> I'm new to Django and I'm with an error, passing data from views to 
>> templates.
>>
>> Here is the traceback: http://dpaste.com/942117/
>>
>> Request URL: http://localhost:8000/about/
>> Django Version: 1.4.3
>> Exception Type: AttributeError
>> *Exception Value: 'str' object has no attribute 'update'*
>> Exception Location: 
>> /usr/local/lib/python2.7/dist-packages/django/template/loader.py 
>> in render_to_string, line 174
>>
>>
>> Somebody can help me, please?
>>
>

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




Re: Increase sqlite3 database size

2013-02-18 Thread Nikolas Stevenson-Molnar
Can you provide more info on how you're getting the data into the
database (e.g., via the admin?), and the ORM expression you're using to
try to find it?

_Nik

On 2/18/2013 2:14 PM, Hiral Shah wrote:
>
> Thank you very much Mikolas and Dennis!
>  
> I understand what are you trying to say but why is the data not going
> to the database?
>
> Regards,
> Hiral
>
> On Sunday, February 17, 2013 6:14:15 PM UTC-8, Hiral Shah wrote:
>
> Hi All,
>
> Thanks in advance for your help!
>
> I am working on back-end to fill the database tables with build
> related information. I am using Django framework with sqlite3.
> Somehow I am not able to add more data in database table after
> certain limit. I am not getting any error but database size is not
> increasing.
>
> For example: If I run my program, it will add entry and size
> is...66560
>
> If I run it with different parameter again and size it  ...68608
>
> Now, how many time, I run it..it is not updating the size and when
> I try to filter particular entry , it is not there.
>
> I tried to look for size limit for database using sqlite but could
> not find anything. Please guide me if anyone ran into the same
> situation before or have any idea about it.
>
> Regards,
> Hiral
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

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




Re: Increase sqlite3 database size

2013-02-18 Thread Hiral Shah

Thank you very much Mikolas and Dennis!
 
I understand what are you trying to say but why is the data not going to 
the database?

Regards,
Hiral

On Sunday, February 17, 2013 6:14:15 PM UTC-8, Hiral Shah wrote:
>
> Hi All,
>
> Thanks in advance for your help!
>
> I am working on back-end to fill the database tables with build related 
> information. I am using Django framework with sqlite3. Somehow I am not 
> able to add more data in database table after certain limit. I am not 
> getting any error but database size is not increasing.
>
> For example: If I run my program, it will add entry and size is...66560 
>
> If I run it with different parameter again and size it  ...68608 
>
> Now, how many time, I run it..it is not updating the size and when I try 
> to filter particular entry , it is not there. 
>
> I tried to look for size limit for database using sqlite but could not 
> find anything. Please guide me if anyone ran into the same situation before 
> or have any idea about it.
>
> Regards,
> Hiral
>

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




Re: How can i run system level tests using djangos testing framework

2013-02-18 Thread Nikolas Stevenson-Molnar
True, but as far as I can tell, Django's testing framework seems to
revolve around apps, and you need to group your system-wide test
somewhere anyway, might as well be in an app. It doesn't need to have
much, just a blank models.py file, and a tests.py with your tests.

Alternatively, you could create a custom test runner and look for tests
wherever you'd like:
https://docs.djangoproject.com/en/dev/topics/testing/advanced/#topics-testing-test-runner

_Nik

On 2/18/2013 1:53 PM, calum mchaffie wrote:
> I have thought about that, but would prefer not to if i can avoid it,
> seems alot of extras just for some tests
>
> On Tuesday, February 19, 2013 10:51:24 AM UTC+13, Nikolas
> Stevenson-Molnar wrote:
>
> How about creating a 'testing' app specifically for full-project
> tests?
>
> _Nik
>
> On 2/18/2013 1:48 PM, calum mchaffie wrote:
> > I want to be able to run my system level integration tests using
> > djangos LiveServerTestCase.
> >
> > It doesnt make sense to have the tests in the app as it uses
> more than
> > just the app.
> >
> > So my problem is how do i get django to run the tests when they
> are in
> > the project folder (not the app)?
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from
> it, send
> > an email to django-users...@googlegroups.com .
> > To post to this group, send email to django...@googlegroups.com
> .
> > Visit this group at
> http://groups.google.com/group/django-users?hl=en
> .
> > For more options, visit https://groups.google.com/groups/opt_out
> .
> >  
> >  
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

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




Re: How can i run system level tests using djangos testing framework

2013-02-18 Thread calum mchaffie
I have thought about that, but would prefer not to if i can avoid it, seems 
alot of extras just for some tests

On Tuesday, February 19, 2013 10:51:24 AM UTC+13, Nikolas Stevenson-Molnar 
wrote:
>
> How about creating a 'testing' app specifically for full-project tests? 
>
> _Nik 
>
> On 2/18/2013 1:48 PM, calum mchaffie wrote: 
> > I want to be able to run my system level integration tests using 
> > djangos LiveServerTestCase. 
> > 
> > It doesnt make sense to have the tests in the app as it uses more than 
> > just the app. 
> > 
> > So my problem is how do i get django to run the tests when they are in 
> > the project folder (not the app)? 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to django-users...@googlegroups.com . 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > Visit this group at http://groups.google.com/group/django-users?hl=en. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> >   
> >   
>
>

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




Re: How can i run system level tests using djangos testing framework

2013-02-18 Thread Nikolas Stevenson-Molnar
How about creating a 'testing' app specifically for full-project tests?

_Nik

On 2/18/2013 1:48 PM, calum mchaffie wrote:
> I want to be able to run my system level integration tests using
> djangos LiveServerTestCase. 
>
> It doesnt make sense to have the tests in the app as it uses more than
> just the app. 
>
> So my problem is how do i get django to run the tests when they are in
> the project folder (not the app)?
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

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




How can i run system level tests using djangos testing framework

2013-02-18 Thread calum mchaffie
I want to be able to run my system level integration tests using djangos 
LiveServerTestCase. 

It doesnt make sense to have the tests in the app as it uses more than just 
the app. 

So my problem is how do i get django to run the tests when they are in the 
project folder (not the app)?

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




django-quickview v0.1 released - proof-of-concept/comments wanted

2013-02-18 Thread Thomas Weholt
Hi,

I looked for django-announcements to post this in, but didn't find at
groups.google.com. If this is not the place for such announcements I'm
sorry. Anyway;

Being somewhat underwhelmed by class based views due to the repetative
coding in urls.py etc I tried to see if I could get generic
scaffolding and basic views up and running based on a given model in
less lines of code. It's pretty simple and not heavily tested, but I'd
like to see if any of you has any inital comments before I spend a lot
of time on it.

The idea is that we always write the same views for alot of our
models; a list view, a detail view and add/update/delete. My
app/urls.py seem to have repeating patterns for all these views.
Generic views, class based or plain functions, do help but I still
find all the coding a bit redundant. In essence the templates are the
only thing that I really have to code manually.

Using quickview you define your model like so :


class Person(models.Model):
name = models.CharField(max_length=30)
age = models.IntegerField(default=10)

In views.py:

from models import Person
from quickview import QuickView

class PersonView(QuickView):
model = Person

And in urls.py:

from views import PersonView

# after your other patterns:
urlpattern += YourView.get_urls()


After a little syncdb and runserver you'll have an urlconfig/pattern
something like this:

myapp/person/list/$ [name='myapp-person-list']
myapp/person/add/$ [name='myapp-person-add']
myapp/person/(?P\d+)/$ [name='myapp-person-detail']
myapp/person/update/(?P\d+)/$ [name='myapp-person-update']
myapp/person/delete/(?P\d+)/$ [name='myapp-person-delete']

where myapp is the app my person-models resides in. Now you define
some templates ( list.html, detail.html, add.html, update.html,
delete.html ) in /templates/myapp/person/ and you're good to go ;-).


Todos: user authentication/login_required etc. and unittests.

The code is available at pypi ( pip install django-quickview ) or you
can browse the source at
https://bitbucket.org/weholt/django-quickview. The testsite-folder at
bitbucket contains a working example.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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




Question about not hardcoding paths in settings.py

2013-02-18 Thread frocco
Hello,
I have a site under apache www root.
www
   mysite
templates
   media
   static

I am following the two-scoops book.
The problem is that my app is looking for templates at www/templates
Here is my settings.
Thanks

from unipath import Path
PROJECT_ROOT = Path(__file__).ancestor(3)

MEDIA_ROOT = PROJECT_ROOT.child('media')
MEDIA_URL = 'http://127.0.0.1:8000/media/'

STATIC_ROOT = PROJECT_ROOT.child('static') 
STATIC_URL = '/static/'

STATICFILES_DIRS = (
PROJECT_ROOT.child('static'),
)

TEMPLATE_DIRS = (
PROJECT_ROOT.child('templates'),
)

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




Re: Error passing data from views to template

2013-02-18 Thread Jason Arnst-Goodrich
return render_to_response('home/about.html', data, 
'context_instance=RequestContext(request)')

Change that to:

return render_to_response('home/about.html', data, 
context_instance=RequestContext(request))

The context_instance is an optional keyword argument. Right now you're 
passing it as a positional string due to the quotes.

On Sunday, February 17, 2013 10:34:12 AM UTC-8, Tiago Carvalho wrote:
>
> Hello,
>
> I'm new to Django and I'm with an error, passing data from views to 
> templates.
>
> Here is the traceback: http://dpaste.com/942117/
>
> Request URL: http://localhost:8000/about/
> Django Version: 1.4.3
> Exception Type: AttributeError
> *Exception Value: 'str' object has no attribute 'update'*
> Exception Location: 
> /usr/local/lib/python2.7/dist-packages/django/template/loader.py 
> in render_to_string, line 174
>
>
> Somebody can help me, please?
>

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




Re: Migrating existing auth.User users to Django 1.5 Custom User table

2013-02-18 Thread Tom Evans
On Mon, Feb 18, 2013 at 4:33 PM, Ben Roberts  wrote:
> I assume, when Django 1.5 hits the public in 2014 >;) that many will want to
> take advantage of some facet of the new pluggable User models.  You may,
> like me,  want to add an additional column (field) or two in your custom
> User.
>
> E.g.:
>
> class SiteUser(AbstractUser):
> site = models.ForeignKey(Site, null=True)
>
>
> However, you have an exiting table of users and need to migrate them to your
> new model/table.  How? My current challenge is that I don't see any clear,
> scriptable way to do this, whether it be through South, SQL, or
> dumpdata/loaddata.
>
> Have an answer that's more than just a fleeting suggestion?  Feel free to
> grab the bounty on the Stack Overflow question if your answer works, or
> respond here if SO isn't your thing.
>

South migrations do not have to be automatically generated, there is a
rich API for making schema altering migrations:

http://south.readthedocs.org/en/latest/databaseapi.html#db-rename-table

Therefore, it simply comes down to what steps are required. Something
like this should suffice:

Add 'custom' user model that has exactly the same fields as the
current user model.
Add a schema migration to rename auth_user to the new required table name
Run your migration
Modify the user model as you see fit
Generate schema migrations as per any other model

Cheers

Tom

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




Migrating existing auth.User users to Django 1.5 Custom User table

2013-02-18 Thread Ben Roberts
I assume, when Django 1.5 hits the public in 2014 >;) that many will want 
to take advantage of some facet of the new pluggable User models.  You may, 
like me,  want to add an additional column (field) or two in your custom 
User. 

E.g.:

class SiteUser(AbstractUser):
site = models.ForeignKey(Site, null=True)


However, you have an exiting table of users and need to migrate them to 
your new model/table.  How? My current challenge is that I don't see any 
clear, scriptable way to do this, whether it be through South, SQL, or 
dumpdata/loaddata.  

Have an answer that's more than just a fleeting suggestion?  Feel free to 
grab the bounty on the Stack Overflow 
question
 if 
your answer works, or respond here if SO isn't your thing. 

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




Re: Is it necessary to restart server after a change?

2013-02-18 Thread Pankaj Singh
Hey,

so touching wsgi.py will make it reload?


Please have a look at http://en.wikipedia.org/wiki/Touch_(Unix)

*touch* is a standard Unix 
program used
> to change a file 's access
> and modification timestamps .
> It is also used to create a new empty file.


Since, timestamp of is changed, server thinks that actual wsgi script has
changed.

Detection of the change in the script file will occur at the time of the
> first request to arrive after the change has been made. The way that the
> restart is performed does not affect the handling of the request, with it
> still being processed once the daemon process has been restarted.


This is standard deployment practice.

Sincerely,
Pankaj Singh
http://about.me/psjinx


On Mon, Feb 18, 2013 at 8:43 PM, frocco  wrote:

> Thank you, so touching wsgi.py will make it reload?
> That's great, I am also learning linux. :-)
>
>
> On Monday, February 18, 2013 9:26:40 AM UTC-5, frocco wrote:
>>
>> Hello,
>>
>> In PHP, if I make a change to the database query, like adding a where
>> clause to filter only active records, the user sees the change on the next
>> browser refresh.
>> In django, it seems I have to restart the server and knock everyone off.
>>
>> I am a newbie, so is there a better way?
>> I just started a trial on webfraction
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Re: Is it necessary to restart server after a change?

2013-02-18 Thread frocco
Thank you, so touching wsgi.py will make it reload?
That's great, I am also learning linux. :-)

On Monday, February 18, 2013 9:26:40 AM UTC-5, frocco wrote:
>
> Hello,
>
> In PHP, if I make a change to the database query, like adding a where 
> clause to filter only active records, the user sees the change on the next 
> browser refresh.
> In django, it seems I have to restart the server and knock everyone off.
>
> I am a newbie, so is there a better way?
> I just started a trial on webfraction
>

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




Re: Custom Http404 like exception

2013-02-18 Thread Tom Evans
On Mon, Feb 18, 2013 at 2:41 PM, Serge G. Spaolonzi  wrote:
> Thanks Pankaj,  In this case I could not use an HttpResponse because the
> helper method I am developing doesn't return a respose it returns a dict or
> raises an exception if the user is not authenticated.
> For example:
>
> def get_server_time(request):
>   time_dictionary = helper_method()
>   #Rest of the view here
>
> def helper_method():
>  if user.is_authenticated():
> return {'server_time': server_time()}
>  else:
> raise HttpCustomException(redirect='this_login_for_this_method')
>
> The goal is to return the dictionary or redirect the user to a specific
> login screen (there would be several login screens).
> The idea is to encapsulate all this functionality in the helper method so
> the views dont have to implement the authentication part or write a
> try/catch/redirect in all the views.
>

Hi Serge

If an unhandled exception is raised from view code, then before
generating a default error response, Django will first call any
middleware that has a process_exception method, and if a response is
returned from any of them, will use that response rather than proceed
with it's standard error reporting.

Therefore, you can simply define some middleware to handle project
specific exceptions in a similar manner to Http404.

Cheers

Tom

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




Re: Django Project on Heroku

2013-02-18 Thread Thiago Avelino
for that?




Cheers,
Thiago Avelino


On Mon, Feb 18, 2013 at 11:42 AM, Jingqiang Zhang
wrote:

> http://djangoproject.herokuapp.com/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Re: Templates error on partial rendering

2013-02-18 Thread Pankaj Singh
Hey Andrea,

Please have a look at
http://stackoverflow.com/questions/4300442/show-undefined-variable-errors-in-templates

Put this in your debug settings:

class InvalidString(str):
def __mod__(self, other):
from django.template.base import TemplateSyntaxError
raise TemplateSyntaxError(
"Undefined variable or unknown value for: \"%s\"" % other)

TEMPLATE_STRING_IF_INVALID = InvalidString("%s")

This should raise an error when the template engine sees or finds an
undefined value.

Another trick is to set TEMPLATE_STRING_IF_INVALID to "%s %s" and that
will cause a formatting error to be raised.

https://docs.djangoproject.com/en/1.2/ref/templates/api/#how-invalid-variables-are-handled

Sincerely,
Pankaj Singh
http://about.me/psjinx


On Mon, Feb 18, 2013 at 4:02 PM, andrea crotti
 wrote:
> I have a case where we use django templates, but it really makes no sense to
> render the templates if a value is not passed in the contentx, and it should
> just fail..
>
> I don't find anywhere how to force that though, I understand the default of
> failing silently but there should be a way also to fail making some noise,
> right?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

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




Django Project on Heroku

2013-02-18 Thread Jingqiang Zhang
http://djangoproject.herokuapp.com/

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




Re: Custom Http404 like exception

2013-02-18 Thread Serge G. Spaolonzi
Thanks Pankaj,  In this case I could not use an HttpResponse because the
helper method I am developing doesn't return a respose it returns a dict or
raises an exception if the user is not authenticated.
For example:

def get_server_time(request):
  time_dictionary = helper_method()
  #Rest of the view here

def helper_method():
 if user.is_authenticated():
return {'server_time': server_time()}
 else:
raise HttpCustomException(redirect='this_login_for_this_method')

The goal is to return the dictionary or redirect the user to a specific
login screen (there would be several login screens).
The idea is to encapsulate all this functionality in the helper method so
the views dont have to implement the authentication part or write a
try/catch/redirect in all the views.

> get_response() method of django.core.handlers.base.BaseHandler handles
> Http404 and sets status code here -
>
https://github.com/django/django/blob/stable/1.4.x/django/core/handlers/base.py#L138-L155

This is what I wanted to know, but it seem i couldnt be able to reproduce
because it checks specifically for an exception of the kind Http404. I
think I will have to attach to a custom middleware and catch/redirect the
exceptions/views from there

btw this is for a Oauth client library.

Thanks

On Mon, Feb 18, 2013 at 11:52 AM, Pankaj Singh  wrote:
> Hey Serge,
>
> Here is a brief description of how status code is set in request response
> cycle of Django.
>
> Http404 inherits from Exception defined here -
>
https://github.com/django/django/blob/1.4.3/django/http/__init__.py#L132-L133
>
> get_response() method of django.core.handlers.base.BaseHandler handles
> Http404 and sets status code here -
>
https://github.com/django/django/blob/stable/1.4.x/django/core/handlers/base.py#L138-L155
>
> django.core.handlers.base.BaseHandler has some code for setting
status_code
> to 403 and 500 as well.
>
>> I want to make the same but with for a 401 code and a custom redirection
>> according to the resource to be accessed.
>
>
> There is really simple way to do this.
>
>
> class HttpResponseUnauthorizedRequest(HttpResponse):
>
> status_code = 401
>
>
> You can use this class similar to HttpResponse
>
>
> def protected_view(request):
> ## handle authorization
> ## if not authorized then return above response
> return HttpResponseUnauthorizedRequest("Authorazation is required")
>
>
> There are similar classes for different status code as well -
>
https://github.com/django/django/blob/stable/1.4.x/django/http/__init__.py#L751-L770
>
> Similar implementation by django-tastypie -
>
https://github.com/toastdriven/django-tastypie/blob/master/tastypie/http.py
>
> So you have set status code, now what
>
> process_response() method of django.middleware.common.CommonMiddleware
> checks if status code is 404 and sends an email to admins for broken urls
-
>
https://github.com/django/django/blob/stable/1.4.x/django/middleware/common.py#L94-L109
>
> You can see status_code based processing of response in other middlewares
as
> well, e.g. cache, http and csrf.
>
> Finally request handlers set status code is response header -
>
> 1. django.core.handlers.wsgi.WSGIHandler sets status code in response
header
> -
>
https://github.com/django/django/blob/stable/1.4.x/django/core/handlers/wsgi.py#L245-L253
>
> 2. If you are using modpython then status_code in header is set by
> django.core.handlers.modpython.ModPythonHandler -
>
https://github.com/django/django/blob/stable/1.4.x/django/core/handlers/wsgi.py#L245-L253
>
> This response is served by Webserver.
>
> Sincerely,
> Pankaj Singh
> http://about.me/psjinx
>
>
> On Mon, Feb 18, 2013 at 6:15 PM, Serge G. Spaolonzi 
> wrote:
>>
>> Hi,
>>
>> How does the Http404 exception works internally?
>> I want to make the same but with for a 401 code and a custom
>> redirection according to the resource to be accessed.
>> I have thought about using a middleware to archive this but I am not
>> sure if it is standard way used by 'django.http.Http404'.
>>
>> Thanks
>>
>> --
>> Serge G. Spaolonzi
>> Cobalys Systems
>> http://www.cobalys.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at 

error in my templates

2013-02-18 Thread Avnesh Shakya
NoReverseMatch at / 

*Reverse for 'myapp_about' with arguments '()' and keyword arguments '{}' not 
found.

i m adding here files, plz help me..

thanks in advance
*

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


{%extends "home.html"%}
{%block title%}
About
{%endblock%}
{%block content%}
	About
{%endblock%}{%extends "home.html"%}
{%block title%}
Archive
{%endblock%}
{%block content%}
	Archive
{%endblock%}{%extends "home.html"%}
{%block title%}
Contact
{%endblock%}
{%block content%}
	Contact
{%endblock%}{% extends "base.html" %}
{% block title %}
  Home Page
{%endblock%}
{%block navi%}
   home
   about
   contact
   archive
{%endblock%}
{%block content%}
	Entries:
	{%for e in entries%}
		{{e.title}}-{{e.created}} 
			{{e.text}}
		
	{%endfor%}
{%endblock%}
{%block footer%}
2013 Blog
{%endblock%}


#from django.conf.urls.defaults import *
#urlpatterns= patterns('',
#	(r'^$','myapp.views.home'),
#)

from django.conf.urls.defaults import *
urlpatterns= patterns('myapp.views',
	url(r'^$','home',name="myapp_home"),
	url(r'^about/$','about',name="myapp_about"),
	url(r'^contact/$','contact',name="myapp_contact"),
	url(r'^archive/$','archive',name="myapp_archive"),
)from django.shortcuts import render_to_response
from data.models import Entry

def home(request):
	entries=Entry.objects.published_entries().order_by('-id')
	ctx={'entries':entries}
	return render_to_response("home.html",ctx)
	
def about(request):
	return render_to_response('about.html')
	
def contact(request):
	return render_to_response('contact.html')
	
def archive(request):
	return render_to_response('archive.html')

Re: Is it necessary to restart server after a change?

2013-02-18 Thread Pankaj Singh
Hey,

Touching wsgi.py file is enough. Find more details at
http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode#Reloading_In_Daemon_Mode

Sincerely,
Pankaj Singh
http://about.me/psjinx


On Mon, Feb 18, 2013 at 7:56 PM, frocco  wrote:

> Hello,
>
> In PHP, if I make a change to the database query, like adding a where
> clause to filter only active records, the user sees the change on the next
> browser refresh.
> In django, it seems I have to restart the server and knock everyone off.
>
> I am a newbie, so is there a better way?
> I just started a trial on webfraction
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Is it necessary to restart server after a change?

2013-02-18 Thread frocco
Hello,

In PHP, if I make a change to the database query, like adding a where 
clause to filter only active records, the user sees the change on the next 
browser refresh.
In django, it seems I have to restart the server and knock everyone off.

I am a newbie, so is there a better way?
I just started a trial on webfraction

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




Re: Custom Http404 like exception

2013-02-18 Thread Pankaj Singh
Hey Serge,

Here is a brief description of how status code is set in request response
cycle of Django.

*Http404* inherits from *Exception* defined here -
https://github.com/django/django/blob/1.4.3/django/http/__init__.py#L132-L133

*get_response() method of django.core.handlers.base.BaseHandler handles
Http404 and sets status code here* -
https://github.com/django/django/blob/stable/1.4.x/django/core/handlers/base.py#L138-L155

*django.core.handlers.base.BaseHandler* has some code for setting
status_code to 403 and 500 as well.

I want to make the same but with for a 401 code and a custom redirection
> according to the resource to be accessed.


There is really simple way to do this.

class HttpResponseUnauthorizedRequest(HttpResponse):
status_code = 401


You can use this class similar to HttpResponse

def protected_view(request):
## handle authorization
## if not authorized then return above response
return HttpResponseUnauthorizedRequest("Authorazation is required")


There are similar classes for different status code as well -
https://github.com/django/django/blob/stable/1.4.x/django/http/__init__.py#L751-L770

Similar implementation by django-tastypie -
https://github.com/toastdriven/django-tastypie/blob/master/tastypie/http.py

So you have set status code, now what

*process_response()* method of
*django.middleware.common.CommonMiddleware*checks if status code is
404 and sends an email to admins for broken urls -
https://github.com/django/django/blob/stable/1.4.x/django/middleware/common.py#L94-L109

You can see status_code based processing of response in other middlewares
as well, e.g. cache, http and csrf.

Finally request handlers set status code is response header -

1. django.core.handlers.wsgi.WSGIHandler sets status code in response
header -
https://github.com/django/django/blob/stable/1.4.x/django/core/handlers/wsgi.py#L245-L253

2. If you are using modpython then status_code in header is set by
django.core.handlers.modpython.ModPythonHandler -
https://github.com/django/django/blob/stable/1.4.x/django/core/handlers/wsgi.py#L245-L253

This response is served by Webserver.

Sincerely,
Pankaj Singh
http://about.me/psjinx


On Mon, Feb 18, 2013 at 6:15 PM, Serge G. Spaolonzi wrote:

> Hi,
>
> How does the Http404 exception works internally?
> I want to make the same but with for a 401 code and a custom
> redirection according to the resource to be accessed.
> I have thought about using a middleware to archive this but I am not
> sure if it is standard way used by 'django.http.Http404'.
>
> Thanks
>
> --
> Serge G. Spaolonzi
> Cobalys Systems
> http://www.cobalys.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Templates error on partial rendering

2013-02-18 Thread andrea crotti
I have a case where we use django templates, but it really makes no sense 
to render the templates if a value is not passed in the contentx, and it 
should just fail..

I don't find anywhere how to force that though, I understand the default of 
failing silently but there should be a way also to fail making some noise, 
right?

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




Re: Jython + Django on JBoss

2013-02-18 Thread Jochen Breuer
This is something I'm particularly interested in too, since one of our 
clients has a "everything Java" policy. Now we could implement everything 
with Play!, but I would rather like to use Django and deploy to JBoss. 
Jython and Django seem to make it very easy: 
http://blog.leosoto.com/2008/08/deploying-djangojython-projects-on-j2ee.html

But is it really really stable?


Am Montag, 28. Januar 2013 21:37:28 UTC+1 schrieb Milind:
>
> Has anyone used Jython and Django and used it in full JavaEE applications 
> like JBoss? If so I would like to know how painfull/easy is it to set it 
> up. Also some info about its performance in production would be great. 
>
> Thanks, 
>
> Sent from my IPhone 
>
>

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




ask: user management for Single site, multi client apps

2013-02-18 Thread Bino Oetomo
Dear All.
I'm trying to write a single site application that will used by multi 
client.
it's about Cell Site Co-location management.

So there will be some Network operators, and some cell-Site Providers

Let's say that :
1. Network operators is : mno1, mno2, mno3, and
2. cell-site providers is : csp1, csp2, csp3.

I want that each client-admin will be able to manage their own user.
My dream is that a user will have login name like : user@mno1, user@csp3 
and so on.
the part after '@'sign, will be used to authorize, filter and/or 
set-default-values on some view/form
Clients will share 'same apps', but with different constraints.

Kindly please tell me how todo it, or at least point me to starting point.

Sincerely
-bino- 

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




Custom Http404 like exception

2013-02-18 Thread Serge G. Spaolonzi
Hi,

How does the Http404 exception works internally?
I want to make the same but with for a 401 code and a custom
redirection according to the resource to be accessed.
I have thought about using a middleware to archive this but I am not
sure if it is standard way used by 'django.http.Http404'.

Thanks

--
Serge G. Spaolonzi
Cobalys Systems
http://www.cobalys.com

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




Re: django guru

2013-02-18 Thread Mike Dewhirst

On 18/02/2013 6:50pm, Mike Dewhirst wrote:

I'm looking for a Django guru to help with some debugging.


As suggested by Russell here is some detail ...

The design is moderately complex with all business rules built into 
model methods. The prototype is well advanced and based entirely on 
Django Admin. That means the debugging is all server-side backend.


While I'm happy enough with 80% - 90% of the schema there is undoubtedly 
room to improve it. The requirements are well specified.


The prototype stack is in Melbourne, Australia, on Django 1.4, Python 
2.7, Postgres 9.1, Subversion, Buildbot and Trac. Development is on 
Windows XP with the dev server and demonstration is on Ubuntu 12.04 LTS 
with Apache 2.2.


Committing a change on Win XP to subversion automatically triggers 
buildbot on Ubuntu to blow the demo site away, export the entire site 
from subversion, run 200+ unit tests and touch the wsgi file.


Mike



Please contact me off-list for details. I'm constrained by
non-disclosure so I can't reveal anything on the list.

Thanks

Mike



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




Re: Django 1.5 AbstractBaseUser with char primary key not JSON serializable

2013-02-18 Thread Kaloian
Hi Russel,

Great to see this documented. I will most probably go with the "api_key *in 
addition* to the integer primary key" solution to avoid additional problems.

Thanks,
Kaloian

On Saturday, February 16, 2013 4:25:41 AM UTC+2, Russell Keith-Magee wrote:
>
> Hi Kaloian,
>
> Ah - you've just fired a neuron in my brain… This is a known issue, and 
> it's not just the permission_required decorator.
>
> See ticket #14881.
>
> I don't remember the permission_required decorator itself being a problem 
> at that time (not saying it isn't -- just that it wasn't reported as such, 
> or I don't recall it being reported as such) -- the issues that were being 
> reported were with admin URLs for User objects, and for password reset 
> tokens. 
>
> So - the short answer is that yes, non-integer primary keys will cause 
> some problems with custom User objects. This is something we should 
> probably document as a limitation. I've just added a note to this effect in 
> the docs.
>
> This doesn't mean you have to give up having the api_key as a unique 
> identifier; you just need to have the api_key *in addition* to the integer 
> primary key; Django's internals will use the integer primary key, and your 
> code can do lookups based on the API key.
>
> Of course, we're also open to patches to fix the situation :-)
>
> Yours,
> Russ Magee %-)
>
> On Fri, Feb 15, 2013 at 9:48 PM, Kaloian  > wrote:
>
>>
>> Hi Russel I got into another small issue related to the character primary 
>> key of the user model. 
>> When I try to use the permission_required decorator on that model I got 
>> the following error. 
>>
>> Exception Value: 
>>
>> invalid literal for int() with base 10: 
>> '3DDz0Vi7zonFDq9JfByKkeparghaWwupVwbMCbL7JHo'
>>
>>  Exception Location: 
>> /usr/local/lib/python2.7/dist-packages/django/db/models/fields/__init__.py 
>> in get_prep_value, line 554
>> Here is the latest definition of my model: 
>>
>> class Merchant(AbstractBaseUser,PermissionsMixin):  
>> """User with app settings."""
>> id = models.CharField(max_length=256, primary_key=True)
>> email = models.EmailField(unique=True, db_index=True)
>>
>> company_name = models.CharField(max_length=256)
>> website = models.URLField()
>> description = models.TextField(blank=True)
>> #api_key = models.CharField(blank=True, max_length=256, 
>> primary_key=True)   
>>   
>> USERNAME_FIELD = 'email'  
>> REQUIRED_FIELDS = ['company_name','website']
>>
>> objects = MerchantManager()
>>
>>
>> class Meta:
>> verbose_name = _('Merchant')
>> verbose_name_plural = _('Merchants')
>>
>>
>>
>>
>> I can easily find workaround for that problem by writing custom decorator 
>> for example but I am not sure this is supposed to be this way. Or may be I 
>> am missing something here ? 
>>
>> Thanks,
>> Kaloian
>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

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




Re: Conflict of admin applications for jquery

2013-02-18 Thread Pankaj Singh
Hey,

By default, Django's Admin moves the jQuery namespace into a custom one,
django.jQuery, to prevent conflicts[1]. So core of django admin won't get
affected until and unless you override django.jQuery.

I understand why developers plug in latest jquery version, but why Django
> is stuck with jQuery 1.4?


As you can see on Github[2], last change to some javascript files was 2
years ago. That's why admin still has jQuery 1.4.2 which was released on
February 19, 2010 [4].

Migrating to a newer release will require a lot of effort (which may not be
worth it), that's why Django is stuck with jQuery 1.4.2.

Further, many people use django-grappelli[5] and django-admin-tools[6]
nowadays to replace default admin interface.

By the way, django-markitup uses settings.JQUERY_URL[3]. If you want to use
a specific version of jQuery then you can specify that in settings.py.

Links:
1.
https://github.com/django/django/blob/1.4.3/django/contrib/admin/static/admin/js/jquery.init.js
2.
https://github.com/django/django/tree/master/django/contrib/admin/static/admin/js
3. http://goo.gl/Mhwlj
4. http://en.wikipedia.org/wiki/JQuery#Release_history
5. http://www.grappelliproject.com/
6. http://django-admin-tools.readthedocs.org/en/latest/

Sincerely,
Pankaj Singh
http://about.me/psjinx


On Sun, Feb 17, 2013 at 1:11 PM, Владимир Паль  wrote:

> Hi, I have following problem.
> It is quite often that django admin plugins include their own version of
> jquery and it is not possible to use them together.
>
> For example: django-markitup and django-sortable. Is there any way to get
> around the issue? Do I need to rewrite plugin(s) to use noConflict?
>
> I understand why developers plug in latest jquery version, but why Django
> is stuck with jQuery 1.4?
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Re: Error passing data from views to template

2013-02-18 Thread Pankaj Singh
Hey Tiago,


> Exception Value: 'str' object has no attribute 'update'


It means that context_instance variable passed to render_to_string() is of
str type. context_instance needs to be an instance of
django.template.context.Context class.

Example use of render_to_string -

from django.template.loader import render_to_string
rendered = render_to_string('my_template.html', { 'foo': 'bar' })


Django docs -
https://docs.djangoproject.com/en/1.4/ref/templates/api/#the-render-to-string-shortcut

If interested, you can have a look at source code for Context class (
https://github.com/django/django/blob/1.4.3/django/template/context.py#L84).

Sincerely,
Pankaj Singh
http://about.me/psjinx


On Mon, Feb 18, 2013 at 12:04 AM, Tiago Carvalho wrote:

> Hello,
>
> I'm new to Django and I'm with an error, passing data from views to
> templates.
>
> Here is the traceback: http://dpaste.com/942117/
>
> Request URL: http://localhost:8000/about/
> Django Version: 1.4.3
> Exception Type: AttributeError
> *Exception Value: 'str' object has no attribute 'update'*
> Exception Location: 
> /usr/local/lib/python2.7/dist-packages/django/template/loader.py
> in render_to_string, line 174
>
>
> Somebody can help me, please?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Re: django guru

2013-02-18 Thread Russell Keith-Magee
Hi Mike,

Non-disclosure might prevent you from giving out specifics about the client
and the project, but some basic, non-specific details will help you get
much better responses -- Where is the job located? Are they open to
telecommuting? If so, what timezone are they in? Is it a backend/server
side problem? A database problem? A front-end problem?

Yours,
Russ Magee %-)

On Mon, Feb 18, 2013 at 3:50 PM, Mike Dewhirst wrote:

> I'm looking for a Django guru to help with some debugging.
>
> Please contact me off-list for details. I'm constrained by non-disclosure
> so I can't reveal anything on the list.
>
> Thanks
>
> Mike
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 
> django-users+unsubscribe@**googlegroups.com
> .
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at 
> http://groups.google.com/**group/django-users?hl=en
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out
> .
>
>
>

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