Re: first project taking it too production server

2009-11-16 Thread Amit Sethi
yes I do have ssh access and the server does have python on it.

On Tue, Nov 17, 2009 at 7:02 AM, Kenneth Gonsalves  wrote:
> On Monday 16 Nov 2009 7:41:47 pm Amit Sethi wrote:
>> Hi , I just developed my first small app using django , I wish to
>> deploy it . I have a apache server with drupal running on it . Can
>> anybody guide me about the procedure i should use to deploy the
>> project without disturbing the drupal installation in any way...
>>
>
> do you have shell access? is python *really* available (not just the binary,
> but all the modules?
> --
> regards
> Kenneth Gonsalves
> Senior Project Officer
> NRC-FOSS
> http://nrcfosshelpline.in/web/
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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=.
>
>
>



-- 
A-M-I-T S|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-us...@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=.




Re: Making the case for Django (vs. Drupal)

2009-11-16 Thread andreas schmid
hi mike,

sry i dont want to be unkind but could you please turn the mail delivery
confirmation off when you write to a list?!

thx

Mike Ramirez wrote:
> On Monday 16 November 2009 20:12:57 Kenneth Gonsalves wrote:
>   
>> anyway, in pitching for django (in particular), python and postgresql in
>> general, I put safe code as number one in the list. And I personally am
>> confident (after seeing the work done in the last 5 years in django, python
>>  and postgresql) that this will remain. Holes will appear - but I have a
>>  feeling they will be few and far between and patched fast too. This is
>>  what I tell people.
>>
>> 
>
> Agreed all the way across.
>
> One of the reasons I use django is because it's hard to shoot yourself in the 
> foot and by making sure the lower level apis is where most of the important 
> security features we all want live, and makes customizing our own special 
> ones 
> easy.  Python, well it's the love of the language, postgresql cause of the 
> features it has, has had them a lot longer than mysql and a nicer memory 
> footprint. 
>
> And the latter part of your statement is exactly why we all think that open 
> source software is more secure than propietary software and swear by it.
>
> Mike
>   

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Help with manage.py syncdb

2009-11-16 Thread Kenneth Gonsalves
On Tuesday 17 Nov 2009 11:10:15 am jd_python wrote:
>  raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: No module named MySQLdb
> 

you did not install MySQLdb which is the python module used to connect to 
mysql - or maybe you installed it wrong. (usually the last line of a traceback 
tells you what you did wrong)
-- 
regards
Kenneth Gonsalves
Senior Project Officer
NRC-FOSS
http://nrcfosshelpline.in/web/

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Django and reportlab table question

2009-11-16 Thread Kenneth Gonsalves
On Tuesday 17 Nov 2009 11:29:25 am adelaide_mike wrote:
> Can anyone give me a push in the right direction?  Thanks for any
> help.
> 

practical example:
http://bitbucket.org/gopalasivam/fida/src/tip/web/views.py

line 194 onwards (not necessarily good code, but there are a lot of things 
like different languages, types etc.
-- 
regards
Kenneth Gonsalves
Senior Project Officer
NRC-FOSS
http://nrcfosshelpline.in/web/

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Help with manage.py syncdb

2009-11-16 Thread jd_python
Hello there,

I am a newbie learning Python/Django...

Am using the following tutorial located at:

http://bit.ly/eIdT

Created a mysite database in MySQL 5 running on Snow Leopard.

Edited the settings.py file to look like this:

DATABASE_ENGINE = 'mysql'   # 'postgresql_psycopg2',
'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'mysite' # Or path to database file if
using sqlite3.
DATABASE_USER = 'root' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost.
Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not
used with sqlite3.

Now when I run the following command:

python manage.py syncdb

I receive the following error:

Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/management/__init__.py", line 362,
in execute_manager
utility.execute()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/management/__init__.py", line 303,
in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/management/base.py", line 195, in
run_from_argv
self.execute(*args, **options.__dict__)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/management/base.py", line 221, in
execute
self.validate()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/management/base.py", line 249, in
validate
num_errors = get_validation_errors(s, app)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/management/validation.py", line
22, in get_validation_errors
from django.db import models, connection
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/db/__init__.py", line 41, in 
backend = load_backend(settings.DATABASE_ENGINE)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/db/__init__.py", line 17, in
load_backend
return import_module('.base', 'django.db.backends.%s' %
backend_name)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/utils/importlib.py", line 35, in
import_module
__import__(name)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/db/backends/mysql/base.py", line 13, in

raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
module: No module named MySQLdb
u...@valkyrie:~/DevProjects/Python/mysite $ mate .
u...@valkyrie:~/DevProjects/Python/mysite $ python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/management/__init__.py", line 362,
in execute_manager
utility.execute()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/management/__init__.py", line 303,
in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/management/base.py", line 195, in
run_from_argv
self.execute(*args, **options.__dict__)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/management/base.py", line 221, in
execute
self.validate()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/management/base.py", line 249, in
validate
num_errors = get_validation_errors(s, app)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/core/management/validation.py", line
22, in get_validation_errors
from django.db import models, connection
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/db/__init__.py", line 41, in 
backend = load_backend(settings.DATABASE_ENGINE)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/db/__init__.py", line 17, in
load_backend
return import_module('.base', 'django.db.backends.%s' %
backend_name)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/utils/importlib.py", line 35, in
import_module
__import__(name)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/django/db/backends/mysql/base.py", line 13, in

raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)

Django developer needed in Sydney

2009-11-16 Thread roxitman
Hi, we are looking to install and setup Django for our school in
Sydney, Australia.
Looking for advice as well as someone to help design, install and
configure it.
Please contact me at roxit...@gmail.com if you live in Sydney and have
skills with Django.

Paul Lister
Director ICT, The Scots College

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Django and reportlab table question

2009-11-16 Thread Andy McKay
On 09-11-16 9:59 PM, adelaide_mike wrote:
> I am attempting to user ReportLab with Django to make a report
> displaying my data in a tabular format.
[..]
>  ['Conclusion','Run!']

Loop through your vehicles as your simple naive start, eg:

data = []
for vehicle in vehicles:
 data.append([vehicle.ve_name, vehicle.ve_type])

Then expand. Looping through your query set and your models is pretty 
much the same be it reportlab or not.
-- 
   Andy McKay, @clearwind
   Training: http://clearwind.ca/training/

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Django and reportlab table question

2009-11-16 Thread adelaide_mike
I am attempting to user ReportLab with Django to make a report
displaying my data in a tabular format.

An example model is:

class Vehicle(models.Model):
ve_name = models.CharField(max_length=20)
ve_type = models.CharField(max_length=20)

My report generating view a copy of the example in the ReportLab
docs.  I have marked my sticking point with '''

def testX(request):
# Our container for 'Flowable' objects
elements = []
# A large collection of style sheets pre-made for us
styles = getSampleStyleSheet()

# A basic document for us to write to 'rl_hello_table.pdf'
doc = SimpleDocTemplate('rl_hello_table.pdf')

elements.append(Paragraph("Vehicle Summary", styles['Title']))

vehicles = Vehicle.objects.all()

'''the question is how to modify the following lines to read the data
from vehicles rather than use the hard coded data shown in the
example'''

 data = [['Caves', 'Wumpus Population'],
['Deep Ditch',50],
['Death Gully',   5000],
['Dire Straits',  600],
['Deadly Pit',5],
['Conclusion','Run!']]

'''after that, I think I can sort out the following'''
# First the top row, with all the text centered and in Times-Bold,
# and one line above, one line below.
ts = [('ALIGN', (1,1), (-1,-1), 'CENTER'),
('LINEABOVE', (0,0), (-1,0), 1, colors.purple),
('LINEBELOW', (0,0), (-1,0), 1, colors.purple),
('FONT', (0,0), (-1,0), 'Times-Bold'),

# The bottom row has one line above, and three lines below of
# various colors and spacing.
('LINEABOVE', (0,-1), (-1,-1), 1, colors.purple),
('LINEBELOW', (0,-1), (-1,-1), 0.5, colors.purple, 1, None,
None, 4,1),
('LINEBELOW', (0,-1), (-1,-1), 1, colors.red),
('FONT', (0,-1), (-1,-1), 'Times-Bold')]

# Create the table with the necessary style, and add it to the
# elements list.
table = Table(data, style=ts)
elements.append(table)

Can anyone give me a push in the right direction?  Thanks for any
help.

Mike

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: mod_wsgi error which i have no idea how to fix

2009-11-16 Thread Graham Dumpleton


On Nov 17, 10:58 am, Damon Jablons  wrote:
> Hey,
>
> I'm running Nginx which proxies Apache and on my website, I get the
> following error when I tail the Apache log:
>
> [Mon Nov 16 23:51:08 2009] [error] [client 127.0.0.1] No WSGI daemon
> process called 'sub.domain.net' has been configured: /var/www/django/
> scribblitt/deploy/domain.wsgi

Is 'sub.domain.net' really what you use in your configuration or have
you changed the name to protect what you are using?

In this case it is critical that the unmodified original configuration
is seen because you changing names to protect stuff could have
destroyed parts of the original configuration that show the problem.

Anyway, the basis of the error message is that for whatever value you
have set WSGIProcessGroup, there is no corresponding WSGIDaemonProcess
directive of the same name to match against.

BTW, state what version of mod_wsgi you are using and make sure you
aren't using mod_wsgi older than 2.4 in case you are getting hit by
rare configuration corruption bug.

Graham

> Here's my Apache config for this site:
> 
>     #Basic setup
>     ServerAdmin w...@domain.net
>     ServerNamewww.sub.domain.net
>     ServerAlias sub.domain.net
>
>     
>         Order deny,allow
>         Allow from all
>     
>
>     LogLevel warn
>     ErrorLog  /var/log/apache2/sub.domain.net.error.log
>     CustomLog /var/log/apache2/sub.domain.net.log common
>
>     WSGIDaemonProcess sub.domain.net user=www-data group=www-data
> threads=25
>     WSGIProcessGroup sub.domain.net
>
>     WSGIScriptAlias / /var/www/django/domain/deploy/domain.wsgi
> 
>
> Thinking permissions were the problem, I ran: # chown -Rf www-data:www-
> data /var/www/django/
> and then: # chmod -Rf 755 /var/www/django/
> after restarting Apache, I receive the same error.
>
> Here's my wsgi file:
> import os
> import sys
> import site
>
> os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
> os.environ['PYTHON_EGG_CACHE'] = '/var/www/django/.python-eggs'
>
> site.addsitedir('/var/www/django/domani/env/lib/python2.6/site-
> packages')
> sys.path.append('/var/www/django/domain/src')
>
> import django.core.handlers.wsgi
> _application = django.core.handlers.wsgi.WSGIHandler()
>
> def application(environ, start_response):
>         environ['wsgi.url_scheme'] = environ.get('HTTP_X_URL_SCHEME',
> 'http')
>    return _application(environ, start_response)
>
> Any ideas?
>
> Thanks in advance.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Confusing error: AttributeError: 'Settings' object has no attribute 'rindex'.

2009-11-16 Thread Gene
Thanks for your help!

Indeed a {% url %} tag was calling a view directly with the
unfortunate name 'settings', which I had renamed. (named url patterns
ftw)

On Nov 16, 9:05 pm, Karen Tracey  wrote:
> On Mon, Nov 16, 2009 at 8:02 PM, Gene  wrote:
> > I'm getting an error that has completely perplexed me: AttributeError:
> > 'Settings' object has no attribute 'rindex'.
>
> > The complete traceback is listed below. I get this for any request but
> > a root request '/'. I'm, using Django 1.1 with mod_wsgi.
>
> > The only cases I could find por google of others running into this
> > error was a few years back in the django 0.95 to 0.96 upgrade- and the
> > solution- upgrade to 0.96 :/
>
> > Traceback (most recent call last):
>
> >  File "/home/username/webapps/django/lib/python2.5/django/shortcuts/
> > __init__.py", line 20, in render_to_response
> >    return HttpResponse(loader.render_to_string(*args, **kwargs),
> > **httpresponse_kwargs)
>
> > [snip bunches of template render stuff]
> >  File "/home/username/webapps/django/lib/python2.5/django/template/
> > __init__.py", line 792, in render_node
> >    return node.render(context)
>
> >  File "/home/username/webapps/django/lib/python2.5/django/template/
> > defaulttags.py", line 370, in render
> >    url = reverse(self.view_name, args=args, kwargs=kwargs,
> > current_app=context.current_app)
>
> This is Django processing a {% url %} tag in the template.  {% url %} does
> reverse mapping and requires that the entire URLconf be valid.
>
>
>
>
>
>
>
> >  File "/home/username/webapps/django/lib/python2.5/django/core/
> > urlresolvers.py", line 350, in reverse
> >    *args, **kwargs)))
>
> >  File "/home/username/webapps/django/lib/python2.5/django/core/
> > urlresolvers.py", line 275, in reverse
> >    possibilities = self.reverse_dict.getlist(lookup_view)
>
> >  File "/home/username/webapps/django/lib/python2.5/django/core/
> > urlresolvers.py", line 195, in _get_reverse_dict
> >    self._populate()
>
> >  File "/home/username/webapps/django/lib/python2.5/django/core/
> > urlresolvers.py", line 175, in _populate
> >    for name in pattern.reverse_dict:
>
> >  File "/home/username/webapps/django/lib/python2.5/django/core/
> > urlresolvers.py", line 195, in _get_reverse_dict
> >    self._populate()
>
> >  File "/home/username/webapps/django/lib/python2.5/django/core/
> > urlresolvers.py", line 187, in _populate
> >    lookups.appendlist(pattern.callback, (bits, p_pattern))
>
> >  File "/home/username/webapps/django/lib/python2.5/django/core/
> > urlresolvers.py", line 136, in _get_callback
> >    mod_name, func_name = get_mod_func(self._callback_str)
>
> >  File "/home/username/webapps/django/lib/python2.5/django/core/
> > urlresolvers.py", line 80, in get_mod_func
> >    dot = callback.rindex('.')
>
> >  File "/home/username/webapps/django/lib/python2.5/django/utils/
> > functional.py", line 273, in __getattr__
> >    return getattr(self._wrapped, name)
>
> > AttributeError: 'Settings' object has no attribute 'rindex'
>
> Ultimately when trying to initially populate the reverse dictionary for
> reverse url resolution, the code ran into a situation where instead of an
> expected callable or string that could be resolved into a callable, a
> Settings object was found.
>
> So, there's something wrong in the overall URLconf.  Possibly the local
> variables you could access from the stack trace on a debug page would point
> you toward which one.
>
> Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Making the case for Django (vs. Drupal)

2009-11-16 Thread Melvyn Sopacua
On Tue, 17 Nov 2009 07:38:35 +0530, Kenneth Gonsalves 
wrote:
> On Monday 16 Nov 2009 10:44:27 pm Mike Ramirez wrote:
>> > it is precisely this assumption that does not seem logical to me. But
>> >  frankly I do not know how to counter it ;-)
>> > 
>> 
>> How is it not logical?  Product A is widely used, Product B is used
less.
>>  Bad  Guy A. is smart enough to realize that product A if broken can be
>>  used to gain him more presents because more users have it.
>> 
> 
> so if we follow your logic to the inevitable conclusion, the moment the
bad
> 
> guys train their weapons on django it is going to be shot as full of
holes
> as 
> drupal (or even phpbb).

Wrong conclusion. Attackers cannot shoot holes, they can only expose them.
There are definitely design decisions you can make to prevent holes, one of
the obvious ones is to validate user input.
There are two assumptions made in this discussion that are not absolute
truths:
1) If an application receives more attention from critical eyes, it is more
   secure as it lessens the chance that mistakes have been left in
releases.
   However, this doesn't exclude the possibility that there are no mistakes
   to be found to begin with or even that these eyes find them or that they
   are practical security risks. MD5 is a good example. It has been secure
   for many years, because the computational power wasn't there to make
   any practical attack vectors.
2) If something is used more, it becomes more of a target. This still
doesn't
   exclude the possibility that an attacker will never find your machine.


-- 
Melvyn Sopacua

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: DB table hook/callback

2009-11-16 Thread Andy McKay
On 09-11-16 9:01 PM, Ishwor Gurung wrote:
> "Django includes a “signal dispatcher” which helps allow decoupled
> applications get notified when actions occur elsewhere in the
> framework." The word "framework" is I think the key here. Right?

Correct, signals won't help spot changes in the database that do not 
pass through Django.

> A way which I think this can work is having field within the db that
> gets polled every say 5 minutes OR using database triggers as a
> callback (this one is the one I want to implement but is it even
> possible?)

I've done something similar to this in the past so I can integrate Plone 
(which pushes straight to the db) with Django. I have a database trigger 
that writes to an audit log table. That table has a matching Django 
model. So then I have a cron job that runs every couple of minutes, 
looking for any changes on the table and then does some work (in this 
case updating navigation and search).

This lets me stay in the Django ORM as much as possible, with the 
addition of just one trigger.
-- 
   Andy McKay, @clearwind
   Training: http://clearwind.ca/training/

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Confusing error: AttributeError: 'Settings' object has no attribute 'rindex'.

2009-11-16 Thread Karen Tracey
On Mon, Nov 16, 2009 at 8:02 PM, Gene  wrote:

> I'm getting an error that has completely perplexed me: AttributeError:
> 'Settings' object has no attribute 'rindex'.
>
> The complete traceback is listed below. I get this for any request but
> a root request '/'. I'm, using Django 1.1 with mod_wsgi.
>
> The only cases I could find por google of others running into this
> error was a few years back in the django 0.95 to 0.96 upgrade- and the
> solution- upgrade to 0.96 :/
>
> Traceback (most recent call last):
>
>  File "/home/username/webapps/django/lib/python2.5/django/shortcuts/
> __init__.py", line 20, in render_to_response
>return HttpResponse(loader.render_to_string(*args, **kwargs),
> **httpresponse_kwargs)
>
> [snip bunches of template render stuff]
>  File "/home/username/webapps/django/lib/python2.5/django/template/
> __init__.py", line 792, in render_node
>return node.render(context)
>
>  File "/home/username/webapps/django/lib/python2.5/django/template/
> defaulttags.py", line 370, in render
>url = reverse(self.view_name, args=args, kwargs=kwargs,
> current_app=context.current_app)
>

This is Django processing a {% url %} tag in the template.  {% url %} does
reverse mapping and requires that the entire URLconf be valid.


>
>  File "/home/username/webapps/django/lib/python2.5/django/core/
> urlresolvers.py", line 350, in reverse
>*args, **kwargs)))
>
>  File "/home/username/webapps/django/lib/python2.5/django/core/
> urlresolvers.py", line 275, in reverse
>possibilities = self.reverse_dict.getlist(lookup_view)
>
>  File "/home/username/webapps/django/lib/python2.5/django/core/
> urlresolvers.py", line 195, in _get_reverse_dict
>self._populate()
>
>  File "/home/username/webapps/django/lib/python2.5/django/core/
> urlresolvers.py", line 175, in _populate
>for name in pattern.reverse_dict:
>
>  File "/home/username/webapps/django/lib/python2.5/django/core/
> urlresolvers.py", line 195, in _get_reverse_dict
>self._populate()
>
>  File "/home/username/webapps/django/lib/python2.5/django/core/
> urlresolvers.py", line 187, in _populate
>lookups.appendlist(pattern.callback, (bits, p_pattern))
>
>  File "/home/username/webapps/django/lib/python2.5/django/core/
> urlresolvers.py", line 136, in _get_callback
>mod_name, func_name = get_mod_func(self._callback_str)
>
>  File "/home/username/webapps/django/lib/python2.5/django/core/
> urlresolvers.py", line 80, in get_mod_func
>dot = callback.rindex('.')
>
>  File "/home/username/webapps/django/lib/python2.5/django/utils/
> functional.py", line 273, in __getattr__
>return getattr(self._wrapped, name)
>
> AttributeError: 'Settings' object has no attribute 'rindex'
>

Ultimately when trying to initially populate the reverse dictionary for
reverse url resolution, the code ran into a situation where instead of an
expected callable or string that could be resolved into a callable, a
Settings object was found.

So, there's something wrong in the overall URLconf.  Possibly the local
variables you could access from the stack trace on a debug page would point
you toward which one.

Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




DB table hook/callback

2009-11-16 Thread Ishwor Gurung
Hi folks,
Is there any way in Django to have a global hook (not Python hook, an
architecture hook rather :-) on a database table?

I want to get notifications in my django layer of changes in DB i.e.
whenever theres an update/delete. Is this feasible or am I heading the
wrong way?

The doc[1] says -
"Django includes a “signal dispatcher” which helps allow decoupled
applications get notified when actions occur elsewhere in the
framework." The word "framework" is I think the key here. Right?

pre-save,post-save amongst others..in Django is I think no good here
because the data does not get changed via save( )/create( )/... within
the our code (database tables get updated through other means)

A way which I think this can work is having field within the db that
gets polled every say 5 minutes OR using database triggers as a
callback (this one is the one I want to implement but is it even
possible?)
Maybe I am trying visualizing a bit beyond what Django is capable of
hmm.. Any thoughts / suggestions / recommendation? Thanks a lot.

[1] http://docs.djangoproject.com/en/dev/topics/signals/
-- 
Regards,
Ishwor Gurung

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Making the case for Django (vs. Drupal)

2009-11-16 Thread Mike Ramirez
On Monday 16 November 2009 20:12:57 Kenneth Gonsalves wrote:
> anyway, in pitching for django (in particular), python and postgresql in
> general, I put safe code as number one in the list. And I personally am
> confident (after seeing the work done in the last 5 years in django, python
>  and postgresql) that this will remain. Holes will appear - but I have a
>  feeling they will be few and far between and patched fast too. This is
>  what I tell people.
> 

Agreed all the way across.

One of the reasons I use django is because it's hard to shoot yourself in the 
foot and by making sure the lower level apis is where most of the important 
security features we all want live, and makes customizing our own special ones 
easy.  Python, well it's the love of the language, postgresql cause of the 
features it has, has had them a lot longer than mysql and a nicer memory 
footprint. 

And the latter part of your statement is exactly why we all think that open 
source software is more secure than propietary software and swear by it.

Mike
-- 
Talkers are no good doers.
-- William Shakespeare, "Henry VI"


signature.asc
Description: This is a digitally signed message part.


Re: Django i18n

2009-11-16 Thread Carlos Ricardo Santos
I think pt-BR will fit. Just can't understand why the backoffice is
translated and the main app not : (
Even in pt-Pt.

On Nov 17, 2009 2:30 AM, "Kenneth Gonsalves"  wrote:

On Monday 16 Nov 2009 9:46:58 pm Carlos Ricardo Santos wrote: > I use to
folders at app/locale: > >...
I have implemented english ;-) I assume you mean implementing a non-english
language? This support has been there since 2005, and I have implemented
sites
in finnish, tamil also. One thing is that unless django itself has the
language
translated, i18n will not work. I do not see pt-PT, I only see pt and pt-BR.
Perhaps you can try one of those - or translate django in pt-PT. If you have
done everything else correctly, it should work.
--
regards
Kenneth Gonsalves
Senior Project Officer
NRC-FOSS
http://nrcfosshelpline.in/web/

-- You received this message because you are subscribed to the Google Groups
"Django users" group

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: order_by related models

2009-11-16 Thread Karen Tracey
On Mon, Nov 16, 2009 at 5:41 PM, dave.l
wrote:

> Hi!
>
> The following line in my application seems to have stopped working as
> I expect:
>
>   for object in self.queryset.select_related().order_by
> ("app_building.principal_name", "reference"):
>
> the first ordering term on principal_name is no longer working.  by
> looking at ...query.as_sql() I can see the ORDER BY is not being
> added.
>
> According to the docs:
>
>   New in Django 1.0: Please, see the release notes
>
>   The syntax for ordering across related models has changed. See the
> Django 0.96 documentation for the old behaviour.
>
> but I cannot find any reference to the new syntax
>


 From a couple of paragraphs above that note, in the description of order_by
here:

http://docs.djangoproject.com/en/dev/ref/models/querysets/#order-by-fields

To order by a field in a different model, use the same syntax as when you
are querying across model relations. That is, the name of the field,
followed by a double underscore (__), followed by the name of the field in
the new model, and so on for as many models as you want to join. For
example:

Entry.objects.order_by('blog__name', 'headline')

Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Django/GoDaddy

2009-11-16 Thread mkumm
Thanks everyone. I was able to resolve my issues by getting the
easy_install tools and then using that to update MySQL. phew!


On Nov 16, 10:07 am, "Mark (Nosrednakram)" 
wrote:
> I'd check rpmforge 
> see:http://wiki.centos.org/AdditionalResources/Repositories/RPMForge
> for centos notes
>
> On Nov 15, 3:27 pm, mkumm  wrote:
>
>
>
> > Colin thanks - I will try installing all of the -devel stuff. ha - 2.4
> > - thanks!
>
> > On Nov 15, 2:32 pm, Colin Bean  wrote:
>
> > > On Sun, Nov 15, 2009 at 6:15 AM, mkumm  wrote:
> > > > I recently took on a new project for a new client where I was forced
> > > > into using aGoDaddyVirtual Server (literally it was a deal breaker).
> > > > Anyway I have configured about 1/2 dozen servers to run django - but I
> > > > am stumped on this. I am looking for help from anyone who may have
> > > > this experience.
> > > > Server: CentOS 5
> > > > Python 1.4
> > > > Django 1.1.1
>
> > > > 1. mod_wsgi was not available so I tried to compile from source. The
> > > > apache apsx was not available and other attempts to config failed. I
> > > > grabbed the apache source-dev to get the apsx, but the config failed.
> > > > No problem I moved on to mod_python
>
> > > > 2. Attempted to launch the app and got an error that there was no
> > > > pysqlite2, they had the previous version. I pulled the latest version
> > > > but again had failed at config. I moved to mysql and again the version
> > > > that was available on yum was too old and trying to compile by the
> > > > newer version failed at config.
>
> > > > Their technical support person was mean and less helpful than a sharp
> > > > stick.
>
> > > > In short: I can't compile any of the necessary components, all of the
> > > > yum updates are too old. My only other options for server are Cent OS
> > > > 4 and Fedora Core 7 (I come from the Debian World mostly). Any
> > > > recommendations?
>
> > > > --
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "Django users" group.
> > > > To post to this group, send email to django-us...@googlegroups.com.
> > > > To unsubscribe from this group, send email to 
> > > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group 
> > > > athttp://groups.google.com/group/django-users?hl=.
>
> > > If it's a normal CentOS 5 install you should be able to yum install
> > > httpd-devel to get aspx.  If your pysqlite build is failing because of
> > > prerequisites, there might be other development packages that you
> > > could install with yum (python-devel at the very least, probabaly
> > > sqlite-devel too).  'yum search' is helpful for finding out what
> > > packages are out there.
>
> > > Also are you really running python 1.4?
>
> > > Colin

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Making the case for Django (vs. Drupal)

2009-11-16 Thread Kenneth Gonsalves
On Tuesday 17 Nov 2009 8:46:31 am Mike Ramirez wrote:
>   On Monday 16 November 2009 18:08:35 Kenneth Gonsalves wrote:
> > On Monday 16 Nov 2009 10:44:27 pm Mike Ramirez wrote:
> > > > it is precisely this assumption that does not seem logical to me. But
> > > >  frankly I do not know how to counter it ;-)
> > >
> > > How is it not logical?  Product A is widely used, Product B is used
> > > less. Bad  Guy A. is smart enough to realize that product A if broken
> > > can be used to gain him more presents because more users have it.
> >
> > 
> > so if we follow your logic to the inevitable conclusion, the moment the
> > bad guys train their weapons on django it is going to be shot as full of
> > holes as drupal (or even phpbb).
> 
> No, I did say 'product A if broken' -- keyword being if.
> 
> But Bad Guy A will try everything to put holes in django, and whats worse
>  is  that he'll have a different perspective than you or I and might see
>  something that we didn't or someone else didn't and walla, we have a
>  hole.  We all know there is potential for security problems in well
>  established software that aren't discovered today, because of this and
>  human error in future revisions and changes. Now am I saying the django
>  devs are lazy or incompetent?  If I really believed that I would be using
>  something else and calling you all idiots for using a badly developed
>  piece of software. No, I'm calling them human, if they aren't human, then
>  well aliens are finally proven.
> 
> >  In which case why are the devels focussing so
> >  much of their time trying to make the app safe and secure?
> >  Should they not
> >  be better of lighting candles in the rain and praying that the bad guys
> >  radar doesn't function?
> >  I personally am of the opinion that constant
> >  harping on safe practices and not doing silly things like permitting
> > code inside html (for example) will create an inherently safer app - and
> > the bad guys will congregate elsewhere. After all bitbucket is big enough
> > to be on their radar - and it got hosed - although I hear that was an
> > amazon problem, not a django issue (could be wrong).
> > 
> 
> Open source helps this a lot, lets not forget this.  
> 
> PHP application problems that we see are bad coding techniques, mostly in 
> older software that's been coded since php4 and updated for later versions
>  of  php, which says to me that they didn't take into account half of the
>  known vulns today because they weren't known yesterday.
> 
> We also have to take into account all the ways a user might try to use our 
> software, because they are lazy and not always vigilent, which is the main 
> area that bad guys prey on.  For example, redirecting after a login to
>  break  the back button so the next user can't get the login form details.
>  It's hard to speculate everything a person will do, too many individuals
>  with different view points.  Even using large test groups it's hard be
>  100% correct 100% of the time.
> 
> 
> In the end all you can do is prevent what is known today, hope that you've 
> covered for tomorrow.
> 

anyway, in pitching for django (in particular), python and postgresql in 
general, I put safe code as number one in the list. And I personally am 
confident (after seeing the work done in the last 5 years in django, python and 
postgresql) that this will remain. Holes will appear - but I have a feeling 
they will be few and far between and patched fast too. This is what I tell 
people.

-- 
regards
Kenneth Gonsalves
Senior Project Officer
NRC-FOSS
http://nrcfosshelpline.in/web/

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




mixing annotations and extra()

2009-11-16 Thread HARRY POTTRER
If you had a model called Flight which has two fields, one called
"total_time", and the other called "distance", you could create a
"speed" field like so:

Flight.objects.extra(select={'speed': 'distance / time'})

Each object will now have a 'speed' field. What if one of those fields
is a result of an annotation? In my particular case, 'distance' is
stored as an attribute of a Route object which is attached to Flight
via Foreign Key.

Flight.objects.annotate(distance=Sum('route__distance')).extra(select=
{'speed': 'distance / time'})

which doesn't work. How can this be achieved? Or is it even possible?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




mod_wsgi error which i have no idea how to fix

2009-11-16 Thread Damon Jablons
Hey,

I'm running Nginx which proxies Apache and on my website, I get the
following error when I tail the Apache log:

[Mon Nov 16 23:51:08 2009] [error] [client 127.0.0.1] No WSGI daemon
process called 'sub.domain.net' has been configured: /var/www/django/
scribblitt/deploy/domain.wsgi

Here's my Apache config for this site:

#Basic setup
ServerAdmin w...@domain.net
ServerName www.sub.domain.net
ServerAlias sub.domain.net


Order deny,allow
Allow from all


LogLevel warn
ErrorLog  /var/log/apache2/sub.domain.net.error.log
CustomLog /var/log/apache2/sub.domain.net.log common

WSGIDaemonProcess sub.domain.net user=www-data group=www-data
threads=25
WSGIProcessGroup sub.domain.net

WSGIScriptAlias / /var/www/django/domain/deploy/domain.wsgi


Thinking permissions were the problem, I ran: # chown -Rf www-data:www-
data /var/www/django/
and then: # chmod -Rf 755 /var/www/django/
after restarting Apache, I receive the same error.

Here's my wsgi file:
import os
import sys
import site

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
os.environ['PYTHON_EGG_CACHE'] = '/var/www/django/.python-eggs'

site.addsitedir('/var/www/django/domani/env/lib/python2.6/site-
packages')
sys.path.append('/var/www/django/domain/src')

import django.core.handlers.wsgi
_application = django.core.handlers.wsgi.WSGIHandler()

def application(environ, start_response):
environ['wsgi.url_scheme'] = environ.get('HTTP_X_URL_SCHEME',
'http')
   return _application(environ, start_response)

Any ideas?

Thanks in advance.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Making the case for Django (vs. Drupal)

2009-11-16 Thread Mike Ramirez
On Monday 16 November 2009 18:08:35 Kenneth Gonsalves wrote:
> On Monday 16 Nov 2009 10:44:27 pm Mike Ramirez wrote:
> > > it is precisely this assumption that does not seem logical to me. But
> > >  frankly I do not know how to counter it ;-)
> >
> > How is it not logical?  Product A is widely used, Product B is used less.
> >  Bad  Guy A. is smart enough to realize that product A if broken can be
> >  used to gain him more presents because more users have it.
> 
> so if we follow your logic to the inevitable conclusion, the moment the bad
> guys train their weapons on django it is going to be shot as full of holes
>  as drupal (or even phpbb). 

No, I did say 'product A if broken' -- keyword being if.

But Bad Guy A will try everything to put holes in django, and whats worse is 
that he'll have a different perspective than you or I and might see something 
that we didn't or someone else didn't and walla, we have a hole.  We all know 
there is potential for security problems in well established software that 
aren't discovered today, because of this and human error in future revisions 
and changes. Now am I saying the django devs are lazy or incompetent?  If I 
really believed that I would be using something else and calling you all 
idiots for using a badly developed piece of software. No, I'm calling them 
human, if they aren't human, then well aliens are finally proven.  

>  In which case why are the devels focussing so
>  much of their time trying to make the app safe and secure?
>  Should they not
>  be better of lighting candles in the rain and praying that the bad guys
>  radar doesn't function?
>  I personally am of the opinion that constant
>  harping on safe practices and not doing silly things like permitting code
>  inside html (for example) will create an inherently safer app - and the
>  bad guys will congregate elsewhere. After all bitbucket is big enough to
>  be on their radar - and it got hosed - although I hear that was an amazon
>  problem, not a django issue (could be wrong).
> 


Open source helps this a lot, lets not forget this.  

PHP application problems that we see are bad coding techniques, mostly in 
older software that's been coded since php4 and updated for later versions of 
php, which says to me that they didn't take into account half of the known 
vulns today because they weren't known yesterday.

We also have to take into account all the ways a user might try to use our 
software, because they are lazy and not always vigilent, which is the main 
area that bad guys prey on.  For example, redirecting after a login to break 
the back button so the next user can't get the login form details. It's hard 
to speculate everything a person will do, too many individuals with different 
view points.  Even using large test groups it's hard be 100% correct 100% of 
the time.


In the end all you can do is prevent what is known today, hope that you've 
covered for tomorrow.

Mike

-- 
Red Hat Unveils New Ad Campaign 

Linux distributor Red Hat has announced plans for a $650,000 ad campaign. The
ads will appear on several major newspapers as well as on a few selected
websites. "These ads will be targetted towards Windows users who are fed up 
but
aren't aware of any OS alternatives," a Red Hat spokesman said. "We feel that
there is a large audience for this." 

One of the ads will be a half page spread showing two computers side-by-side: 
a
Wintel and a Linux box. The title asks "Is your operating system ready for the
year 2000?" Both computers have a calendar/clock display showing. The Windows
box shows "12:00:01AM -- January 1, 1900" while the Linux box shows 
"12:00:01AM
-- January 1, 2000". The tagline at the bottom says "Linux -- a century ahead
of the competition." 


signature.asc
Description: This is a digitally signed message part.


Re: Can I change the title of an admin page?

2009-11-16 Thread lzantal
Hi,

In your templates/wkw1/lawyer dir extend change_list.html and override
the title::
{% extends "admin/change_list.html" %}
{% block content_title %}Your Title Here{% endblock %}

Hope it helps

lzantal
http://twitter.com/lzantal

On Nov 16, 5:31 pm, Zeynel  wrote:
> RIDER 2:
>
> pictures of the title I want to change:
>
> http://zeynel.posterous.com/django-template-problem
>
> On Nov 16, 3:35 pm, Zeynel  wrote:
>
> > In case someone else has the same problem: I hard-coded the text I
> > wanted in between h1 tags in template base.html.
>
> > {% block content_title %}{% if title %}Enter last name{%
> > endif %}{% endblock %}
>
> > but this defeats the purpose of templates. If you know how titles are
> > created in django, please let me know.
>
> > On Nov 16, 2:57 pm, Zeynel  wrote:
>
> > > I found that the base.html template takes the title in admin change
> > > page from the title of the page:
>
> > > line 64 in base.html:
>
> > > {% block content_title %}{% if title %}{{ title }}{% endif %}
> > > {% endblock %}
>
> > > How can I change the title of the page? Does anyone know?
>
> > > Also mentioned here:http://code.djangoproject.com/changeset/1975

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Django i18n

2009-11-16 Thread Kenneth Gonsalves
On Monday 16 Nov 2009 9:46:58 pm Carlos Ricardo Santos wrote:
> I use to folders at app/locale:
> 
> pt-PT
> en-GB
> 
> Any ideas? Someone has implemented a foreign language before?
> 

I have implemented english ;-) I assume you mean implementing a non-english 
language? This support has been there since 2005, and I have implemented sites 
in finnish, tamil also. One thing is that unless django itself has the language 
translated, i18n will not work. I do not see pt-PT, I only see pt and pt-BR. 
Perhaps you can try one of those - or translate django in pt-PT. If you have 
done everything else correctly, it should work.
-- 
regards
Kenneth Gonsalves
Senior Project Officer
NRC-FOSS
http://nrcfosshelpline.in/web/

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Making the case for Django (vs. Drupal)

2009-11-16 Thread Kenneth Gonsalves
On Monday 16 Nov 2009 10:44:27 pm Mike Ramirez wrote:
> > it is precisely this assumption that does not seem logical to me. But
> >  frankly I do not know how to counter it ;-)
> > 
> 
> How is it not logical?  Product A is widely used, Product B is used less.
>  Bad  Guy A. is smart enough to realize that product A if broken can be
>  used to gain him more presents because more users have it.
> 

so if we follow your logic to the inevitable conclusion, the moment the bad 
guys train their weapons on django it is going to be shot as full of holes as 
drupal (or even phpbb). In which case why are the devels focussing so much of 
their time trying to make the app safe and secure? Should they not be better 
of lighting candles in the rain and praying that the bad guys radar doesn't 
function? I personally am of the opinion that constant harping on safe 
practices and not doing silly things like permitting code inside html (for 
example) will create an inherently safer app - and the bad guys will 
congregate elsewhere. After all bitbucket is big enough to be on their radar - 
and it got hosed - although I hear that was an amazon problem, not a django 
issue (could be wrong).
-- 
regards
Kenneth Gonsalves
Senior Project Officer
NRC-FOSS
http://nrcfosshelpline.in/web/

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: first project taking it too production server

2009-11-16 Thread Kenneth Gonsalves
On Monday 16 Nov 2009 7:41:47 pm Amit Sethi wrote:
> Hi , I just developed my first small app using django , I wish to
> deploy it . I have a apache server with drupal running on it . Can
> anybody guide me about the procedure i should use to deploy the
> project without disturbing the drupal installation in any way...
> 

do you have shell access? is python *really* available (not just the binary, 
but all the modules?
-- 
regards
Kenneth Gonsalves
Senior Project Officer
NRC-FOSS
http://nrcfosshelpline.in/web/

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: What would cause an app to not register?

2009-11-16 Thread Ishwor Gurung
2009/11/17 Joshua Kramer :
> Thanks a ton Mark! I wish I would have done this much earlier.
>
> Some of my models had GeoDjango models in them.  For these, I need to have
> ctypes and geos installed - neither of which are installed.  When I
> commented out the bits requiring GD, presto - everything is installed
> properly.
Yep, you can also try writing the tracebacks in your code while using
development server
(http://docs.python.org/library/traceback.html)

import traceback
class Foo():
try:
.
except:
print traceback.format_exc( );


-- 
Regards,
Ishwor Gurung

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Can I change the title of an admin page?

2009-11-16 Thread Zeynel
RIDER 2:

pictures of the title I want to change:

http://zeynel.posterous.com/django-template-problem



On Nov 16, 3:35 pm, Zeynel  wrote:
> In case someone else has the same problem: I hard-coded the text I
> wanted in between h1 tags in template base.html.
>
> {% block content_title %}{% if title %}Enter last name{%
> endif %}{% endblock %}
>
> but this defeats the purpose of templates. If you know how titles are
> created in django, please let me know.
>
> On Nov 16, 2:57 pm, Zeynel  wrote:
>
>
>
> > I found that the base.html template takes the title in admin change
> > page from the title of the page:
>
> > line 64 in base.html:
>
> > {% block content_title %}{% if title %}{{ title }}{% endif %}
> > {% endblock %}
>
> > How can I change the title of the page? Does anyone know?
>
> > Also mentioned here:http://code.djangoproject.com/changeset/1975

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: What would cause an app to not register?

2009-11-16 Thread Joshua Kramer
Thanks a ton Mark! I wish I would have done this much earlier.

Some of my models had GeoDjango models in them.  For these, I need to have
ctypes and geos installed - neither of which are installed.  When I
commented out the bits requiring GD, presto - everything is installed
properly.

On Mon, Nov 16, 2009 at 9:47 AM, Mark (Nosrednakram)  wrote:

> Hello,
>
> I'm not expert but have seen this behavior when I have a bad import.
> I would start by trying  ./manage.py shell and copy past your imports
> from models and then views or other imports.  It's almost always been
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Default sort order in admin

2009-11-16 Thread Zeynel
Yes, this is probably true. I am still learning. And I like Django and
how it works but it takes time to understand some concepts. I was
rushing a little bit because I wanted to meet this challenge

>> [the tutorial] is enough to build it in no longer that a few days (learning
>> included),
>> even for pre-intermediate programmer.

mentioned here:
http://groups.google.com/group/django-users/browse_frm/thread/d7f9320f3fba5df0/cfd37dc8d5d51027?q=#cfd37dc8d5d51027

But it took me 2 weeks to finish this very simple app.

And I'm still trying to resolve this last issue. If you look at the
pictures here  http://zeynel.posterous.com/django-template-problem
 the title "Search lawyer by last name" should not be in the /admin/
wkw1 directory because the search box is in /admin/wkw1/lawyer/.

How do I change that title?



On Nov 16, 5:55 pm, Daniel Roseman  wrote:
> On Nov 16, 4:31 pm, Zeynel  wrote:
>
>
>
>
>
> > Thanks!
>
> > I noticed that using
>
> > class Lawyer(models.Model):
> >     ...
> >     ordering = ('last',)
>
> > did not work.
>
> > But this worked
>
> > class Lawyer(models.Model):
> >     ...
> >     class Meta:
> >         ordering = ('last',)
>
> > copied fromhttp://www.djangoproject.com/documentation/models/ordering/
>
> > What is the correct way actually?
>
> You weren't reading closely enough. The page Karen linked you to is
> all about admin options, and that option therefore belongs on the
> ModelAdmin class, not the model itself. The other page explains how
> you set the default ordering for a model throughout the application,
> which the admin will also use if it doesn't have anything else set.
> --
> DR.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Confusing error: AttributeError: 'Settings' object has no attribute 'rindex'.

2009-11-16 Thread Gene
I'm getting an error that has completely perplexed me: AttributeError:
'Settings' object has no attribute 'rindex'.

The complete traceback is listed below. I get this for any request but
a root request '/'. I'm, using Django 1.1 with mod_wsgi.

The only cases I could find por google of others running into this
error was a few years back in the django 0.95 to 0.96 upgrade- and the
solution- upgrade to 0.96 :/

Traceback (most recent call last):

  File "/home/username/webapps/django/lib/python2.5/django/shortcuts/
__init__.py", line 20, in render_to_response
return HttpResponse(loader.render_to_string(*args, **kwargs),
**httpresponse_kwargs)

  File "/home/username/webapps/django/lib/python2.5/django/template/
loader.py", line 108, in render_to_string
return t.render(context_instance)

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 178, in render
return self.nodelist.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 779, in render
bits.append(self.render_node(node, context))

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 792, in render_node
return node.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
loader_tags.py", line 97, in render
return compiled_parent.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 178, in render
return self.nodelist.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 779, in render
bits.append(self.render_node(node, context))

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 792, in render_node
return node.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
loader_tags.py", line 97, in render
return compiled_parent.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 178, in render
return self.nodelist.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 779, in render
bits.append(self.render_node(node, context))

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 792, in render_node
return node.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
loader_tags.py", line 97, in render
return compiled_parent.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 178, in render
return self.nodelist.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 779, in render
bits.append(self.render_node(node, context))

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 792, in render_node
return node.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
loader_tags.py", line 24, in render
result = self.nodelist.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 779, in render
bits.append(self.render_node(node, context))

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 792, in render_node
return node.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 946, in render
autoescape=context.autoescape))

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 779, in render
bits.append(self.render_node(node, context))

  File "/home/username/webapps/django/lib/python2.5/django/template/
__init__.py", line 792, in render_node
return node.render(context)

  File "/home/username/webapps/django/lib/python2.5/django/template/
defaulttags.py", line 370, in render
url = reverse(self.view_name, args=args, kwargs=kwargs,
current_app=context.current_app)

  File "/home/username/webapps/django/lib/python2.5/django/core/
urlresolvers.py", line 350, in reverse
*args, **kwargs)))

  File "/home/username/webapps/django/lib/python2.5/django/core/
urlresolvers.py", line 275, in reverse
possibilities = self.reverse_dict.getlist(lookup_view)

  File "/home/username/webapps/django/lib/python2.5/django/core/
urlresolvers.py", line 195, in _get_reverse_dict
self._populate()

  File "/home/username/webapps/django/lib/python2.5/django/core/
urlresolvers.py", line 175, in _populate
for name in pattern.reverse_dict:

  File "/home/username/webapps/django/lib/python2.5/django/core/
urlresolvers.py", line 195, in _get_reverse_dict
self._populate()

  File "/home/username/webapps/django/lib/python2.5/django/core/
urlresolvers.py", line 187, in _populate
lookups.appendlist(pattern.callback, (bits, p_pattern))

  File 

Re: feature request

2009-11-16 Thread Russell Keith-Magee
On Tue, Nov 17, 2009 at 6:29 AM, Brandon  wrote:
> How do I request a feature from Django?

http://docs.djangoproject.com/en/dev/internals/contributing/#requesting-features

It's also worth keeping in mind the release cycle:

http://docs.djangoproject.com/en/dev/internals/release-process/#release-cycle

We're currently in Phase 2 for v1.2.

> This one would be simple. I'd like the authenticate method to take an
> extra boolean argument which would determine if it should treat the
> username as case sensitive. Default would be True, since it treats it
> that way already.
>
> I understand that passwords would have to be case sensitive, because
> they are hashed, but usernames should not have to be case sensitive.
...
> Is there a way to do this already? My way seems like it would be
> easier to add the check into authenticate() instead of the following
> workaround.

Yes - write a custom authentication backend:

http://docs.djangoproject.com/en/dev/topics/auth/#writing-an-authentication-backend

Yours
Russ Magee %-)

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Multiple level aggregate

2009-11-16 Thread Tony Czeh
On 11/16/09 1:12 PM, despy wrote:
> Hi,
>
> I'm trying to get my head around a complex aggregate query and I could
> do with some help. Say I have the following models
>
> StockMarket
> |
> Stock
> |
> StockPrice
>
> If StockPrice has price and date fields, and one price entry for every
> day for every stock how would I write a query to get the average price
> for a given stockmarket for the last six months?
>
> Thanks
>
> Greig
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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=.
>
>

Something along these lines should work in SQL:

SELECT s.stock_symbol
  , AVG(sp.price) AS average_price
FROM Stock s
  LEFT JOIN StockPrice sp
 ON s.id = sp.stock_id
WHERE sp.date BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
   AND CURRENT_DATE
GROUP BY s.stock_symbol

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Default sort order in admin

2009-11-16 Thread Daniel Roseman
On Nov 16, 4:31 pm, Zeynel  wrote:
> Thanks!
>
> I noticed that using
>
> class Lawyer(models.Model):
>     ...
>     ordering = ('last',)
>
> did not work.
>
> But this worked
>
> class Lawyer(models.Model):
>     ...
>     class Meta:
>         ordering = ('last',)
>
> copied fromhttp://www.djangoproject.com/documentation/models/ordering/
>
> What is the correct way actually?

You weren't reading closely enough. The page Karen linked you to is
all about admin options, and that option therefore belongs on the
ModelAdmin class, not the model itself. The other page explains how
you set the default ordering for a model throughout the application,
which the admin will also use if it doesn't have anything else set.
--
DR.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




order_by related models

2009-11-16 Thread dave.l
Hi!

The following line in my application seems to have stopped working as
I expect:

   for object in self.queryset.select_related().order_by
("app_building.principal_name", "reference"):

the first ordering term on principal_name is no longer working.  by
looking at ...query.as_sql() I can see the ORDER BY is not being
added.

According to the docs:

   New in Django 1.0: Please, see the release notes

   The syntax for ordering across related models has changed. See the
Django 0.96 documentation for the old behaviour.

but I cannot find any reference to the new syntax

I have looked at the source, and it appear that if I could use "
app_building.`principal_name` " (i.e. with 'backticks') it would work.
but these are rejected by the regexp match.

Please could someone point me in the right directions.

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-us...@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=.




feature request

2009-11-16 Thread Brandon
How do I request a feature from Django?

This one would be simple. I'd like the authenticate method to take an
extra boolean argument which would determine if it should treat the
username as case sensitive. Default would be True, since it treats it
that way already.

I understand that passwords would have to be case sensitive, because
they are hashed, but usernames should not have to be case sensitive.

It is not appealing to me to convert all the usernames in my db to
lowercase and then lowercase the input to authenticate().

Is there a way to do this already? My way seems like it would be
easier to add the check into authenticate() instead of the following
workaround.

query the db with User.objects.get(username__iexact=unamefrominput)
#obviously using a try/except

if there is one, take the username of that user and pass it to
authenticate() with the password from input.

this workaround obviously requires one more query than putting the
decision in the authenticate function.

Any help on this would be greatly appreciated. I am developing for a
server run by someone else, so I don't want to hack django myself as
it won't affect the production server. This would be really handy for
future issues.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Can I stop the FormWizard sequence?

2009-11-16 Thread konatufe
Hi Guys!

Can I stop the forms sequence in a Form Wizard?
Doing something like execute an extra function that return a Http
response.

Thanks in advance.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Django on Dreamhost internal server error

2009-11-16 Thread Mike Ramirez
On Monday 16 November 2009 12:55:25 Alessandro Ronchi wrote:
> If I put Debug = False in my django settings.py I receive an internal
> server error with no explanation.
> 
> I'm using mod_passenger.
> 
> What can cause the problem? Is there any way I can debug the error or
> get more information? Dreamhost cannot answer me, maybe someone got
> similar esperience.
> 

Did you check your apache logs? Normally when I get these, the error log will 
produce good info, if it doesn't do that atleast, I start over and check 
everything step by step. If the template suggestion doesn't work.

And to Christophe Pettus:  yes it's mainly for ruby on rails, but it does 
python also as of 2.01-rc1, according to the dreamhost wiki and the phusion 
passenger site.

Mike

Just for completeness
http://wiki.dreamhost.com/Passenger_WSGI
http://blog.phusion.nl/2008/06/09/phusion-passenger-20-rc-1-and-ruby-
enterprise-edition-released/
-- 
Blackmail Error:
Send $200 to Bill Gates or your computer will get so messed up it will never
work again.


signature.asc
Description: This is a digitally signed message part.


Re: Django on Dreamhost internal server error

2009-11-16 Thread Matt Schinckel
On Nov 17, 6:57 am, Christophe Pettus  wrote:
> On Nov 16, 2009, at 12:55 PM, Alessandro Ronchi wrote:
>
> > I'm using mod_passenger.
>
> Isn't that for Ruby rather than Python?

You can use mod_passenger for python, with a passenger_wsgi.py file.

(I use it on my development machine with Passenger.prefpane so I don't
need to fuddle with vhosts).

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Default sort order in admin

2009-11-16 Thread Preston Holmes


On Nov 16, 8:31 am, Zeynel  wrote:
> Thanks!
>
> I noticed that using
>
> class Lawyer(models.Model):
>     ...
>     ordering = ('last',)
>
> did not work.
>
> But this worked
>
> class Lawyer(models.Model):
>     ...
>     class Meta:
>         ordering = ('last',)
>
> copied fromhttp://www.djangoproject.com/documentation/models/ordering/
>
> What is the correct way actually?

If you notice - you are looking at two ways of doing it, depending
whether you want the ordering to be applied to just the model
(django.models.Model) or the ModelAdmin
(django.contrib.admin.ModelAdmin).

regular models use Meta class for ordering - ModelAdmin classes use an
ordering attribute.

The modeladmin docs say : "If this isn't provided, the Django admin
will use the model's default ordering."

so they are both "correct"

-Preston


>
> On Nov 16, 10:22 am, Karen Tracey  wrote:
>
>
>
> > On Mon, Nov 16, 2009 at 10:11 AM, Zeynel  wrote:
> > > Hi,
>
> > > Is there a way to change the default sort order in admin of my sqlite
> > > db? At this point it sorts the table in the order entered (last
> > > entered item first).
>
> >http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contri...
>
> > Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Serving Password Protected Files

2009-11-16 Thread f4nt
Hello,

Is there a good way to handle serving files behind django
authentication? I'm working on a project right now where people can
upload files, and based on certain permissions can download them as
well. However, there doesn't seem to be a good way to handle checking
authentication, and then serving the files. I'd prefer a web server
agnostic approach since I'd like this application to stay as pluggable
as possible. Any thoughts?

Thanks,
Mark

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Django on Dreamhost internal server error

2009-11-16 Thread Preston Holmes
do you have error templates defined?

http://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views

-Preston


On Nov 16, 12:55 pm, Alessandro Ronchi 
wrote:
> If I put Debug = False in my django settings.py I receive an internal
> server error with no explanation.
>
> I'm using mod_passenger.
>
> What can cause the problem? Is there any way I can debug the error or
> get more information? Dreamhost cannot answer me, maybe someone got
> similar esperience.
>
> --
> Alessandro Ronchi
>
> SOASI
> Sviluppo Software e Sistemi Open 
> Sourcehttp://www.soasi.comhttp://www.linkedin.com/in/ronchialessandro

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Django on Dreamhost internal server error

2009-11-16 Thread Christophe Pettus

On Nov 16, 2009, at 12:55 PM, Alessandro Ronchi wrote:

> I'm using mod_passenger.


Isn't that for Ruby rather than Python?
--
-- Christophe Pettus
x...@thebuild.com

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Django on Dreamhost internal server error

2009-11-16 Thread Alessandro Ronchi
If I put Debug = False in my django settings.py I receive an internal
server error with no explanation.

I'm using mod_passenger.

What can cause the problem? Is there any way I can debug the error or
get more information? Dreamhost cannot answer me, maybe someone got
similar esperience.


-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Can I change the title of an admin page?

2009-11-16 Thread Zeynel
In case someone else has the same problem: I hard-coded the text I
wanted in between h1 tags in template base.html.

{% block content_title %}{% if title %}Enter last name{%
endif %}{% endblock %}

but this defeats the purpose of templates. If you know how titles are
created in django, please let me know.



On Nov 16, 2:57 pm, Zeynel  wrote:
> I found that the base.html template takes the title in admin change
> page from the title of the page:
>
> line 64 in base.html:
>
> {% block content_title %}{% if title %}{{ title }}{% endif %}
> {% endblock %}
>
> How can I change the title of the page? Does anyone know?
>
> Also mentioned here:http://code.djangoproject.com/changeset/1975

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Can I change the title of an admin page?

2009-11-16 Thread Zeynel
I found that the base.html template takes the title in admin change
page from the title of the page:

line 64 in base.html:

{% block content_title %}{% if title %}{{ title }}{% endif %}
{% endblock %}

How can I change the title of the page? Does anyone know?

Also mentioned here:
http://code.djangoproject.com/changeset/1975

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: slow tests on 1.1.1 w/ sqlite

2009-11-16 Thread Phlip
Karen Tracey wrote:

> http://code.djangoproject.com/ticket/10899

Thanks - I missed that one. Yes it's ugly, yes you can hide it in setUp
(), and yes it bypasses the problems in the earlier works-around I
looked at.

--
  Phlip
  http://code.djangoproject.com/ticket/10899

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Trouble setting a form field's value in clean()

2009-11-16 Thread Adam Stein
Ok, thanks for the example.

On Mon, 2009-11-16 at 11:27 -0800, pjrhar...@gmail.com wrote:
> > if not cleaned.has_key("string2") and
> > cleaned.has_key("string1"):
> > cleaned["string2"] = string1
> >
> > return cleaned
> >
> I think the problem here is that if string2 is not required it will be
> in the cleaned dictionary but an empty string. So instead you might
> need:
> 
> if not cleaned.get('string2', ''):
> cleaned['string2'] = string1
> 
> I'd still suggest doing it like this though, not in the POST, as you
> would need to do that in every view where you use the form.
> 
> Peter
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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=.
> 
-- 
Adam Stein @ Xerox Corporation   Email: a...@eng.mc.xerox.com

Disclaimer: Any/All views expressed
here have been proven to be my own.  [http://www.csh.rit.edu/~adam/]

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: slow tests on 1.1.1 w/ sqlite

2009-11-16 Thread Karen Tracey
On Mon, Nov 16, 2009 at 1:37 PM, Phlip  wrote:

> > Yours,
> > Russ Magee %-)
>
> Yours wouldn't happen to know an answer for this, right?
>
>
> http://groups.google.com/group/django-users/browse_thread/thread/a91f161f386f10da/2eaccb410c4c0692
>
> I literally don't know how to develop without TDD, and the inability
> to call any but the most trivial GET actions is really impairing me...
>
> I suspect that question got no response because it isn't at all clear (to
me) what the problem is.

There are three lines of code listed (not a complete test or anything that
someone could run locally and see what happens) and the statement that they
are "not working" with no explanation of what, exactly, that means.  Do you
get an error?  Does the test fail when you think it should pass, or pass
when you think it should fail?  Does your computer burst into flames?

There is reference to a "confusing mishmash" of Google results without
specific citing of any one that might could have provided a few pointers as
to the nature of the problem inherent in those three lines of code.   I,
personally, prefer puzzles with a few more clues, so I recall reading that
message and moving on without really looking too closely.

Looking again, I'll make a guess.  Is the problem you are attempting to ask
about that the session variable set on the test client side is not reflected
in the session as seen by the server view?  If so, then likely you are
looking for ticket #10899 to be fixed:

http://code.djangoproject.com/ticket/10899

That includes what looks to be straightforward (if self-described "ugly")
ways to work around the current behavior in the meantime, though I have not
experimented with any of that code.

If that is not the problem you are hitting then you would likely get better
results if you would spell out in some detail what the problem is.

Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Trouble setting a form field's value in clean()

2009-11-16 Thread pjrhar...@gmail.com
>         if not cleaned.has_key("string2") and
> cleaned.has_key("string1"):
>             cleaned["string2"] = string1
>
>         return cleaned
>
I think the problem here is that if string2 is not required it will be
in the cleaned dictionary but an empty string. So instead you might
need:

if not cleaned.get('string2', ''):
cleaned['string2'] = string1

I'd still suggest doing it like this though, not in the POST, as you
would need to do that in every view where you use the form.

Peter

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: django basic blog and inlines

2009-11-16 Thread Bobby Roberts
doh!  thanks Karen

On Nov 16, 2:10 pm, Karen Tracey  wrote:
> On Mon, Nov 16, 2009 at 1:58 PM, Bobby Roberts  wrote:
> > ok so i deleted what i had done and did the following:
>
> > 1.  uploaded the entire basic app directory into django_apps/live/
> > basic
> > 2.  changed installed apps to load:
> >       basic.blog
> >       basic.inlines
>
> > Now i'm getting a totally different traceback
> > athttp://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/
>
> > my installed apps does have django.contrib.comments
>
> > can someone decipher that and explain it to me?
>
> It looks like you have not done step 3 in the quick start to using comments:
>
> http://docs.djangoproject.com/en/dev/ref/contrib/comments/#quick-star...
>
> Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: django basic blog and inlines

2009-11-16 Thread Karen Tracey
On Mon, Nov 16, 2009 at 1:58 PM, Bobby Roberts  wrote:

> ok so i deleted what i had done and did the following:
>
> 1.  uploaded the entire basic app directory into django_apps/live/
> basic
> 2.  changed installed apps to load:
>   basic.blog
>   basic.inlines
>
>
> Now i'm getting a totally different traceback
> athttp://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/
>
> my installed apps does have django.contrib.comments
>
> can someone decipher that and explain it to me?
>
>
It looks like you have not done step 3 in the quick start to using comments:

http://docs.djangoproject.com/en/dev/ref/contrib/comments/#quick-start-guide

Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Encoding ISO-8859-1

2009-11-16 Thread ulferik
Hi Hugo.
I am using eclipse with pydev and have no idea how it is saved...
maybee you know that?
Ulferik

On 16 Nov, 18:44, Hugo González Monteverde  wrote:
> What editor are you using  for the template? There's no point in
> specifying the encoding as a meta if the actual html template files
> has not been saved in that encoding. Use the same encoding in your
> editor settings as you are using in your meta specification.
>
> Either  your template file has a BOM or Django is interpreting that it
> should be UTF8. The easiest way to fix this is saving the file as UTF8
> and changing your meta settings. All characters in Latin 1 are in
> Unicode so you can stick to unicode for all of it.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: django basic blog and inlines

2009-11-16 Thread Bobby Roberts
ok so i deleted what i had done and did the following:

1.  uploaded the entire basic app directory into django_apps/live/
basic
2.  changed installed apps to load:
   basic.blog
   basic.inlines


Now i'm getting a totally different traceback
athttp://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/

my installed apps does have django.contrib.comments

can someone decipher that and explain it to me?

thanks in advance,

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Disabling site wide actions

2009-11-16 Thread Zeynel
EDIT:

In the page source code the title that I want to change shows like
this:



Select lawyer to change

Where do i find this class="flex" ?



On Nov 16, 1:34 pm, Zeynel  wrote:
> Django rocks! I used disable a site-wide action as explained here
>
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#disab...
>
> but now I have the title "Select a lawyer to change" just above my
> search box. The action box is gone, but it's title is still there. Can
> anyone please help me to change that title to "Search lawyers" ?
>
> Thank you

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




generator function for repetitive model fields?

2009-11-16 Thread Some Guy
Hi,
Is there any functionality, or possibility, to generate many fields in
a model file that are all identical and follow an easy (repetitive)
naming convention?

i.e.

locations = (loc1, loc2, lo3)
places = (place2, place2)
for l in locations:
   for p in places:
  l + p + _has_been_checked = models.BooleanField(...)

right now I"m just running this kind of thing in a shell and copy/
pasting.  Any ideas how this could work? Manager methods maybe?

TIA

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: slow tests on 1.1.1 w/ sqlite

2009-11-16 Thread Phlip
> Yours,
> Russ Magee %-)

Yours wouldn't happen to know an answer for this, right?

http://groups.google.com/group/django-users/browse_thread/thread/a91f161f386f10da/2eaccb410c4c0692

I literally don't know how to develop without TDD, and the inability
to call any but the most trivial GET actions is really impairing me...

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Disabling site wide actions

2009-11-16 Thread Zeynel
Django rocks! I used disable a site-wide action as explained here

http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#disabling-a-site-wide-action

but now I have the title "Select a lawyer to change" just above my
search box. The action box is gone, but it's title is still there. Can
anyone please help me to change that title to "Search lawyers" ?

Thank you

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Trouble setting a form field's value in clean()

2009-11-16 Thread Adam Stein

On Mon, 2009-11-16 at 17:57 +0100, Dennis Kaarsemaker wrote:
> On Mon, Nov 16, 2009 at 5:12 PM, Adam Stein  wrote:
> > Running Django v1.1.1 on Apache v2.2.8 with Firefox v3.5.4.
> >
> > I have a very simplified and unreal example below to demonstrate what's
> > happening.
> >
> >8 --
> >
> >def clean(self):
> >cleaned = self.cleaned_data
> >
> >if not cleaned.has_key("string2") and
> > cleaned.has_key("string1"):
> >cleaned["string2"] = string1
> >
> >return cleaned
> >8 --
> >
> > What happens is that Django comes back with an error message because
> > 'string2' is required and has no associated value.  Is there any way to
> > set a field value that get's POST'd?
> 
> clean() is run after the built-in validation and per-field validation.
> You'll want to copy request.POST, set the value there, and then feed
> it to the form. Or make string2 not required and do it in clean the
> way you do now.
> 

Thanks for responding.  I'll have to look into using POST.  The problem
with NOT requiring string2 is that I still can't change the value.
Instead of checking if it's not there, I check for an empty string:

if cleaned["string2"] == "":
cleaned["string2"] = string1

which means an empty string goes along with POST, not the value I set.
-- 
Adam Stein @ Xerox Corporation   Email: a...@eng.mc.xerox.com

Disclaimer: Any/All views expressed
here have been proven to be my own.  [http://www.csh.rit.edu/~adam/]

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




How write unit test for forms that download PDF file

2009-11-16 Thread JohnL
On my website http://www.mathmaster.org, I have a lot of forms that
generated a PDF math worksheets file after the user click the submit
button.

The way I test these pages is using the code similar to this method:

def test_addition_post(self):
  post_data = {
'max_value': 10,
'min_value': 1,
...,
}
response = self.client.post('/addition/', post_data)
self.failUnlessEqual(response.status_code, 200)
self.failUnless('Data received', response.content)

I don't think the code is working correctly because all my tests
passed and I still get a simple reference error.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Multiple level aggregate

2009-11-16 Thread despy
Hi,

I'm trying to get my head around a complex aggregate query and I could
do with some help. Say I have the following models

StockMarket
|
Stock
|
StockPrice

If StockPrice has price and date fields, and one price entry for every
day for every stock how would I write a query to get the average price
for a given stockmarket for the last six months?

Thanks

Greig

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Making the case for Django (vs. Drupal)

2009-11-16 Thread CLIFFORD ILKAY
Tom Evans wrote:
> On Mon, Nov 16, 2009 at 5:25 AM, Melvyn Sopacua 
> > wrote:
> 
> On Mon, 16 Nov 2009 08:53:26 +0530, Kenneth Gonsalves
> >
> wrote:
>  > On Monday 16 Nov 2009 6:50:10 am Christophe Pettus wrote:
>  >> On Nov 15, 2009, at 5:10 PM, Kenneth Gonsalves wrote:
>  >> > I do also point out to plone vs drupal, but there again the
>  >> > argument is the drupal is more widely used and hence has more
>  >> > observable
>  >> > vulnerabilities. It does not sound logical.
>  >>
>  >> I don't think that anyone is seriously arguing that a piece of
>  >> software being widely adopted somehow creates new security
>  >> vulnerabilities in it.  I believe the assumption is that all
> software
>  >> of a given level of complexity has roughly the same number of
>  >> vulnerabilities, either exposed or hidden.  Thus, the more used a
>  >> piece of software, the more attention the bad guys give it, and thus
>  >> the more of those hidden security problems become exposed.
>  >>
>  >
>  > it is precisely this assumption that does not seem logical to me. But
>  > frankly
>  > I do not know how to counter it ;-)
> 
> It is quite simple. Say you write a letter. You proofread the result.
> You give it to someone else to proofread and it's likely he/she finds
> a few more typos. The longer the letter, the more mistakes you'll
> make (absolute), while the percentage might stay the same.
> The more eyes look at it, the better your chances are that you will
> send a flawless letter.
> Now, the question arises whether a program is more secure if it has
> more exposure (proofreaders) or less and a bit of both is true.
> The more proofreaders the less chance a bug remains, yet since
> exploiting the bug requires knowledge to be shared and/or
> incorporated into attack software, the chance that *you* as a user
> gets exploited through one of these bugs lessens.
> Think of this as the difference between a cabin in the mountains,
> no locks on the door and a 5 mile steep hike to get there, versus
> a bank downtown. Obviously, the bank is more secure, yet it's
> much less likely that someone will try and rob the cabin.
> 
> 
> 
> Metaphors are messy and tend to break down. There may be more spelling 
> mistakes in the Drupal letter, but that is because it is a letter and 
> django is an alphabet...

A long and complex report written by someone who has good communications 
skills and who knows English fluently is likely to have fewer spelling 
mistakes and grammatical errors than someone who uses Google Translate 
to translate even a short and simple report to English from some other 
language.
-- 
Regards,

Clifford Ilkay
Dinamis
1419-3266 Yonge St.
Toronto, ON
Canada  M4N 3P6


+1 416-410-3326

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: django basic blog and inlines

2009-11-16 Thread Karen Tracey
On Mon, Nov 16, 2009 at 12:49 PM, Bobby Roberts  wrote:

> Karen -
>
> Thanks for your reply... The path in both my blog and inlines module
> was edited and i removed basic. from all the calls (since i wasn't
> using the primary basic/ directory with all of the standard apps.  The
> error was there even if when i was using basic/blog or basic/inlines
> structure as downloaded from the source.
>
> Mike -
>
> Thanks for your reply.  The path to the inlines.py file is as follows:
>
> /django_apps/live/inlines/templatetags/inlines.py
>
>
>
OK so if you remove basic from both the import and the directory path, then
you are left with an include, in that file above, that is:

from inlines.parser import inlines

?

Now the problem is you have two "inlines" modules
(/django_apps/live/inlines/ and
/django_apps/live/inlines/templatetags/inlines.py) and "from
inlines.whatever" is ending up looking in the wrong place (the inlines.py
file instead of the directory two levels up).  (This is likely why the basic
was included in the import in the first place.)

I'd recommend returning the apps to their originally-coded state and using
the structure they are assuming.  Otherwise I do not know how much
additional renaming you will need to do to to make things work properly.
For this problem here you will need to rename one of the inlines modules
(and update all imports that reference whichever one you decide to rename).

Karen











>
>
> On Nov 16, 12:33 pm, Mike Ramirez  wrote:
> > On Monday 16 November 2009 09:20:03 Bobby Roberts wrote:
> >
> >
> >
> > > the path to inlines.py is:
> >
> > > /django_apps/live/inlines/inlines.py
> >
> > > live is on my pythonpath (my main application)
> >
> > > blogs and inlines were pulled out of the basic app and put into these
> > > directories
> >
> > > /django_apps/live/blog/  (works)
> > > /django_apps/inlines/(doesn't work)
> >
> > > you can view the full traceback here:
> > >  http://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/
> >
> > > > > The error i'm getting is:
> >
> > > > > 'inlines' is not a valid tag library: Could not load template
> library
> > > > > from django.templatetags.inlines, No module named parser
> >
> > > > > You can see the full traceback here:
> > > > >http://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/
> >
> > > > > any ideas why this isn't working?
> >
> > > > > --
> >
> > The inlines.py needs to live in your project/app/templatetags directory.
> >
> > I''m assuming live is your project,inlines is your apps, so something
> like
> > this:
> >
> > django_apps/live/inlines/templatetags/inline.py
> >
> > you should read this:
> http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#code...
> >
> > Mike
> >
> > --
> > He is no lawyer who cannot take two sides.
> >
> >  signature.asc
> > < 1KViewDownload
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: django basic blog and inlines

2009-11-16 Thread Bill Freeman
So then the answer to my question is "no", you do not have a file
inlines.py in a directory named "templatetags" which is itself in an
app directrory recognizable by the presence of a models.py, the path
such that the models.py file is importable as appname.models, and the
app mentioned in INSTALLED_APPS.  Since those are the only places the
loader will look for the "inlines" tag library, it won't find one.

On Mon, Nov 16, 2009 at 12:20 PM, Bobby Roberts  wrote:
> the path to inlines.py is:
>
> /django_apps/live/inlines/inlines.py
>
>
> live is on my pythonpath (my main application)
>
> blogs and inlines were pulled out of the basic app and put into these
> directories
>
> /django_apps/live/blog/  (works)
> /django_apps/inlines/    (doesn't work)
>
> you can view the full traceback here:  
> http://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/
>
> it's like it's trying to call inlines from
> django.templatetags.inlines   rather than from the inlines path noted
> above.
>
>
>
> On Nov 16, 10:49 am, Bill Freeman  wrote:
>> Do you have among your installed apps a name identifying a directory on the
>> python path having both a models.py and a subdirectory named templatetags,
>> that subdirectory containing a file inlines.py ?  Or was that in the stuff 
>> you
>> excluded from basic.app?

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: django basic blog and inlines

2009-11-16 Thread Bobby Roberts
Karen -

Thanks for your reply... The path in both my blog and inlines module
was edited and i removed basic. from all the calls (since i wasn't
using the primary basic/ directory with all of the standard apps.  The
error was there even if when i was using basic/blog or basic/inlines
structure as downloaded from the source.

Mike -

Thanks for your reply.  The path to the inlines.py file is as follows:

/django_apps/live/inlines/templatetags/inlines.py




On Nov 16, 12:33 pm, Mike Ramirez  wrote:
> On Monday 16 November 2009 09:20:03 Bobby Roberts wrote:
>
>
>
> > the path to inlines.py is:
>
> > /django_apps/live/inlines/inlines.py
>
> > live is on my pythonpath (my main application)
>
> > blogs and inlines were pulled out of the basic app and put into these
> > directories
>
> > /django_apps/live/blog/  (works)
> > /django_apps/inlines/    (doesn't work)
>
> > you can view the full traceback here:
> >  http://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/
>
> > > > The error i'm getting is:
>
> > > > 'inlines' is not a valid tag library: Could not load template library
> > > > from django.templatetags.inlines, No module named parser
>
> > > > You can see the full traceback here:
> > > >http://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/
>
> > > > any ideas why this isn't working?
>
> > > > --
>
> The inlines.py needs to live in your project/app/templatetags directory.
>
> I''m assuming live is your project,inlines is your apps, so something like
> this:
>
> django_apps/live/inlines/templatetags/inline.py
>
> you should read 
> this:http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#code...
>
> Mike
>
> --
> He is no lawyer who cannot take two sides.
>
>  signature.asc
> < 1KViewDownload

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Encoding ISO-8859-1

2009-11-16 Thread Hugo González Monteverde
What editor are you using  for the template? There's no point in
specifying the encoding as a meta if the actual html template files
has not been saved in that encoding. Use the same encoding in your
editor settings as you are using in your meta specification.

Either  your template file has a BOM or Django is interpreting that it
should be UTF8. The easiest way to fix this is saving the file as UTF8
and changing your meta settings. All characters in Latin 1 are in
Unicode so you can stick to unicode for all of it.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Odd problem with modelformset_factory, a missing field

2009-11-16 Thread Malcolm MacKinnon
On Sun, Nov 15, 2009 at 4:35 PM, Malcolm MacKinnon wrote:

> Hi,
>
> I'm new to django and am having a problem with the modelformset factory not
> rendering all my form fields.For some odd reason, when I exclude the primary
> key field, prim, it does not render this field in my template below.
> {{form.m}}. When I do not exclude='prim', the field {{form.m}} is rendered
> perfectly. In my view i have defined my formset as:
>
> Transpecform = modelformset_factory(Sotranspec,   max_num=16, extra=16,
> exclude='prim')
>
> Here's my view:
>
> def  special_offers(request):
> customer=request.session.get('customer')
> c=request.session
> c=c.items()
> message=''
> try:
> order=Somastspec.objects.filter(custno=customer)
> except:
> pass
> if request.method=='POST':
> formset=Transpecform(request.POST,  request.FILES,
> queryset=Sotranspec.objects.none(),  )
> if formset.is_valid():
> formset.save()
> return HttpResponseRedirect('/home/')
> else:
> message='You have errors'
>
> else:
> formset = Transpecform(queryset=Sotranspec.objects.none(), )
> return render_to_response('special_offers_step1.html', {'formset':
> formset,  'customer':customer, 'c':c,  'message':message},  context_instance
> = RequestContext(request))
>
> Here's my template:
>
> 
>
> {% autoescape on %}
> 
> SportHill Inc.
> 725 McKinley St.
> {{customer}}
> Eugene, OR 97402 USA
> {% ifnotequal message ''%}
> {{message}}
> {%endifnotequal%}
>  
> {{ formset.management_form }}
> {% for form in formset.forms %}
> {{ form.prim }}
> {{ form.custno}}
>
> 
> Select
> ItemEAXSSSLSPMMLMPMSPLSXLXLLXXLSMLXLPLUS0PLUS1PLUS2PLUS3PLUS4TotalUnit$$Total
> {{ form.item }}{{ form.ea }}{{ form.xs
> }}{{ form.s }}{{ form.sl }}{{ form.sp
> }}{{ form.m}}{{ form.ml }}{{ form.mp}}{{
> form.ms }}{{ form.l }}{{ form.ll }}{{
> form.lp}}{{ form.ls }}{{ form.xl }}{{
> form.xll}}{{ form.xxl }}{{ form.sm }}{{
> form.lxl}}{{ form.plus0 }}{{ form.plus1 }}{{
> form.plus2 }}{{ form.plus3 }}{{ form.plus4 }}{{
> form.total }}{{ form.unit_price }}{{ form.ext_price
> }}
> 
> 
> {% endfor %}
>
>  
> 
> {{custno}}
> {% endautoescape %}
>
>
> 
>
> Any thoughts or help would be very much appreciated. 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-us...@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=.




Re: django basic blog and inlines

2009-11-16 Thread Mike Ramirez
On Monday 16 November 2009 09:20:03 Bobby Roberts wrote:
> the path to inlines.py is:
> 
> /django_apps/live/inlines/inlines.py
> 
> 
> live is on my pythonpath (my main application)
> 
> blogs and inlines were pulled out of the basic app and put into these
> directories
> 
> /django_apps/live/blog/  (works)
> /django_apps/inlines/(doesn't work)
> 
> you can view the full traceback here: 
>  http://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/
> 
> > >
> > > The error i'm getting is:
> > >
> > > 'inlines' is not a valid tag library: Could not load template library
> > > from django.templatetags.inlines, No module named parser
> > >
> > > You can see the full traceback here:
> > >http://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/
> > >
> > > any ideas why this isn't working?
> > >
> > > --
> > >

The inlines.py needs to live in your project/app/templatetags directory.

I''m assuming live is your project,inlines is your apps, so something like 
this:

django_apps/live/inlines/templatetags/inline.py 

you should read this:
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#code-layout





Mike

-- 
He is no lawyer who cannot take two sides.


signature.asc
Description: This is a digitally signed message part.


Re: django basic blog and inlines

2009-11-16 Thread Karen Tracey
On Mon, Nov 16, 2009 at 12:20 PM, Bobby Roberts  wrote:

> the path to inlines.py is:
>
> /django_apps/live/inlines/inlines.py
>
>
> live is on my pythonpath (my main application)
>
> blogs and inlines were pulled out of the basic app and put into these
> directories
>
> /django_apps/live/blog/  (works)
> /django_apps/inlines/(doesn't work)
>
> you can view the full traceback here:
> http://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/
>
> it's like it's trying to call inlines from
> django.templatetags.inlines   rather than from the inlines path noted
> above.
>
>
No, that's a red-herring error message.  Django actually tries to load tag
libraries from a templatetags directory under each app listed in
INSTALLED_APPS.  The fact that only django.templatetags is shown in the
error message does not mean that inlines.templatetags wasn't tried.

I think the problem is likely that you have removed the 'basic' element from
the directory path for these apps.  The blog one may not care, but it
appears (I'm assuming you are using the basic apps from here:
http://github.com/nathanborror/django-basic-apps) that the inlines one, as
coded, requires that basic be part of the app path.  See for example:

http://github.com/nathanborror/django-basic-apps/blob/master/basic/inlines/templatetags/inlines.py#L2

Those imports include 'basic' in their path.  If you have removed 'basic'
from the path where they are actually installed those imports are not going
to work any more.

Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: django basic blog and inlines

2009-11-16 Thread Bobby Roberts
the path to inlines.py is:

/django_apps/live/inlines/inlines.py


live is on my pythonpath (my main application)

blogs and inlines were pulled out of the basic app and put into these
directories

/django_apps/live/blog/  (works)
/django_apps/inlines/(doesn't work)

you can view the full traceback here:  
http://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/

it's like it's trying to call inlines from
django.templatetags.inlines   rather than from the inlines path noted
above.



On Nov 16, 10:49 am, Bill Freeman  wrote:
> Do you have among your installed apps a name identifying a directory on the
> python path having both a models.py and a subdirectory named templatetags,
> that subdirectory containing a file inlines.py ?  Or was that in the stuff you
> excluded from basic.app?
>
> Bill
>
> On Sun, Nov 15, 2009 at 10:34 PM, Bobby Roberts  wrote:
> > ok i have no idea what is going on here.  I have django basic blog
> > loaded to my site.  I've also installed inlines as follows:
>
> > INSTALLED_APPS = (
> > ...
> >    'inlines',
> >    'blog',
> > )
>
> > (yeah i pulled out the blog dir from the basic dir because i'm not
> > using all the other basic app stuff)
>
> > You can verify the blog is in fact working by going here:
> >http://www.thecigarcastle.com/blog/
>
> > Now click on the title to one of the posts:
>
> > The error i'm getting is:
>
> > 'inlines' is not a valid tag library: Could not load template library
> > from django.templatetags.inlines, No module named parser
>
> > You can see the full traceback here:
> >http://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/
>
> > any ideas why this isn't working?
>
> > --
>
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Making the case for Django (vs. Drupal)

2009-11-16 Thread Mike Ramirez
On Sunday 15 November 2009 19:23:26 Kenneth Gonsalves wrote:
> On Monday 16 Nov 2009 6:50:10 am Christophe Pettus wrote:
> > On Nov 15, 2009, at 5:10 PM, Kenneth Gonsalves wrote:
> > > I do also point out to plone vs drupal, but there again the
> > > argument is the drupal is more widely used and hence has more
> > > observable
> > > vulnerabilities. It does not sound logical.
> >
> > I don't think that anyone is seriously arguing that a piece of
> > software being widely adopted somehow creates new security
> > vulnerabilities in it.  I believe the assumption is that all software
> > of a given level of complexity has roughly the same number of
> > vulnerabilities, either exposed or hidden.  Thus, the more used a
> > piece of software, the more attention the bad guys give it, and thus
> > the more of those hidden security problems become exposed.
> 
> it is precisely this assumption that does not seem logical to me. But
>  frankly I do not know how to counter it ;-)
> 

How is it not logical?  Product A is widely used, Product B is used less. Bad 
Guy A. is smart enough to realize that product A if broken can be used to gain 
him more presents because more users have it. This is because of the human 
condition of laziness and the majority are not really paying attention to what 
they are doing. This is a fact. If you're one that thinks about everything 
they are doing, i.e. every litteral step yout take down the hall is carefully 
planned.  Then you are most likely going to avoid Bad Guy A, and be a 
minority.  I hardly meet people who do this, they just act without thinking. 

Its illogical to think that everyone or the majority will not succumb to 
laziness because this is our ideal goal as a society.  Everything we build do 
is to make our lives easier so we can be lazy without worry.

Mike

-- 
The chat program is in public domain.  This is not the GNU public license.
If it breaks then you get to keep both pieces.
-- Copyright notice for the chat program


signature.asc
Description: This is a digitally signed message part.


Re: Trouble setting a form field's value in clean()

2009-11-16 Thread Dennis Kaarsemaker
On Mon, Nov 16, 2009 at 5:12 PM, Adam Stein  wrote:
> Running Django v1.1.1 on Apache v2.2.8 with Firefox v3.5.4.
>
> I have a very simplified and unreal example below to demonstrate what's
> happening.
>
>8 --
>
>    def clean(self):
>        cleaned = self.cleaned_data
>
>        if not cleaned.has_key("string2") and
> cleaned.has_key("string1"):
>            cleaned["string2"] = string1
>
>        return cleaned
>8 --
>
> What happens is that Django comes back with an error message because
> 'string2' is required and has no associated value.  Is there any way to
> set a field value that get's POST'd?

clean() is run after the built-in validation and per-field validation.
You'll want to copy request.POST, set the value there, and then feed
it to the form. Or make string2 not required and do it in clean the
way you do now.

-- 
Dennis K.

Time is an illusion, lunchtime doubly so.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Object Edition Moderation

2009-11-16 Thread lfrodrigues
Hello,

I've been using admin to create/change some objects in my company.

Now I have a new set of users that will be able to change objects but
a moderator needs to approve the changes. Do you have any suggestion
on how to implement this?

Best regards,

Luis

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Django i18n

2009-11-16 Thread Antoni Aloy
2009/11/16 Carlos Ricardo Santos :
> Hi:
> I tried all the ways possible and impossible to make my Django project have
> i18n...
> Put all settings (INSTALLED_APPS, CONTEXT_PROCESSORS), generated languages,
> compiled messages, edited the ".po" files, setted the ugettext to "_", in
> views all the strings are like this: toSend= _("Hello"), but so far... only
> the Administrator panel is translated cause I checked (put a post form to
> change the language in the backoffice).
> I found that changing language only works for POST requests... Ok, DONE.
> But even with a post... only the backoffice seems to be responding to my
> language change request...
> I use to folders at app/locale:
> pt-PT
> en-GB
> Any ideas? Someone has implemented a foreign language before?
> Thanks in advance.
Hi Ricardo,

Just have a look at
http://code.google.com/p/appfusedjango/source/browse/#svn/trunk/appagenda,
you'll find an agenda example with different languages.


-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Changing the admin templates

2009-11-16 Thread Zeynel
My app is almost done but before I send it out to get some feedback I
want to make a couple of more design tweaks.

I changed the branding on the login dialogue box and on the dark blue
band on top, by changing the template base_site.html.

On the home page (www.swimswith.com/admin/) I want to change the title
"Site administration" and on the change page (www.swimswith.com/admin/
wkw1/lawyer) I want to change the title "Select lawyer to change".

I went through each template in the directory

/webapps/django/lib/python2.5/django/contrib/admin/templates/admin

but could not see any similar text to change. Can anyone help about
finding the right template?

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-us...@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=.




Re: Default sort order in admin

2009-11-16 Thread Zeynel
Thanks!

I noticed that using

class Lawyer(models.Model):
...
ordering = ('last',)

did not work.

But this worked

class Lawyer(models.Model):
...
class Meta:
ordering = ('last',)

copied from http://www.djangoproject.com/documentation/models/ordering/


What is the correct way actually?


On Nov 16, 10:22 am, Karen Tracey  wrote:
> On Mon, Nov 16, 2009 at 10:11 AM, Zeynel  wrote:
> > Hi,
>
> > Is there a way to change the default sort order in admin of my sqlite
> > db? At this point it sorts the table in the order entered (last
> > entered item first).
>
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contri...
>
> Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Using Sass with Django makes CSS so much easier to maintain

2009-11-16 Thread Jason
I had been eyeing Sass for a while, hoping to get to use it on a
project. When we chose Django instead of Rails for FeedMagnet, I was
bummed that we wouldn't have access to the Rails Sass gem.

Thankfully I found Compass - it let's us generate all our CSS from
Sass source files and it works really well. Even thought it is built
in Ruby, we don't need to run it on our production server - just on
our development boxes. It updates our CSS automatically every time we
change a Sass file - all we need on the production server is the
generated CSS. Even though it is not an "integrated" solution, as far
as I can tell Compass is the best way to get Sass working with Django
- and it has definitely been worth it to get to use Sass - huge time
saver.

I wrote a blog post to show how we're using Sass to set up our grid
variables that set the width of pretty much every block element in the
site. I thought I'd share how we were doing things in hopes that
others can benefit.

Here's the link to the post: http://budurl.com/sass

- Jason

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Django i18n

2009-11-16 Thread Carlos Ricardo Santos
Hi:

I tried all the ways possible and impossible to make my Django project have
i18n...
Put all settings (INSTALLED_APPS, CONTEXT_PROCESSORS), generated languages,
compiled messages, edited the ".po" files, setted the ugettext to "_", in
views all the strings are like this: toSend= _("Hello"), but so far... only
the Administrator panel is translated cause I checked (put a post form to
change the language in the backoffice).

I found that changing language only works for POST requests... Ok, DONE.
But even with a post... only the backoffice seems to be responding to my
language change request...

I use to folders at app/locale:

pt-PT
en-GB

Any ideas? Someone has implemented a foreign language before?

Thanks in advance.

-- 
Carlos Ricardo Santos

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Trouble setting a form field's value in clean()

2009-11-16 Thread Adam Stein
Running Django v1.1.1 on Apache v2.2.8 with Firefox v3.5.4.

I have a very simplified and unreal example below to demonstrate what's
happening.

class MyForm(forms.Form):
string1 = forms.CharField()

string2 = forms.CharField(widget = forms.HiddenInput())

def clean(self):
cleaned = self.cleaned_data

if not cleaned.has_key("string2") and
cleaned.has_key("string1"):
cleaned["string2"] = string1

return cleaned

As seen, both 'string1' and 'string2' are required.  In the clean()
method, if string2 isn't defined, I set it to a value.  For my simple
case, I'm just setting it to the value of another field on the form.

What happens is that Django comes back with an error message because
'string2' is required and has no associated value.  Is there any way to
set a field value that get's POST'd?  Even if I make 'string2' not
required (so it winds up being an empty string), there still doesn't
seem to be a way to change the empty string to have a value.  While
validation passes, the resulting POST data still shows 'string2' as an
empty string.

I thought that changing and returning the cleaned data would do it, but
apparently not.
-- 
Adam Stein @ Xerox Corporation   Email: a...@eng.mc.xerox.com

Disclaimer: Any/All views expressed
here have been proven to be my own.  [http://www.csh.rit.edu/~adam/]

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Making the case for Django (vs. Drupal)

2009-11-16 Thread Tom Evans
On Mon, Nov 16, 2009 at 5:25 AM, Melvyn Sopacua <
msopa...@warp10.thruhere.net> wrote:

> On Mon, 16 Nov 2009 08:53:26 +0530, Kenneth Gonsalves 
> wrote:
> > On Monday 16 Nov 2009 6:50:10 am Christophe Pettus wrote:
> >> On Nov 15, 2009, at 5:10 PM, Kenneth Gonsalves wrote:
> >> > I do also point out to plone vs drupal, but there again the
> >> > argument is the drupal is more widely used and hence has more
> >> > observable
> >> > vulnerabilities. It does not sound logical.
> >>
> >> I don't think that anyone is seriously arguing that a piece of
> >> software being widely adopted somehow creates new security
> >> vulnerabilities in it.  I believe the assumption is that all software
> >> of a given level of complexity has roughly the same number of
> >> vulnerabilities, either exposed or hidden.  Thus, the more used a
> >> piece of software, the more attention the bad guys give it, and thus
> >> the more of those hidden security problems become exposed.
> >>
> >
> > it is precisely this assumption that does not seem logical to me. But
> > frankly
> > I do not know how to counter it ;-)
>
> It is quite simple. Say you write a letter. You proofread the result.
> You give it to someone else to proofread and it's likely he/she finds
> a few more typos. The longer the letter, the more mistakes you'll
> make (absolute), while the percentage might stay the same.
> The more eyes look at it, the better your chances are that you will
> send a flawless letter.
> Now, the question arises whether a program is more secure if it has
> more exposure (proofreaders) or less and a bit of both is true.
> The more proofreaders the less chance a bug remains, yet since
> exploiting the bug requires knowledge to be shared and/or
> incorporated into attack software, the chance that *you* as a user
> gets exploited through one of these bugs lessens.
> Think of this as the difference between a cabin in the mountains,
> no locks on the door and a 5 mile steep hike to get there, versus
> a bank downtown. Obviously, the bank is more secure, yet it's
> much less likely that someone will try and rob the cabin.
>


Metaphors are messy and tend to break down. There may be more spelling
mistakes in the Drupal letter, but that is because it is a letter and django
is an alphabet...

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: first project taking it too production server

2009-11-16 Thread Mike Ramirez
On Monday 16 November 2009 06:11:47 Amit Sethi wrote:
> Hi , I just developed my first small app using django , I wish to
> deploy it . I have a apache server with drupal running on it . Can
> anybody guide me about the procedure i should use to deploy the
> project without disturbing the drupal installation in any way...
> 

It's as simple as setting up the django project using the deployment 
instructions in the docs[1] in it's own virtualhost[2] directive.  


Mike

[1] http://docs.djangoproject.com/en/dev/howto/deployment/
[2] http://httpd.apache.org/docs/2.2/vhosts/

-- 
"This is lemma 1.1.  We start a new chapter so the numbers all go back to 
one."
-- Prof. Seager, C 351


signature.asc
Description: This is a digitally signed message part.


Re: django basic blog and inlines

2009-11-16 Thread Bill Freeman
Do you have among your installed apps a name identifying a directory on the
python path having both a models.py and a subdirectory named templatetags,
that subdirectory containing a file inlines.py ?  Or was that in the stuff you
excluded from basic.app?

Bill

On Sun, Nov 15, 2009 at 10:34 PM, Bobby Roberts  wrote:
> ok i have no idea what is going on here.  I have django basic blog
> loaded to my site.  I've also installed inlines as follows:
>
> INSTALLED_APPS = (
> ...
>    'inlines',
>    'blog',
> )
>
> (yeah i pulled out the blog dir from the basic dir because i'm not
> using all the other basic app stuff)
>
> You can verify the blog is in fact working by going here:
> http://www.thecigarcastle.com/blog/
>
> Now click on the title to one of the posts:
>
>
> The error i'm getting is:
>
> 'inlines' is not a valid tag library: Could not load template library
> from django.templatetags.inlines, No module named parser
>
>
> You can see the full traceback here:
> http://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/
>
>
> any ideas why this isn't working?
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Encoding ISO-8859-1

2009-11-16 Thread ulferik
Karen I did as you said and it is amazing what know-how can do.
I am yours forever.
Ulferik

On 16 Nov, 16:20, Karen Tracey  wrote:
> On Mon, Nov 16, 2009 at 10:08 AM, ulferik  wrote:
> > Thank's Karen for your reply.
> > With php+smarty I do the same I make a base template on which I have
> > some
> > stuff that is the same for all. In the template I place a meta tag
> > with charset=ISO-8859-1
> > and everything is fine.
>
> The meta tag, I'd guess, will affect how the browser interprets the data.
>
> > With Django it doesn't make any difference
> > what I place in meta or
> > xml tags. The template is processed and it is UTF-8 whether I like it
> > or not.
> > This not a matter of database or views or models it is a base
> > template.
> > I have read the manual regarding charset and I can't make any sence
> > from it. What I need
> > is an example that shows how to...
>
> FILE_CHARSET is a setting, so you need to put it in your settings.py file,
> not in any template file. Include:
>
> FILE_CHARSET = 'iso-8859-1'
>
> in your settings.py file (and, if necessary, restart your server).  Then
> Django will stop assuming that your template files are encoded in utf-8 and
> instead will read them assuming iso-8859-1 encoding.
>
> Note if you also want to retrain this encoding, instead of utf-8, for all
> responses sent by your application, you will need to also set
> DEFAULT_CHARSET:
>
> http://docs.djangoproject.com/en/dev/ref/settings/#default-charset
>
> By default Django will encode outgoing responses in utf-8, so if you want to
> send your responses with another encoding you need to change this one also.
> But I am not sure why you would want to do that instead of just sending the
> response using utf-8?
>
> Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Making the case for Django (vs. Drupal)

2009-11-16 Thread Melvyn Sopacua
On Mon, 16 Nov 2009 08:53:26 +0530, Kenneth Gonsalves 
wrote:
> On Monday 16 Nov 2009 6:50:10 am Christophe Pettus wrote:
>> On Nov 15, 2009, at 5:10 PM, Kenneth Gonsalves wrote:
>> > I do also point out to plone vs drupal, but there again the
>> > argument is the drupal is more widely used and hence has more  
>> > observable
>> > vulnerabilities. It does not sound logical.
>> 
>> I don't think that anyone is seriously arguing that a piece of  
>> software being widely adopted somehow creates new security  
>> vulnerabilities in it.  I believe the assumption is that all software  
>> of a given level of complexity has roughly the same number of  
>> vulnerabilities, either exposed or hidden.  Thus, the more used a  
>> piece of software, the more attention the bad guys give it, and thus  
>> the more of those hidden security problems become exposed.
>> 
> 
> it is precisely this assumption that does not seem logical to me. But
> frankly 
> I do not know how to counter it ;-)

It is quite simple. Say you write a letter. You proofread the result.
You give it to someone else to proofread and it's likely he/she finds
a few more typos. The longer the letter, the more mistakes you'll
make (absolute), while the percentage might stay the same.
The more eyes look at it, the better your chances are that you will
send a flawless letter.
Now, the question arises whether a program is more secure if it has
more exposure (proofreaders) or less and a bit of both is true.
The more proofreaders the less chance a bug remains, yet since
exploiting the bug requires knowledge to be shared and/or
incorporated into attack software, the chance that *you* as a user
gets exploited through one of these bugs lessens.
Think of this as the difference between a cabin in the mountains,
no locks on the door and a 5 mile steep hike to get there, versus
a bank downtown. Obviously, the bank is more secure, yet it's
much less likely that someone will try and rob the cabin.
-- 
Melvyn Sopacua

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Default sort order in admin

2009-11-16 Thread Karen Tracey
On Mon, Nov 16, 2009 at 10:11 AM, Zeynel  wrote:

> Hi,
>
> Is there a way to change the default sort order in admin of my sqlite
> db? At this point it sorts the table in the order entered (last
> entered item first).
>
>
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.ordering

Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Encoding ISO-8859-1

2009-11-16 Thread Karen Tracey
On Mon, Nov 16, 2009 at 10:08 AM, ulferik  wrote:

> Thank's Karen for your reply.
> With php+smarty I do the same I make a base template on which I have
> some
> stuff that is the same for all. In the template I place a meta tag
> with charset=ISO-8859-1
> and everything is fine.


The meta tag, I'd guess, will affect how the browser interprets the data.


> With Django it doesn't make any difference
> what I place in meta or
> xml tags. The template is processed and it is UTF-8 whether I like it
> or not.
> This not a matter of database or views or models it is a base
> template.
> I have read the manual regarding charset and I can't make any sence
> from it. What I need
> is an example that shows how to...
>
>
FILE_CHARSET is a setting, so you need to put it in your settings.py file,
not in any template file. Include:

FILE_CHARSET = 'iso-8859-1'

in your settings.py file (and, if necessary, restart your server).  Then
Django will stop assuming that your template files are encoded in utf-8 and
instead will read them assuming iso-8859-1 encoding.

Note if you also want to retrain this encoding, instead of utf-8, for all
responses sent by your application, you will need to also set
DEFAULT_CHARSET:

http://docs.djangoproject.com/en/dev/ref/settings/#default-charset

By default Django will encode outgoing responses in utf-8, so if you want to
send your responses with another encoding you need to change this one also.
But I am not sure why you would want to do that instead of just sending the
response using utf-8?

Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Default sort order in admin

2009-11-16 Thread Zeynel
Hi,

Is there a way to change the default sort order in admin of my sqlite
db? At this point it sorts the table in the order entered (last
entered item first).

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-us...@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=.




Re: Encoding ISO-8859-1

2009-11-16 Thread ulferik
Thank's Karen for your reply.
With php+smarty I do the same I make a base template on which I have
some
stuff that is the same for all. In the template I place a meta tag
with charset=ISO-8859-1
and everything is fine. With Django it doesn't make any difference
what I place in meta or
xml tags. The template is processed and it is UTF-8 whether I like it
or not.
This not a matter of database or views or models it is a base
template.
I have read the manual regarding charset and I can't make any sence
from it. What I need
is an example that shows how to...
Ulferik

On 16 Nov, 14:11, Karen Tracey  wrote:
> On Mon, Nov 16, 2009 at 3:59 AM, ulferik  wrote:
> > My problem is that when I put one of these characters (´ Å Ä Ö) in the
> > template I get an error like this "UnicodeDecodeError: 'utf8' codec
> > can't decode bytes in position 578-579: invalid data"
> > Normally I specify the encoding in meta like this "charset=ISO-8859-1"
> > or "xml version="1.0" encoding="ISO-8859-1" ". There must be a way of
> > changing the encoding in Django. If anyone know how to do that please
> > post it here:
>
> http://docs.djangoproject.com/en/dev/ref/settings/#file-charset
>
> Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: setup python, django for web development

2009-11-16 Thread Zeynel
This site has instructions 
http://www.webmonkey.com/tutorial/Install_Django_and_Build_Your_First_App
that appear to be simpler than the official django tutorial
http://docs.djangoproject.com/en/dev/intro/install/#intro-install

On Nov 16, 1:20 am, harshad  wrote:
> hello All,
>
> Im new to python, django. Can anyone help me as to how to do the setup
> on windows so that i can start developing web based applications on
> python.
>
> regards
> harshad

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Django/GoDaddy

2009-11-16 Thread Mark (Nosrednakram)
I'd check rpmforge see: 
http://wiki.centos.org/AdditionalResources/Repositories/RPMForge
for centos notes

On Nov 15, 3:27 pm, mkumm  wrote:
> Colin thanks - I will try installing all of the -devel stuff. ha - 2.4
> - thanks!
>
> On Nov 15, 2:32 pm, Colin Bean  wrote:
>
> > On Sun, Nov 15, 2009 at 6:15 AM, mkumm  wrote:
> > > I recently took on a new project for a new client where I was forced
> > > into using a GoDaddy Virtual Server (literally it was a deal breaker).
> > > Anyway I have configured about 1/2 dozen servers to run django - but I
> > > am stumped on this. I am looking for help from anyone who may have
> > > this experience.
> > > Server: CentOS 5
> > > Python 1.4
> > > Django 1.1.1
>
> > > 1. mod_wsgi was not available so I tried to compile from source. The
> > > apache apsx was not available and other attempts to config failed. I
> > > grabbed the apache source-dev to get the apsx, but the config failed.
> > > No problem I moved on to mod_python
>
> > > 2. Attempted to launch the app and got an error that there was no
> > > pysqlite2, they had the previous version. I pulled the latest version
> > > but again had failed at config. I moved to mysql and again the version
> > > that was available on yum was too old and trying to compile by the
> > > newer version failed at config.
>
> > > Their technical support person was mean and less helpful than a sharp
> > > stick.
>
> > > In short: I can't compile any of the necessary components, all of the
> > > yum updates are too old. My only other options for server are Cent OS
> > > 4 and Fedora Core 7 (I come from the Debian World mostly). Any
> > > recommendations?
>
> > > --
>
> > > You received this message because you are subscribed to the Google Groups 
> > > "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/django-users?hl=.
>
> > If it's a normal CentOS 5 install you should be able to yum install
> > httpd-devel to get aspx.  If your pysqlite build is failing because of
> > prerequisites, there might be other development packages that you
> > could install with yum (python-devel at the very least, probabaly
> > sqlite-devel too).  'yum search' is helpful for finding out what
> > packages are out there.
>
> > Also are you really running python 1.4?
>
> > Colin

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: What would cause an app to not register?

2009-11-16 Thread Mark (Nosrednakram)
Hello,

I'm not expert but have seen this behavior when I have a bad import.
I would start by trying  ./manage.py shell and copy past your imports
from models and then views or other imports.  It's almost always been
a bad import when I've seen this and ./manage.py syncd will fail
silently and ./manage.py validate won't find any errors.  Hope this
helps let us know what you find please.

Mark

On Nov 15, 4:12 pm, Joshua Kramer  wrote:
> Howdy Everyone!
>
> After having installed a fresh version of Pinax 0.7.1, I have an
> interesting problem with the behavior of Django when I try to install
> custom applications.
>
> In my main project directory, I've created an 'apps' directory, and
> created some standard django skeleton apps.  When I tried to run
> 'syncdb', I noticed the tables were not created for my models.
>
> After some amount of tracing, I found out that Django is not
> registering my apps, with my models.  With skeleton models the apps
> register fine.  When I say 'register', I mean this: I detect if an app
> is registered or not by doing this in manage.py:
>
> from django.db import models
> myApps = models.get_apps()
>
> I then look through the myApps list to see if my apps are present.  I
> note that all of the Pinax apps are always present.
>
> Here is an example.  This model causes the app to not register:
>
> ---
> from django.conf import settings
>
> from django.contrib.gis.db import models
> from django.contrib.localflavor.us.models import USStateField
>
> class Zipcode(models.Model):
>    code = models.CharField(max_length=10)
>    poly = models.PolygonField()
>    objects = models.GeoManager()
>
> class Address(models.Model):
>    addrKey = models.CharField(max_length=32)
>    num = models.IntegerField()
>    street = models.CharField(max_length=128)
>    city = models.CharField(max_length=64)
>    state = USStateField()
>    zipcode = models.ForeignKey(Zipcode)
>    objects = models.GeoManager()
> -
>
> This code allows the app to register:
>
> 
> from django.db import models
> 
>
> Has anyone seen this before?
>
> Thanks,
> -Josh

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Confirm email by matching on form

2009-11-16 Thread Daniel Roseman
On Nov 16, 2:06 pm, Andy  wrote:
> Thank you all for your replies.  Karen, both good points.  pjrharley,
> I agree with Dennis.  If the user is required to re-type their email
> address, then that in combination with Django's simple built in email
> validation should be sufficient.
>
> I am using a ModelForms right now.  If I remove email_conf from my
> model, do I add it to the ModelForm, place it in the html form or
> create a new form to handle it?  I guess I'm still a little unsure as
> to when to use Forms over ModelForms.

Just add it to the ModelForm. Extra fields added to modelforms work
the same as normal forms.
--
DR.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Confirm email by matching on form

2009-11-16 Thread Dirk Uys
On Mon, Nov 16, 2009 at 4:06 PM, Andy  wrote:

> Thank you all for your replies.  Karen, both good points.  pjrharley,
> I agree with Dennis.  If the user is required to re-type their email
> address, then that in combination with Django's simple built in email
> validation should be sufficient.
>
> I am using a ModelForms right now.  If I remove email_conf from my
> model, do I add it to the ModelForm, place it in the html form or
> create a new form to handle it?  I guess I'm still a little unsure as
> to when to use Forms over ModelForms.
>
>
Just add it to the CustomerForm class. A ModelForm is pretty much a normal
Form with some logic to auto generate the fields from the Model.

Regards
Dirk

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




first project taking it too production server

2009-11-16 Thread Amit Sethi
Hi , I just developed my first small app using django , I wish to
deploy it . I have a apache server with drupal running on it . Can
anybody guide me about the procedure i should use to deploy the
project without disturbing the drupal installation in any way...

-- 
A-M-I-T S|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-us...@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=.




Re: Confirm email by matching on form

2009-11-16 Thread Andy
Thank you all for your replies.  Karen, both good points.  pjrharley,
I agree with Dennis.  If the user is required to re-type their email
address, then that in combination with Django's simple built in email
validation should be sufficient.

I am using a ModelForms right now.  If I remove email_conf from my
model, do I add it to the ModelForm, place it in the html form or
create a new form to handle it?  I guess I'm still a little unsure as
to when to use Forms over ModelForms.

On Nov 15, 3:51 pm, Dennis Kaarsemaker  wrote:
> On zo, 2009-11-15 at 13:38 -0800, pjrhar...@gmail.com wrote:
>
> > Also, I have an even simpler suggestion. Don't make the user confirm
> > their email. I'm getting fed up with seeing this on forms all over the
> > web when it serves no purpose at all. You confirm a password because
> > you can't read it back. You don't ask them to confirm every other
> > field do you?
>
> Where I work, we require users to confirm their e-mail address as well
> and for a very good reason: too often do people make typos there. For
> fields like 'your name' that's not too important but we send them e-mail
> with important details and this is an easy measure to make sure less of
> this mail bounces :)
>
> --
> Dennis K.
>
> The universe tends towards maximum irony. Don't push it.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Encoding ISO-8859-1

2009-11-16 Thread Karen Tracey
On Mon, Nov 16, 2009 at 3:59 AM, ulferik  wrote:

> My problem is that when I put one of these characters (´ Å Ä Ö) in the
> template I get an error like this "UnicodeDecodeError: 'utf8' codec
> can't decode bytes in position 578-579: invalid data"
> Normally I specify the encoding in meta like this "charset=ISO-8859-1"
> or "xml version="1.0" encoding="ISO-8859-1" ". There must be a way of
> changing the encoding in Django. If anyone know how to do that please
> post it here:
>

http://docs.djangoproject.com/en/dev/ref/settings/#file-charset

Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: PostgreSQL triggers with Django?

2009-11-16 Thread Daniel Quinn
On Monday 16 November 2009 08:43:35 Alessandro Pasotti wrote:
> after banging my head for a few hours, I've found a solution to this
>  problem with a snippet:
> 
> http://www.djangosnippets.org/snippets/1338/
> 
> This works for me with the standard SQL syntax (dollar quoting), just put
> your custom sql in
> 
> your_app/sql/custom.sql

That totally worked!  Thank you.  Could someone please explain to me though 
what exactly that snippet is doing?  I'm still quite new to Django, and I'm 
not yet used to this "drop this file in here and watch the magic go" way of 
doing things.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: updating parent model on inline creation

2009-11-16 Thread Viktor
On nov. 14, 02:13, Preston Holmes  wrote:
> I'm setting up a conference website where a submission will have one
> or more "reviews"
>
> I've got the reviews set as inlines for submissions in the admin
>
> The submission model has a "status" field that needs to go through
> steps like "submitted" and "pending review"
>
> What I'd like to do is when the first review is created via the
> inline, update the status on the parent submission model.
>
> I thought of two ways to do this.
>
> The first more complicated way would be to right my own view for this
> with subclassed formset handling that would do this.
>
> The second idea which I now am liking better should also work:
>
> register a funciton for post_save signals on the submission model, and
> then (in pseudo code)
>
> if submission.status == "submitted" and submission.reviews.count > 0:
> submission.status = "pending review"
>
> If this were a busy site - the signal based system might be heavy on
> the database, but this is a project where we will never see real load.
>
> Are there even simpler ways to do this that I haven't thought of?
>
> -Preston

sure, if this is REALLY a requirement, then build it into your model's
save method

when you save the review, set the submission status directly from the
save method, not via signals

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-us...@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=.




Encoding ISO-8859-1

2009-11-16 Thread ulferik
My problem is that when I put one of these characters (´ Å Ä Ö) in the
template I get an error like this "UnicodeDecodeError: 'utf8' codec
can't decode bytes in position 578-579: invalid data"
Normally I specify the encoding in meta like this "charset=ISO-8859-1"
or "xml version="1.0" encoding="ISO-8859-1" ". There must be a way of
changing the encoding in Django. If anyone know how to do that please
post it here:
Ulferik

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




Re: Questions about ContentType generic relations

2009-11-16 Thread Daniel Roseman
On Nov 16, 8:12 am, Continuation  wrote:
> > As the docs show, when you've defined a GenericRelation, querying is
> > exactly the same as with a reverse foreign key. So:
> > Bookmark.objects.get(tags__tag='django')
>
> A somewhat related question:
>
> What if instead of having a ForeignKey to ContentType, TaggedItem has
> a direct ForeignKey to Bookmark.
>
> In that case is there something similar to GenericRelation that I can
> define for Bookmark so that I can still use Bookmark.objects.get
> (tags__tag='django') (or something similar) to find all bookmarks with
> the tag "django"?
>
> The doc said "You cannot access a reverse ForeignKey Manager from the
> class; it must be accessed from an instance", but  in this case I
> really need to start with the class Bookmark instead of an instance.
> So what can I do?
>
> Thanks.

It works exactly the same, as the document I linked to shows. The
syntax you give should work with a standard ForeignKey - did you try
it?
--
DR.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.




  1   2   >