RE: using a models fields

2011-04-05 Thread Chris Matthews
Hi Jay,

I am no Geo expert but if you use the CharField then you can specify N/E/S/W 
(North/East/South/West) or + and - to control latitude & longitude. With the 
DecimalField you can only use the + and -.

BTW, Marty Alchin's book Pro Django (Chapter 5 page 118), shows a nice example 
to validate user input for latitude & longitude. He actually use the 
DecimalField and extends it with a clean method, checking that latitude values 
to fall in -90 to 90 & longitude values to fall in -180 to 180.

Regards
Chris


From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of bishwendu kundu
Sent: 05 April 2011 02:41
To: django-users@googlegroups.com
Subject: Re: using a models fields

You can try saving the data as 
latitude=models.DecimalField(max_digits=7,decimal_places=4).Same for the 
longitude field.Here the max_digits takes into account both decimal and 
non-decimal places.All the data can be given in string form as it will be 
automatically converted to proper format as specified in your models for 
storing in database. I guess you will be using some criteria to extract data 
from the database...so,code can look like

list_of_XYZ()=XYZ.objects.filter(criteria)
for i in list_of_XYZ:
i.latitude,i.longitude ,i.zoomlevel
On Tue, Apr 5, 2011 at 1:45 AM, jay K. 
> wrote:
Hello,

I got a couple of fields from a model I want to use

so the models.py looks like this

class XZY():

   latitude = models.CharField()
   longitude = models.CharField(.)
   zoomlevel = models.CharField()

I want to retrieve the data inside latitude, longitude and zoomlevel
to be able to create a static map for different locations, using google maps

How can I retrieve the fields data?

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

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

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



RE: Python Decorators

2011-04-05 Thread Chris Matthews
Hi cootetom,

For decorators you must have a look at the excellent articles/tutorials:
http://www.artima.com/weblogs/viewpost.jsp?thread=240808 
http://www.artima.com/weblogs/viewpost.jsp?thread=240845

It covers decorators with (what you want to do) and without parameters.
Regards
Chris

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of cootetom
Sent: 04 April 2011 15:31
To: Django users
Subject: Python Decorators

Hi all, not exactly a django question but here goes... I'm trying to
implement a decorator with one positional argument and one keyword
argument. My wrapper function gets the positional argument just fine
but the keyword argument throws an error "NameError: name 'as_string'
is not defined."

Code is;

def widget(widget_switch, as_string=False):
def decorator(func):
def wrapper(*args, **kwargs):
# logic in here can access the value of 'widget_switch'
but 'as_string' is not defined?
return func(*args, **kwargs)
return wrapper
return decorator

So if I decorate a view function with "@widget('some_widget',
as_string=True)" then the wrapper function is unable to use
'as_string'. I thought this was how python closer worked?

Any ideas?

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

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



Re: I want to get facebook uid to my python function.

2011-04-05 Thread Mike Ramirez
On Tuesday, April 05, 2011 08:11:49 pm Nge wrote:
> Dear All !
> 
> I am creating Django user login page via facebook.
> Now I am using the facebook JavaScript SDK and facebook login button.
> I can login and get the facebook user's uid. I want to compare this
> facebook uid with my database on python function.
> How should I do? Now I can not take the facebook uid to python
> function.
> 
> Thanks
> Nge

Restful interfaces help this situation.  When you get the uid through 
javascript, make an ajax post/get to the server and pass the uid to the 
function that way. If you need it before you render the page, there are python 
facebook modules you can use. 

Mike

-- 
Gratitude, like love, is never a dependable international emotion.
-- Joseph Alsop

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



I want to get facebook uid to my python function.

2011-04-05 Thread Nge
Dear All !

I am creating Django user login page via facebook.
Now I am using the facebook JavaScript SDK and facebook login button.
I can login and get the facebook user's uid. I want to compare this
facebook uid with my database on python function.
How should I do? Now I can not take the facebook uid to python
function.

Thanks
Nge

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



Re: django-admin.py startproject mysite

2011-04-05 Thread Karen Tracey
On Mon, Apr 4, 2011 at 4:11 AM, Santiago Caracol  wrote:

> Does the Django tutorial still match reality?


Yes, startproject is still a valid command for django-admin.py. Do you have
the environment variable DJANGO_SETTINGS_MODULE set to something? That would
cause the behavior you are seeing, per:
http://docs.djangoproject.com/en/dev/ref/django-admin/#startproject-projectname

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

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



Including other fields in Admin interface

2011-04-05 Thread Joseph Hunt
Greetings,
I'm sure there is a simple solution to what I'm trying to do but 
unfortunately I wasn't able to find it in the documentation.
I have the following model (simplified version shown):

class Student(models.Model):
  student_id = models.IntegerField(primary_key=True, unique=True,
  db_index=True, max_length=9)
  first_name = models.CharField(max_length=50)
  last_name  = models.CharField(max_length=50)

  def __unicode__(self):
return u"%s %s" % (self.first_name, self.last_name)

class Course(models.Model):
  course_id = models.AutoField(primary_key=True, unique=True,
  db_index=True, max_length=4)
  title = models.CharField(max_length=50)
  dept = models.CharField(max_length=6)
  number = models.IntegerField(max_length=5)
  student_id = models.ManyToManyField(Student, blank=True)

  def __unicode__(self):
return u"%s %s" % (self.dept, self.number)

What I wanted was to be able to add students to multiple classes in the 
admin interface similar to the way that I can add students in the classes 
admin interface.

Thanks in advance for any help!

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



Re: LDAP and 1.2

2011-04-05 Thread Mike Dewhirst

On 6/04/2011 12:44am, Sells, Fred wrote:


Because our active directory contains many more users than are allowed 
to use my django app, I have a cron job that runs every 5 minutes and 
updates a mysql database with the subset I care about. That way if AD 
is offline at the time, I’m not hosed.




If you used django-ldap-groups you could create a security group of only 
those permitted to log in. I think that would be much more manageable 
than a cron job.


I thought to take the same line about eDirectory being off-line and not 
stopping access but although I could have done so, it would have 
introduced an unnecessary security hole. If eDirectory is off-line it is 
just tough. In my case it ain't supposed to be off-line.


Mike

*From:*django-users@googlegroups.com 
[mailto:django-users@googlegroups.com] *On Behalf Of *Szabo, Patrick 
(LNG-VIE)

*Sent:* Tuesday, April 05, 2011 3:47 AM
*To:* django-users@googlegroups.com
*Subject:* LDAP and 1.2

Hi,

has anyone sucessfully conncted their django 1.2 app with Active 
Directory ?!


Which snippet did you use ?!

I’m concastantly getting „Invalid credentials“ Error -.-

Kind regards

. . . . . . . . . . . . . . . . . . . . . . . . . .

Patrick Szabo
XSLT Developer

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at 

Tel.: +43 (1) 534 52 - 1573

Fax: +43 (1) 534 52 - 146

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

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


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

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


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



Re: LDAP and 1.2

2011-04-05 Thread Mike Dewhirst

On 5/04/2011 5:46pm, Szabo, Patrick (LNG-VIE) wrote:


Hi,

has anyone sucessfully conncted their django 1.2 app with Active 
Directory ?!


Which snippet did you use ?!



I have had great success with Peter Herndon's ldap-groups in eDirectory ...

http://code.google.com/p/django-ldap-groups/

... and it should work equally well with AD

Mike


I’m concastantly getting „Invalid credentials“ Error -.-

Kind regards

. . . . . . . . . . . . . . . . . . . . . . . . . .

**

Patrick Szabo
XSLT Developer

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at 

Tel.: +43 (1) 534 52 - 1573

Fax: +43 (1) 534 52 - 146



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

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


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



how to have a comment hidden while moderated?

2011-04-05 Thread mongoose
hi

How do I setup the django comments so that when a comment is posted it
will not appear and be pending moderation( email sent to admin to
approve or reject comment )? As default it just posts and shows
straight away.
Do I need to use "class CommentModerator moderate_after" ?


thanks.

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



Re: wsgi configuration

2011-04-05 Thread Graham Dumpleton
Stop changing things around so much, it makes any suggestions by people 
useless by the time they suggest it.

Go watch:

http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations

It explains how to do things and where you can go wrong.

Graham

On Wednesday, April 6, 2011 5:46:26 AM UTC+10, yongzhen zhang wrote:
>
> Hi, thanks for reply, i have tried this. Now in order to make it 
> clear, i move the iStore under home, like this: "/home/yongzhen/ 
> iStore". django.wsgi is inside apache file and the apache file is 
> under iStore: "/home/yongzhen/iStore/django.wsgi". The content of 
> django.wsgi: 
>  import os, sys 
> wsgi_dir = os.path.abspath(os.path.dirname(__file__)) 
> project_dir = os.path.dirname(wsgi_dir) 
> sys.path.append(project_dir) 
> project_settings = os.path.join(project_dir,'settings') 
> os.environ['DJANGO_SETTINGS_MODULE'] = 'iStore.settings' 
> import django.core.handlers.wsgi 
> application = django.core.handlers.wsgi.WSGIHandler() 
>
> and in /etc/apache2/sites-available, there is istore file, i have $ 
> sudo a2ensite istore. the content of istore: 
> NameVirtualHost *:80 
>
>  
> ServerAdmin webmaster@localhost 
> ServerName www.imaboy.cn 
> ServerAlias shop.imaboy.cn 
> Alias /static /home/yongzhen/iStore/static 
> Alias /php /var/www 
> DocumentRoot /home/yongzhen/iStore 
> WSGIScriptAlias / /home/yongzhen/iStore/apache/django.wsgi 
> ErrorLog /var/log/apache2/error.log 
> LogLevel warn 
> CustomLog /var/log/apache2/access.log combined 
>  
>
> When i try to open www.imaboy.cn, here is the error in apache2 
> error.log: 
> [Tue Apr 05 22:43:03 2011] [error] Exception KeyError: 
> KeyError(-1218787584,) in  threading.pyc'> ignored 
> [Tue Apr 05 22:43:03 2011] [error] Exception KeyError: 
> KeyError(-1218787584,) in  threading.pyc'> ignored 
> [Tue Apr 05 22:43:03 2011] [error] Exception KeyError: 
> KeyError(-1218787584,) in  threading.pyc'> ignored 
> [Tue Apr 05 22:43:03 2011] [error] Exception KeyError: 
> KeyError(-1218787584,) in  threading.pyc'> ignored 
> [Tue Apr 05 22:43:03 2011] [error] Exception KeyError: 
> KeyError(-1218787584,) in  threading.pyc'> ignored 
> [Tue Apr 05 22:43:03 2011] [notice] caught SIGTERM, shutting down 
> PHP Deprecated:  Comments starting with '#' are deprecated in /etc/ 
> php5/apache2/conf.d/mcrypt.ini on line 1 in Unknown on line 0 
> [Tue Apr 05 22:43:04 2011] [notice] Apache/2.2.14 (Ubuntu) PHP/ 
> 5.3.2-1ubuntu4.7 with Suhosin-Patch mod_wsgi/2.8 Python/2.6.5 
> configured -- resuming normal operations 
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] mod_wsgi 
> (pid=8570): Exception occurred processing WSGI script '/home/yongzhen/ 
> iStore/apache/django.wsgi'. 
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] Traceback 
> (most recent call last): 
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/ 
> local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 
> 230, in __call__ 
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] 
> self.load_middleware() 
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/ 
> local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 
> 33, in load_middleware 
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] for 
> middleware_path in settings.MIDDLEWARE_CLASSES: 
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/ 
> local/lib/python2.6/dist-packages/django/utils/functional.py", line 
> 276, in __getattr__ 
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] 
> self._setup() 
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/ 
> local/lib/python2.6/dist-packages/django/conf/__init__.py", line 40, 
> in _setup 
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] 
> self._wrapped = Settings(settings_module) 
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/ 
> local/lib/python2.6/dist-packages/django/conf/__init__.py", line 75, 
> in __init__ 
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] raise 
> ImportError("Could not import settings '%s' (Is it on sys.path? Does 
> it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)) 
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] ImportError: 
> Could not import settings 'iStore.settings' (Is it on sys.path? Does 
> it have syntax errors?): No module named iStore.settings 
>
> Sorry to bother you, but i am very confused with this. 
>
> On 4月6日, 上午3时28分, anvydigital  wrote: 
> > try changing: 
> > 
> > os.environ['DJANGO_SETTINGS_MODULE']='www.iStore.settings' 
> > 
> > to: 
> > 
> > os.environ['DJANGO_SETTINGS_MODULE']='iStore.settings' 
> > 
> > Since 'www' folder is  on your path. 
> > 
> > GL

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to 

Re: wsgi configuration

2011-04-05 Thread Mark
Not sure if this will help, but worth a stab. Check this page:
http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango I had a
similar error and it fixed it for me.

After it tells you how to set up the django.wsgi it says this may not
work if you used the Django server to set up your site. Django puts
some paths in it that Python doesn't yet have using WSGI. Your
situation is a little complicated as I am just getting into Django,
but I figured I'd share this document if it may help.

Good luck,

Mark

On Apr 5, 12:46 pm, yongzhen zhang <4...@live.cn> wrote:
> Hi, thanks for reply, i have tried this. Now in order to make it
> clear, i move the iStore under home, like this: "/home/yongzhen/
> iStore". django.wsgi is inside apache file and the apache file is
> under iStore: "/home/yongzhen/iStore/django.wsgi". The content of
> django.wsgi:
>  import os, sys
> wsgi_dir = os.path.abspath(os.path.dirname(__file__))
> project_dir = os.path.dirname(wsgi_dir)
> sys.path.append(project_dir)
> project_settings = os.path.join(project_dir,'settings')
> os.environ['DJANGO_SETTINGS_MODULE'] = 'iStore.settings'
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
>
> and in /etc/apache2/sites-available, there is istore file, i have $
> sudo a2ensite istore. the content of istore:
> NameVirtualHost *:80
>
> 
>         ServerAdmin webmaster@localhost
>         ServerNamewww.imaboy.cn
>         ServerAlias shop.imaboy.cn
>         Alias /static /home/yongzhen/iStore/static
>         Alias /php /var/www
>         DocumentRoot /home/yongzhen/iStore
>         WSGIScriptAlias / /home/yongzhen/iStore/apache/django.wsgi
>         ErrorLog /var/log/apache2/error.log
>         LogLevel warn
>         CustomLog /var/log/apache2/access.log combined
> 
>
> When i try to openwww.imaboy.cn, here is the error in apache2
> error.log:
> [Tue Apr 05 22:43:03 2011] [error] Exception KeyError:
> KeyError(-1218787584,) in  threading.pyc'> ignored
> [Tue Apr 05 22:43:03 2011] [error] Exception KeyError:
> KeyError(-1218787584,) in  threading.pyc'> ignored
> [Tue Apr 05 22:43:03 2011] [error] Exception KeyError:
> KeyError(-1218787584,) in  threading.pyc'> ignored
> [Tue Apr 05 22:43:03 2011] [error] Exception KeyError:
> KeyError(-1218787584,) in  threading.pyc'> ignored
> [Tue Apr 05 22:43:03 2011] [error] Exception KeyError:
> KeyError(-1218787584,) in  threading.pyc'> ignored
> [Tue Apr 05 22:43:03 2011] [notice] caught SIGTERM, shutting down
> PHP Deprecated:  Comments starting with '#' are deprecated in /etc/
> php5/apache2/conf.d/mcrypt.ini on line 1 in Unknown on line 0
> [Tue Apr 05 22:43:04 2011] [notice] Apache/2.2.14 (Ubuntu) PHP/
> 5.3.2-1ubuntu4.7 with Suhosin-Patch mod_wsgi/2.8 Python/2.6.5
> configured -- resuming normal operations
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] mod_wsgi
> (pid=8570): Exception occurred processing WSGI script '/home/yongzhen/
> iStore/apache/django.wsgi'.
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] Traceback
> (most recent call last):
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/
> local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line
> 230, in __call__
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]
> self.load_middleware()
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/
> local/lib/python2.6/dist-packages/django/core/handlers/base.py", line
> 33, in load_middleware
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]     for
> middleware_path in settings.MIDDLEWARE_CLASSES:
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/
> local/lib/python2.6/dist-packages/django/utils/functional.py", line
> 276, in __getattr__
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]
> self._setup()
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/
> local/lib/python2.6/dist-packages/django/conf/__init__.py", line 40,
> in _setup
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]
> self._wrapped = Settings(settings_module)
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/
> local/lib/python2.6/dist-packages/django/conf/__init__.py", line 75,
> in __init__
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]     raise
> ImportError("Could not import settings '%s' (Is it on sys.path? Does
> it have syntax errors?): %s" % (self.SETTINGS_MODULE, e))
> [Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] ImportError:
> Could not import settings 'iStore.settings' (Is it on sys.path? Does
> it have syntax errors?): No module named iStore.settings
>
> Sorry to bother you, but i am very confused with this.
>
> On 4月6日, 上午3时28分, anvydigital  wrote:
>
>
>
>
>
>
>
> > try changing:
>
> > os.environ['DJANGO_SETTINGS_MODULE']='www.iStore.settings'
>
> > to:
>
> > os.environ['DJANGO_SETTINGS_MODULE']='iStore.settings'
>
> > Since 'www' folder is  on your path.
>

Jinja2 & Django 1.3 Integration - Example?

2011-04-05 Thread deefr
Hello-

I've been reading 
http://docs.djangoproject.com/en/dev/ref/templates/api/#using-an-alternative-template-language

and am interested in integrating Jinja2 with my Django 1.3 project.
The only useful example I have found is the following snippet:

http://djangosnippets.org/snippets/2063/

I get the following error for Line 16 in the above snippet.

'module' object has no attribute 'Template'


Can anyone tell me what I'm doing wrong, point me in the right
direction, or provide an up-to-date & working example similar to the
snippet above?

Thank you 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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: form.errors is not a dictionary?

2011-04-05 Thread Daniel Roseman


On Tuesday, April 5, 2011 9:43:48 PM UTC+1, Roy Smith wrote:
>
> I'm using django-1.3 .  I have a view with the following code: 
>
> def item_create(request): 
> if request.method == 'POST': 
> form = ItemForm(request.POST) 
> if form.is_valid(): 
> url = form.cleaned_data['url'] 
> item.save() 
> return HttpResponseRedirect('/') 
> else: 
> print form.errors 
>
> when I submit the form, I expected that form.errors would print out as 
> a dict, as documented in 
> http://docs.djangoproject.com/en/1.3/ref/forms/api/#using-forms-to-validate-data.
>  
>
> Instead, I'm getting a hunk of HTML: 
>
>
> Django version 1.3, using settings 'soco-site.settings' 
> Development server is running at http://0.0.0.0:7626/ 
> Quit the server with CONTROL-C. 
> date_addedThis 
> field is required.user_id class="errorlist">This field is required. 
> [05/Apr/2011 16:36:32] "POST /item/create/ HTTP/1.1" 200 718 
>
> Is my understanding wrong, or is this a bug? 
>


To coin a phrase, it's not a bug - it's a feature.

form.errors is actually an instance of a custom class, ErrorDict, which is 
defined in django.forms.util. It subclasses dict, so it works exactly the 
same as a dictionary when you set and access its members - but it also 
defines a custom __unicode__ method, which is called automatically when you 
`print` it, which converts the contents to HTML. This is so you get a 
nicely-formatted output in your template.
--
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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Caught NoReverseMatch while rendering:

2011-04-05 Thread GOUTAM KUMAR RANA
Environment:


Request Method: GET
Request URL: http://localhost:8000/

Django Version: 1.3
Python Version: 2.7.1
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'apps.data',
 'django.contrib.admin',
 'django.contrib.admindocs']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Template error:
In template 
d:\djangoproject\p_source_code\inventory\templates\homepage\index.html, 
error at line 7
   Caught NoReverseMatch while rendering: Reverse for 'homepage_about' with 
arguments '()' and keyword arguments '{}' not found.
   1 : {% extends "base.html"%}


   2 : {% block title %}


   3 : Index Page


   4 : {% endblock %}


   5 : 


   6 : {% block navi %}


   7 : home - about - archive - contactcontact


   8 : {% endblock %}


   9 : 


   10 : {% block content %}


   11 : Entries:


   12 : {% for e in entries %}


   13 :  {{ e.title }}-{{ e.created }} 


   14 :  {{ e.text }} 


   16 : {% endfor %}


   17 : {% endblock %}


Traceback:
File "C:\PYTHON27\lib\site-packages\django\core\handlers\base.py" in 
get_response
  111. response = callback(request, *callback_args, 
**callback_kwargs)
File 
"D:\DjangoProject\p_source_code\inventory\..\inventory\apps\homepage\views.py" 
in index
  7. return render_to_response('homepage/index.html',ctx)
File "C:\PYTHON27\lib\site-packages\django\shortcuts\__init__.py" in 
render_to_response
  20. return HttpResponse(loader.render_to_string(*args, **kwargs), 
**httpresponse_kwargs)
File "C:\PYTHON27\lib\site-packages\django\template\loader.py" in 
render_to_string
  183. return t.render(Context(dictionary))
File "C:\PYTHON27\lib\site-packages\django\template\base.py" in render
  123. return self._render(context)
File "C:\PYTHON27\lib\site-packages\django\template\base.py" in _render
  117. return self.nodelist.render(context)
File "C:\PYTHON27\lib\site-packages\django\template\base.py" in render
  744. bits.append(self.render_node(node, context))
File "C:\PYTHON27\lib\site-packages\django\template\debug.py" in render_node
  73. result = node.render(context)
File "C:\PYTHON27\lib\site-packages\django\template\loader_tags.py" in 
render
  127. return compiled_parent._render(context)
File "C:\PYTHON27\lib\site-packages\django\template\base.py" in _render
  117. return self.nodelist.render(context)
File "C:\PYTHON27\lib\site-packages\django\template\base.py" in render
  744. bits.append(self.render_node(node, context))
File "C:\PYTHON27\lib\site-packages\django\template\debug.py" in render_node
  73. result = node.render(context)
File "C:\PYTHON27\lib\site-packages\django\template\loader_tags.py" in 
render
  64. result = block.nodelist.render(context)
File "C:\PYTHON27\lib\site-packages\django\template\base.py" in render
  744. bits.append(self.render_node(node, context))
File "C:\PYTHON27\lib\site-packages\django\template\debug.py" in render_node
  73. result = node.render(context)
File "C:\PYTHON27\lib\site-packages\django\template\defaulttags.py" in 
render
  450. raise e

Exception Type: TemplateSyntaxError at /
Exception Value: Caught NoReverseMatch while rendering: Reverse for 
'homepage_about' with arguments '()' and keyword arguments '{}' not found.

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



form.errors is not a dictionary?

2011-04-05 Thread Roy Smith
I'm using django-1.3 .  I have a view with the following code:

def item_create(request):
if request.method == 'POST':
form = ItemForm(request.POST)
if form.is_valid():
url = form.cleaned_data['url']
item.save()
return HttpResponseRedirect('/')
else:
print form.errors

when I submit the form, I expected that form.errors would print out as
a dict, as documented in 
http://docs.djangoproject.com/en/1.3/ref/forms/api/#using-forms-to-validate-data.
Instead, I'm getting a hunk of HTML:


Django version 1.3, using settings 'soco-site.settings'
Development server is running at http://0.0.0.0:7626/
Quit the server with CONTROL-C.
date_addedThis
field is required.user_idThis field is required.
[05/Apr/2011 16:36:32] "POST /item/create/ HTTP/1.1" 200 718

Is my understanding wrong, or is this a bug?

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



Re: wsgi configuration

2011-04-05 Thread yongzhen zhang
Hi, thanks for reply, i have tried this. Now in order to make it
clear, i move the iStore under home, like this: "/home/yongzhen/
iStore". django.wsgi is inside apache file and the apache file is
under iStore: "/home/yongzhen/iStore/django.wsgi". The content of
django.wsgi:
 import os, sys
wsgi_dir = os.path.abspath(os.path.dirname(__file__))
project_dir = os.path.dirname(wsgi_dir)
sys.path.append(project_dir)
project_settings = os.path.join(project_dir,'settings')
os.environ['DJANGO_SETTINGS_MODULE'] = 'iStore.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

and in /etc/apache2/sites-available, there is istore file, i have $
sudo a2ensite istore. the content of istore:
NameVirtualHost *:80


ServerAdmin webmaster@localhost
ServerName www.imaboy.cn
ServerAlias shop.imaboy.cn
Alias /static /home/yongzhen/iStore/static
Alias /php /var/www
DocumentRoot /home/yongzhen/iStore
WSGIScriptAlias / /home/yongzhen/iStore/apache/django.wsgi
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined


When i try to open www.imaboy.cn, here is the error in apache2
error.log:
[Tue Apr 05 22:43:03 2011] [error] Exception KeyError:
KeyError(-1218787584,) in  ignored
[Tue Apr 05 22:43:03 2011] [error] Exception KeyError:
KeyError(-1218787584,) in  ignored
[Tue Apr 05 22:43:03 2011] [error] Exception KeyError:
KeyError(-1218787584,) in  ignored
[Tue Apr 05 22:43:03 2011] [error] Exception KeyError:
KeyError(-1218787584,) in  ignored
[Tue Apr 05 22:43:03 2011] [error] Exception KeyError:
KeyError(-1218787584,) in  ignored
[Tue Apr 05 22:43:03 2011] [notice] caught SIGTERM, shutting down
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/
php5/apache2/conf.d/mcrypt.ini on line 1 in Unknown on line 0
[Tue Apr 05 22:43:04 2011] [notice] Apache/2.2.14 (Ubuntu) PHP/
5.3.2-1ubuntu4.7 with Suhosin-Patch mod_wsgi/2.8 Python/2.6.5
configured -- resuming normal operations
[Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] mod_wsgi
(pid=8570): Exception occurred processing WSGI script '/home/yongzhen/
iStore/apache/django.wsgi'.
[Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] Traceback
(most recent call last):
[Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/
local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line
230, in __call__
[Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]
self.load_middleware()
[Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/
local/lib/python2.6/dist-packages/django/core/handlers/base.py", line
33, in load_middleware
[Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] for
middleware_path in settings.MIDDLEWARE_CLASSES:
[Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/
local/lib/python2.6/dist-packages/django/utils/functional.py", line
276, in __getattr__
[Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]
self._setup()
[Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/
local/lib/python2.6/dist-packages/django/conf/__init__.py", line 40,
in _setup
[Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]
self._wrapped = Settings(settings_module)
[Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44]   File "/usr/
local/lib/python2.6/dist-packages/django/conf/__init__.py", line 75,
in __init__
[Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] raise
ImportError("Could not import settings '%s' (Is it on sys.path? Does
it have syntax errors?): %s" % (self.SETTINGS_MODULE, e))
[Tue Apr 05 22:43:11 2011] [error] [client 82.130.18.44] ImportError:
Could not import settings 'iStore.settings' (Is it on sys.path? Does
it have syntax errors?): No module named iStore.settings

Sorry to bother you, but i am very confused with this.

On 4月6日, 上午3时28分, anvydigital  wrote:
> try changing:
>
> os.environ['DJANGO_SETTINGS_MODULE']='www.iStore.settings'
>
> to:
>
> os.environ['DJANGO_SETTINGS_MODULE']='iStore.settings'
>
> Since 'www' folder is  on your path.
>
> GL

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



Re: wsgi configuration

2011-04-05 Thread anvydigital
try changing:

os.environ['DJANGO_SETTINGS_MODULE']='www.iStore.settings' 

to: 

os.environ['DJANGO_SETTINGS_MODULE']='iStore.settings' 

Since 'www' folder is  on your path.

GL

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



Re: wsgi configuration

2011-04-05 Thread yongzhen zhang
Hi, i changed the path to path='/home/yongzhen/workspace/www'

But it still has error:
21:31:30 2011] [error] [client 82.130.18.44] mod_wsgi (pid=7421):
Exception occurred processing WSGI script '/home/yongzhen/workspace/
www/apache/django.wsgi'.
[Tue Apr 05 21:31:30 2011] [error] [client 82.130.18.44] Traceback
(most recent call last):
[Tue Apr 05 21:31:30 2011] [error] [client 82.130.18.44]   File "/usr/
local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line
230, in __call__
[Tue Apr 05 21:31:30 2011] [error] [client 82.130.18.44]
self.load_middleware()
[Tue Apr 05 21:31:30 2011] [error] [client 82.130.18.44]   File "/usr/
local/lib/python2.6/dist-packages/django/core/handlers/base.py", line
33, in load_middleware
[Tue Apr 05 21:31:30 2011] [error] [client 82.130.18.44] for
middleware_path in settings.MIDDLEWARE_CLASSES:
[Tue Apr 05 21:31:30 2011] [error] [client 82.130.18.44]   File "/usr/
local/lib/python2.6/dist-packages/django/utils/functional.py", line
276, in __getattr__
[Tue Apr 05 21:31:30 2011] [error] [client 82.130.18.44]
self._setup()
[Tue Apr 05 21:31:30 2011] [error] [client 82.130.18.44]   File "/usr/
local/lib/python2.6/dist-packages/django/conf/__init__.py", line 40,
in _setup
[Tue Apr 05 21:31:30 2011] [error] [client 82.130.18.44]
self._wrapped = Settings(settings_module)
[Tue Apr 05 21:31:30 2011] [error] [client 82.130.18.44]   File "/usr/
local/lib/python2.6/dist-packages/django/conf/__init__.py", line 75,
in __init__
[Tue Apr 05 21:31:30 2011] [error] [client 82.130.18.44] raise
ImportError("Could not import settings '%s' (Is it on sys.path? Does
it have syntax errors?): %s" % (self.SETTINGS_MODULE, e))
[Tue Apr 05 21:31:30 2011] [error] [client 82.130.18.44] ImportError:
Could not import settings 'www.iStore.settings' (Is it on sys.path?
Does it have syntax errors?): No module named www.iStore.settings

Any suggestion?

On 3月31日, 下午9时48分, george  wrote:
> the path should be:
>
> path='/home/yongzhen/workspace/www'
>
> for iStore.settings to resolve
>
> On Mar 31, 1:40 pm, yongzhen zhang <4...@live.cn> wrote:
>
>
>
> > Hi,
> > I am using apache + wsgi for my Django project. But now i am a bit
> > confused. The project is under /home/yongzhen/workspace/www . I put
> > the apache folder under www, and it is same level with the project
> > "iStore". i write django.wsgi inside apache like this:
> > import os
> > import sys
> > path='/home/yongzhen/workspace/www/iStore'
> > if path not in sys.path:
> > sys.path.append(path)
>
> > wsgi_dir=os.path.abspath(os.path.dirname(__file__))
> > project_dir=os.path.dirname(wsgi_dir)
> > sys.path.append(project_dir)
> > project_settings=os.path.join(project_dir,'settings')
> > os.environ['DJANGO_SETTINGS_MODULE']='www.iStore.settings'
>
> > import django.core.handlers.wsgi
> > application=django.core.handlers.wsgi.WSGIHandler()
>
> > But it does not work, the apache has the following error:
> >  mod_wsgi (pid=11619): Exception occurred processing WSGI script '/
> > home/yongzhen/workspace/www/apache/django.wsgi'.
> >  Traceback (most recent call last):
> >   File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> > wsgi.py", line 230, in __call__
> >  self.load_middleware()
> >File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> > base.py", line 33, in load_middleware
> >  for middleware_path in settings.MIDDLEWARE_CLASSES:
> > File "/usr/local/lib/python2.6/dist-packages/django/utils/
> > functional.py", line 276, in __getattr__
> >  self._setup()
> >File "/usr/local/lib/python2.6/dist-packages/django/conf/
> > __init__.py", line 40, in _setup
> > self._wrapped = Settings(settings_module)
> >File "/usr/local/lib/python2.6/dist-packages/django/conf/
> > __init__.py", line 75, in __init__
> >  raise ImportError("Could not import settings '%s' (Is it on
> > sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
> > e))
> >  [error] [client 66.249.66.53] ImportError: Could not import settings
> > 'iStore.settings' (Is it on sys.path? Does it have syntax errors?): No
> > module named iStore.settings
>
> > It seems that something wrong with
> > "os.environ['DJANGO_SETTINGS_MODULE']='www.iStore.settings'", but it
> > also does not work when i change it to
> > os.environ['DJANGO_SETTINGS_MODULE']='iStore.settings'
> > Anyone knows what is the problem?- 隐藏被引用文字 -
>
> - 显示引用的文字 -

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



Re: QuerySet "disappearing"

2011-04-05 Thread Matthew Riedel
Nevermind- I *finally* figured it out.. It was this bit:
"for contact in contacts[startIndex:startIndex+100]:"

The contacts.count() in this case would steadily decrease as I changed
the status of the objects to no longer fit the queryset criteria. So
the startIndex value would get to the point where it would be more
than the total number of records (about halfway through)..

In other words, as my startIndex went up, the number of records went
down, and at half way, the startIndex was no longer a valid offset.

Since I realize this now, I'm just using the limit of 100, since it
the queryset automatically removes objects no longer matching the
query.. Seems more obvious now that I know what it's doing, but I
thought once I assigned a queryset to a variable, the data in the
query stayed, regardless of what changes I make to an object.. :\

Thanks,
Matt

On Apr 5, 1:02 pm, Matthew Riedel  wrote:
> Ok, I'm having a bit of a weird issue with a medium-sized QuerySet
> (~21k records). I have an app that syncs information from our LDAP
> Directory and creates shared contacts in Google Apps for our domain.
> Google puts a limit on 100 entries per batch, so I'm cycling through
> these 21k records 100 at a time.
>
> Here's the relevant code:
>
>     contacts = Contact.objects.filter(status__in=['up', 'cr', 'dl'])
>     contactsLog.info("Retrieved %s contacts." % contacts.count())
>     startIndex = 0
>     while startIndex <= contacts.count():
>         contactsLog.info("Sending records %s through %s of %s." %
> (startIndex, startIndex+100, contacts.count()))
>         contactsFeed = gdata.contacts.data.ContactsFeed()
>         for contact in contacts[startIndex:startIndex+100]:
>               <...do stuff...>
>
> It all starts fine- I log out how many contacts are found, etc. and
> it's getting the correct number (21k) and starts churning through them
> 100 at a time. However, when it gets to about 10,800 or so, the query
> seems to stop working. I know this because I write the contents of
> each batch out to a file. Around that mark, I start getting empty
> batches. I don't get any errors or anything; the job continues but
> just starts creating empty batches at that point.
>
> The job finishes "successfully", but obviously it didn't. If I turn
> around and run that job again, it happily picks up where it left off
> and then does another 5-6000 records or so, then does the same thing
> (the QuerySet appears to be empty, even though there should be records
> left).. And again, if I restart it, it happily keeps going.
>
> I've tried numerous ways to get this to work- I've tried using
> Django's Pagination module, I've tried using the list() function
> around the QuerySet call. Nothing seems to work.
>
> My hunch is it might be hitting some cache limit, or apache memory
> limit, but I'm unsure of how to figure that out. Especially since the
> job runs to completion, it just stops getting records back.
>
> I'm running Django 1.2.4, with Apache/2.2.17 (Unix) w/ mod_wsgi 3.3 on
> Solaris 10 X64.
>
> I'd be greatly appreciative if someone can point me in the right
> direction. Let me know if there's output from any configuration files
> you want to see that would be helpful.
>
> Thanks in advance,
> Matt

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



QuerySet "disappearing"

2011-04-05 Thread Matthew Riedel
Ok, I'm having a bit of a weird issue with a medium-sized QuerySet
(~21k records). I have an app that syncs information from our LDAP
Directory and creates shared contacts in Google Apps for our domain.
Google puts a limit on 100 entries per batch, so I'm cycling through
these 21k records 100 at a time.

Here's the relevant code:

contacts = Contact.objects.filter(status__in=['up', 'cr', 'dl'])
contactsLog.info("Retrieved %s contacts." % contacts.count())
startIndex = 0
while startIndex <= contacts.count():
contactsLog.info("Sending records %s through %s of %s." %
(startIndex, startIndex+100, contacts.count()))
contactsFeed = gdata.contacts.data.ContactsFeed()
for contact in contacts[startIndex:startIndex+100]:
  <...do stuff...>

It all starts fine- I log out how many contacts are found, etc. and
it's getting the correct number (21k) and starts churning through them
100 at a time. However, when it gets to about 10,800 or so, the query
seems to stop working. I know this because I write the contents of
each batch out to a file. Around that mark, I start getting empty
batches. I don't get any errors or anything; the job continues but
just starts creating empty batches at that point.

The job finishes "successfully", but obviously it didn't. If I turn
around and run that job again, it happily picks up where it left off
and then does another 5-6000 records or so, then does the same thing
(the QuerySet appears to be empty, even though there should be records
left).. And again, if I restart it, it happily keeps going.

I've tried numerous ways to get this to work- I've tried using
Django's Pagination module, I've tried using the list() function
around the QuerySet call. Nothing seems to work.

My hunch is it might be hitting some cache limit, or apache memory
limit, but I'm unsure of how to figure that out. Especially since the
job runs to completion, it just stops getting records back.

I'm running Django 1.2.4, with Apache/2.2.17 (Unix) w/ mod_wsgi 3.3 on
Solaris 10 X64.

I'd be greatly appreciative if someone can point me in the right
direction. Let me know if there's output from any configuration files
you want to see that would be helpful.

Thanks in advance,
Matt

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



Re: Django app for data management and visualization

2011-04-05 Thread Gianluca Riccardi


On 5 Apr, 17:06, alessio c  wrote:
> Ciao,

ciao Alessio,

>
> yes I do. I need more basic stuff then that and I need tables. Think of this
> as tentative to reduce Excel use (which is killing me).
>
> I can use matplotlib or openflash if I want to go really fancy. However, now
> I need to set up the framework. After that, I have a platform from which I
> can run all my scripts.
>
> Let's say I have a database with invoice data from different subsidiaries. I
> want to be able to: 1) create different views (subsidiary level, macro
> level, invoice level, first 10 invoice, first 10 customers, etc.); 2) upload
> data from different formats (because people are lazy and it is impossible to
> impose a single format); 3) allow some users to upload data (to avoid them
> to send me excel files by email, this is a huge feature...); 4) allow some
> other users (managers) to access and download online reports (tables and
> graphs).
>
> Theoretically, when I get this right I am hoping to start a project on git.
> The main idea is to create a shared reporting tool.

sounds like your going to have some fun ;) good luck, especially if
you can get rid of dealing with spreadsheets and automate it I'm sure
users will be happier(you at first;)

if You start a public git repo i'd like to read your progresses

regards,
Gianluca Riccardi

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



Re: [Suspected Spam] Django app for data management and visualization

2011-04-05 Thread alessio c
Sells,

this is interesting. But what about the integration with the framework? I
mean, I can import a plug in, but I still need to create a template and to
give a url, etc.

2011/4/5 Sells, Fred 

> There are guys in this group who are much more sophisticated meta
> programmers than I.  But here's a very simple method:
>
> It is easiest if each unique module has the same class name, such as
> "class Controller:"
>
> Then define and import all your plugins (does not allow uploading
> plugin, but that's risky anyway).  You can get all the files in your
> plugins dir and import them using the python function (forgot it's name,
> don't use it) or just eval ('import %s' % filename)  crude but works for
> older python
>
> Create a dictionary of key:module's
>
> Mymodule = ModuleDictionary[somekey]
> Workingobject = Mymodule.Controller(**parms)
>
> -Original Message-
> From: django-users@googlegroups.com
> [mailto:django-users@googlegroups.com] On Behalf Of alessio c
> Sent: Tuesday, April 05, 2011 9:40 AM
> To: Django users
> Subject: [Suspected Spam] Django app for data management and
> visualization
>
> Hello,
>
> I am thinking about starting a Django app to manage data (I need it
> for financial reporting).
>
> What I am wondering about those days is a way to create an application
> that:
>
> 1) Allows the privileged user to insert a "plug in" that adds a module
> and its views.
>
> 2) Allows the user to add views and "scripts" to an existing model.
>
> The way I think this is a model centric application with different
> views and file uploaders. For me this would be a break out as we use
> to run different reports from the same dataset (just changing the
> grouping, filtering, formulas). I need file uploaders as the same
> model can be populated from different files, organized in different
> ways.
>
> Do you have some aviced on best practices to achieve this? I don't
> want the user to touch the main web site when adding modules and
> views.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Django app for data management and visualization

2011-04-05 Thread alessio c
Hi Javier,

maybe we could have a talk, it sounds you need something similar to what I
need. Most of the reports needs a lot of ad hoc features, that is why it is
really difficult to find a proper level of abstraction. However, a robust
django framework could at least help to organize the work. Most of the
reports are run from data extracted from some IT syistem (SAP), this means
that the row data is usually following a model (which the people then mess
up in Excel). So, the approach model-view can be quite powerful.
Let me know. At the moment I only have spare scripts, but it would be nice
to share.
2011/4/5 Javier Guerra Giraldez 

> On Tue, Apr 5, 2011 at 10:06 AM, alessio c  wrote:
> > yes I do. I need more basic stuff then that and I need tables. Think of
> this
> > as tentative to reduce Excel use (which is killing me).
>
> I feel your pain
>
> what i'm currently doing is to use jqGrid as a frontend for tables.  i
> wrote a small framework adaptor that lets me write a small class with
> a Queryset, a few column description and optionally some extra data
> transformations.  the superclasses take care of generating the JS
> description and AJAX-handling views.
>
> the advantage of jqGrid is that it makes very easy to handle record
> selection, add/edit/delete/search operations, and sometimes in-cell
> editing.  in sum, the users don't miss so much their excel sheets.
>
> i plan to eventually share the python code; but it's still in heavy
> flux, every new project demands significant modifications.
>
> --
> Javier
>

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



Re: Django app for data management and visualization

2011-04-05 Thread Javier Guerra Giraldez
On Tue, Apr 5, 2011 at 10:06 AM, alessio c  wrote:
> yes I do. I need more basic stuff then that and I need tables. Think of this
> as tentative to reduce Excel use (which is killing me).

I feel your pain

what i'm currently doing is to use jqGrid as a frontend for tables.  i
wrote a small framework adaptor that lets me write a small class with
a Queryset, a few column description and optionally some extra data
transformations.  the superclasses take care of generating the JS
description and AJAX-handling views.

the advantage of jqGrid is that it makes very easy to handle record
selection, add/edit/delete/search operations, and sometimes in-cell
editing.  in sum, the users don't miss so much their excel sheets.

i plan to eventually share the python code; but it's still in heavy
flux, every new project demands significant modifications.

-- 
Javier

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



Re: Django app for data management and visualization

2011-04-05 Thread alessio c
Ciao,

yes I do. I need more basic stuff then that and I need tables. Think of this
as tentative to reduce Excel use (which is killing me).

I can use matplotlib or openflash if I want to go really fancy. However, now
I need to set up the framework. After that, I have a platform from which I
can run all my scripts.

Let's say I have a database with invoice data from different subsidiaries. I
want to be able to: 1) create different views (subsidiary level, macro
level, invoice level, first 10 invoice, first 10 customers, etc.); 2) upload
data from different formats (because people are lazy and it is impossible to
impose a single format); 3) allow some users to upload data (to avoid them
to send me excel files by email, this is a huge feature...); 4) allow some
other users (managers) to access and download online reports (tables and
graphs).

Theoretically, when I get this right I am hoping to start a project on git.
The main idea is to create a shared reporting tool.

2011/4/5 Gianluca Riccardi 

>
>
> On 5 Apr, 15:39, alessio c  wrote:
> > Hello,
> >
> > I am thinking about starting a Django app to manage data (I need it
> > for financial reporting).
> >
> > What I am wondering about those days is a way to create an application
> > that:
> >
> > 1) Allows the privileged user to insert a "plug in" that adds a module
> > and its views.
> >
> > 2) Allows the user to add views and "scripts" to an existing model.
> >
> > The way I think this is a model centric application with different
> > views and file uploaders. For me this would be a break out as we use
> > to run different reports from the same dataset (just changing the
> > grouping, filtering, formulas). I need file uploaders as the same
> > model can be populated from different files, organized in different
> > ways.
> >
> > Do you have some aviced on best practices to achieve this? I don't
> > want the user to touch the main web site when adding modules and
> > views.
>
> Hello,
>
> probably you already know of it http://graphite.wikidot.com/
>
> regards,
> Gianluca Riccardi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Apache2 with static file

2011-04-05 Thread Steve
I'm not sure what settings you have defined outside the 'VirtualHost'
section in your http.conf.

My guess is that you haven't set up the permissions to allow access to
the static media directory:


Order allow,deny
Allow from all


Also, I can't see your WSGIScriptAlias anywhere? Are you using
mod_wsgi with Apache?


On Apr 5, 8:33 am, yongzhen zhang <4...@live.cn> wrote:
> Hi,
> i have one problem with my apache2 work with static file.
> In apache2/sites-available file:
> 
>         ServerNamewww.imaboy.cn
>         ServerAlias shop.imaboy.cn
>        Alias /static /home/yongzhen/workspace/www/iStore/static
> 
> I want use apache to route to my static file. It works somehow, like
> if i type:imaboy.cn/static, i has the results .in my development
> server i opened 8000 port, like that:http://imaboy.cn:8000/ .The
> problem is that the static file is not shown, in the command window,
> it shows: "GET /static/images/ipad2_6.jpg HTTP/1.1" 200 5175. Anyone
> can help me? thanks a lot.

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



Re: [Suspected Spam] Django app for data management and visualization

2011-04-05 Thread Mike Ramirez
On Tuesday, April 05, 2011 07:39:57 am Sells, Fred wrote:
>  You can get all the files in your
> plugins dir and import them using the python function (forgot it's name,
> don't use it) or just eval ('import %s' % filename)  crude but works for
> older python
> 

imp[1] and implib, knee.py[2] is the example code. 


[1] http://docs.python.org/release/3.1.3/library/imp.html
[2] http://svn.python.org/projects/python/tags/r265/Demo/imputil/knee.py
-- 
Adler's Distinction:
Language is all that separates us from the lower animals,
and from the bureaucrats.

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



Re: Static/media url in template

2011-04-05 Thread Jon J
N/M, I solved it. I found this little gem:

from django.template import RequestContext

[code...]
return render_to_response('base.html',locals(),
context_instance = RequestContext(request))

which gives me access to the URL from the templates. This should
definitely be in the documentation in the basic templating tutorial
because up until I've found this, everyone has been acting like
MEDIA_URL is accessible with no additional steps.

On Tue, Apr 5, 2011 at 9:39 AM, Jon J  wrote:
> It doesn't appear that simple. When I try to insert {{MEDIA_URL}} into
> my template, I get no output whatsoever. I haven't been able to find
> anything on this.
>
> On Mon, Apr 4, 2011 at 7:49 PM, Sam Walters  wrote:
>> Yes it already exists {{MEDIA_URL}}
>>
>> Thats what the settings.py file does...
>>
>> There is a bunch of stuff you can read about in the docs:
>>
>> http://docs.djangoproject.com/en/1.3/howto/static-files/
>>
>> Also for some of my own deployments there are a bunch of static file
>> servers so i just put these into settings:
>> {{MEDIA_URL_VIDEO}}
>> {{MEDIA_URL_IMAGES}}
>> etc...
>>
>> Basically its as extensible as you want to make it.
>>
>> cheers
>>
>> sam_w
>>
>>
>> On Tue, Apr 5, 2011 at 8:44 AM, Jon J  wrote:
>>> Maybe I'm missing something...
>>>
>>> I would say I'm relatively familiar with the Django framework by this
>>> point. I'm mocking up a website, and I want to link static files into
>>> the base template. Instead of having the url's directly in the
>>> template, I'd like to call the STATIC_URL variable from within the
>>> template, so for example I could have
>>>
>>> 
>>>
>>> instead of
>>>
>>> http://www.domain.org/style.css; />
>>>
>>> Is this something that's possible or advisable? How is this problem
>>> normally handled so I don't have to retype pretty much everything if I
>>> move my site around? I haven't been able to find anything in the
>>> documentation regarding this.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

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



Re: Static/media url in template

2011-04-05 Thread Ryan Osborn
You need to have *django.core.context_processors.media* in your 
TEMPLATE_CONTEXT_PROCESSORS 
setting in order to use this template tag.

The same with STATIC_URL, you need to have *
django.core.context_processors.static* in order to use it.

Hope this helps,

Ryan

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



Re: Static/media url in template

2011-04-05 Thread Daniel Roseman
On Tuesday, April 5, 2011 3:39:17 PM UTC+1, JohnnyWalker wrote:
>
> It doesn't appear that simple. When I try to insert {{MEDIA_URL}} into
> my template, I get no output whatsoever. I haven't been able to find
> anything on this.


You don't seem to be looking very hard.

http://docs.djangoproject.com/en/1.3/ref/templates/api/#django-core-context-processors-media
(and the version for 'static' directly underneath)
--
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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



RE: LDAP and 1.2

2011-04-05 Thread Sells, Fred
Because our active directory contains many more users than are allowed
to use my django app, I have a cron job that runs every 5 minutes and
updates a mysql database with the subset I care about.  That way if AD
is offline at the time, I'm not hosed.

 

From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Szabo, Patrick
(LNG-VIE)
Sent: Tuesday, April 05, 2011 3:47 AM
To: django-users@googlegroups.com
Subject: LDAP and 1.2

 

Hi, 

 

has anyone sucessfully conncted their django 1.2 app with Active
Directory ?!

 

Which snippet did you use ?!

 

I'm concastantly getting  "Invalid credentials" Error -.-

 

 

Kind regards

. . . . . . . . . . . . . . . . . . . . . . . . . .

Patrick Szabo
XSLT Developer 

LexisNexis
Marxergasse 25, 1030 Wien

patrick.sz...@lexisnexis.at

Tel.: +43 (1) 534 52 - 1573 

Fax: +43 (1) 534 52 - 146 

 

 

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

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



RE: [Suspected Spam] Django app for data management and visualization

2011-04-05 Thread Sells, Fred
There are guys in this group who are much more sophisticated meta
programmers than I.  But here's a very simple method:

It is easiest if each unique module has the same class name, such as
"class Controller:"

Then define and import all your plugins (does not allow uploading
plugin, but that's risky anyway).  You can get all the files in your
plugins dir and import them using the python function (forgot it's name,
don't use it) or just eval ('import %s' % filename)  crude but works for
older python

Create a dictionary of key:module's

Mymodule = ModuleDictionary[somekey]
Workingobject = Mymodule.Controller(**parms)

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of alessio c
Sent: Tuesday, April 05, 2011 9:40 AM
To: Django users
Subject: [Suspected Spam] Django app for data management and
visualization

Hello,

I am thinking about starting a Django app to manage data (I need it
for financial reporting).

What I am wondering about those days is a way to create an application
that:

1) Allows the privileged user to insert a "plug in" that adds a module
and its views.

2) Allows the user to add views and "scripts" to an existing model.

The way I think this is a model centric application with different
views and file uploaders. For me this would be a break out as we use
to run different reports from the same dataset (just changing the
grouping, filtering, formulas). I need file uploaders as the same
model can be populated from different files, organized in different
ways.

Do you have some aviced on best practices to achieve this? I don't
want the user to touch the main web site when adding modules and
views.

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


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



Re: Static/media url in template

2011-04-05 Thread Jon J
It doesn't appear that simple. When I try to insert {{MEDIA_URL}} into
my template, I get no output whatsoever. I haven't been able to find
anything on this.

On Mon, Apr 4, 2011 at 7:49 PM, Sam Walters  wrote:
> Yes it already exists {{MEDIA_URL}}
>
> Thats what the settings.py file does...
>
> There is a bunch of stuff you can read about in the docs:
>
> http://docs.djangoproject.com/en/1.3/howto/static-files/
>
> Also for some of my own deployments there are a bunch of static file
> servers so i just put these into settings:
> {{MEDIA_URL_VIDEO}}
> {{MEDIA_URL_IMAGES}}
> etc...
>
> Basically its as extensible as you want to make it.
>
> cheers
>
> sam_w
>
>
> On Tue, Apr 5, 2011 at 8:44 AM, Jon J  wrote:
>> Maybe I'm missing something...
>>
>> I would say I'm relatively familiar with the Django framework by this
>> point. I'm mocking up a website, and I want to link static files into
>> the base template. Instead of having the url's directly in the
>> template, I'd like to call the STATIC_URL variable from within the
>> template, so for example I could have
>>
>> 
>>
>> instead of
>>
>> http://www.domain.org/style.css; />
>>
>> Is this something that's possible or advisable? How is this problem
>> normally handled so I don't have to retype pretty much everything if I
>> move my site around? I haven't been able to find anything in the
>> documentation regarding this.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Django app for data management and visualization

2011-04-05 Thread Gianluca Riccardi


On 5 Apr, 15:39, alessio c  wrote:
> Hello,
>
> I am thinking about starting a Django app to manage data (I need it
> for financial reporting).
>
> What I am wondering about those days is a way to create an application
> that:
>
> 1) Allows the privileged user to insert a "plug in" that adds a module
> and its views.
>
> 2) Allows the user to add views and "scripts" to an existing model.
>
> The way I think this is a model centric application with different
> views and file uploaders. For me this would be a break out as we use
> to run different reports from the same dataset (just changing the
> grouping, filtering, formulas). I need file uploaders as the same
> model can be populated from different files, organized in different
> ways.
>
> Do you have some aviced on best practices to achieve this? I don't
> want the user to touch the main web site when adding modules and
> views.

Hello,

probably you already know of it http://graphite.wikidot.com/

regards,
Gianluca Riccardi

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



how to change form field in admin?

2011-04-05 Thread galgal
Is there any way to change type of 1 specific field? I want to change 1 
field from CharField to TextField. I know I can make a modelform and pass it 
to admin class, but is there any other way?
For example - can I somehow use formfield_for_dbfield?

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



Django app for data management and visualization

2011-04-05 Thread alessio c
Hello,

I am thinking about starting a Django app to manage data (I need it
for financial reporting).

What I am wondering about those days is a way to create an application
that:

1) Allows the privileged user to insert a "plug in" that adds a module
and its views.

2) Allows the user to add views and "scripts" to an existing model.

The way I think this is a model centric application with different
views and file uploaders. For me this would be a break out as we use
to run different reports from the same dataset (just changing the
grouping, filtering, formulas). I need file uploaders as the same
model can be populated from different files, organized in different
ways.

Do you have some aviced on best practices to achieve this? I don't
want the user to touch the main web site when adding modules and
views.

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



Re: jQuery namespace woes - calling third-party scripts

2011-04-05 Thread Casey Greene


Also -- you are much more likely to quickly get help for a jQuery issue 
with a list/forum related to jQuery such as the jQuery forum: 
http://forum.jquery.com/


Some of us use jQuery but if we're reading a django list we're probably 
not actively thinking about it.


Casey

On 04/05/2011 01:26 AM, mcniac wrote:

Hi!

are you calling that script from the window's onload event? if not
jquery might not be ready yet. also you should load that inside a IE
conditional comment

Cheers
Esteban

On Apr 4, 6:21 pm, Andre Terra  wrote:

Hello.

I'm trying to run the supersleight jQuery plugin 
(http://allinthehead.com/retro/338/supersleight-jquery-plugin) for fixing PNG
transparency in IE6 (this is a corporate intranet project, so I must support
it).

However, I'm having trouble calling the script because it's telling me
jQuery is undefined. Could somebody please paste me an example of how I
should setup my project's main script (and references to both that and the
third-party files) so that either jQuery or $ will work anywhere they're
used?

TLDR; I just to call this 'supersleight' plugin on document ready:

django.jQuery('body').supersleight();

I know, it's incredibly simple, but I can't get it to work.

I thank you in advance for the help.

Sincerely,
André Terra (airstrike)




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



Re: select_related() changes type of DecimalField?

2011-04-05 Thread Carsten Fuchs

Dear Ian,

Am 04.04.2011 22:27, schrieb Ian:

Yes, this appears to be a bug.  If you would, please create a ticket
for it in the Django Trac so that we don't forget about it.


Gladly:
http://code.djangoproject.com/ticket/15766

Best regards,
Carsten



--
   Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
  Learn more at http://www.cafu.de



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Apache2 with static file

2011-04-05 Thread Andres Lucena
On Tue, Apr 5, 2011 at 9:33 AM, yongzhen zhang <4...@live.cn> wrote:
> Hi,
> i have one problem with my apache2 work with static file.
> In apache2/sites-available file:
> 
>        ServerName www.imaboy.cn
>        ServerAlias shop.imaboy.cn
>       Alias /static /home/yongzhen/workspace/www/iStore/static
> 
> I want use apache to route to my static file. It works somehow, like
> if i type:imaboy.cn/static, i has the results .in my development
> server i opened 8000 port, like that:http://imaboy.cn:8000/  .The
> problem is that the static file is not shown, in the command window,
> it shows: "GET /static/images/ipad2_6.jpg HTTP/1.1" 200 5175. Anyone
> can help me? thanks a lot.
>

It seems like you're trying to mix up the development server (./manage
runserver) with Apache serving statics. I don't know why would you
want that.

If you want to serve statics from the development server, then you should read:
http://docs.djangoproject.com/en/dev/howto/static-files/


See you,
Andres

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



Re: Extending django-admin.py startproject/manage.py startapp: a good layout for reusable apps

2011-04-05 Thread Mike Ramirez
On Tuesday, April 05, 2011 02:12:35 am Thomas Weholt wrote:
>and useful outside django so I`ll keep my eye on that as well.
> 
> I find that generating all the framework code and modify it a
> little to be 100% complete is quicker than doing it all in the
> shell/command line.

Just a minor disagreement but you can do the same in the shell/commandline 
(generation/editting). The gui is just 'prettier', that's the real differece, 
perception. 

Yeah it is much more general and glad to hear that. I'll post back when the 
first tests are done and passing.

Mike

-- 
There has been an alarming increase in the number of things you know
nothing about.

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



Re: login -->then on success--> my custom page

2011-04-05 Thread Alasdair Nicol
If you only need to change the success url, then use the 
LOGIN_REDIRECT_URL setting [1]. You won't need to customise the login page.


Alasdair

[1] http://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url

On 05/04/11 10:14, GOUTAM KUMAR RANA wrote:
please help me to make or inherit a login page which on success goes 
to my custom page


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



login -->then on success--> my custom page

2011-04-05 Thread GOUTAM KUMAR RANA
please help me to make or inherit a login page which on success goes to my 
custom page

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



Re: Odd problem with queryset

2011-04-05 Thread bruno desthuilliers
On 4 avr, 17:44, Adam Tonks  wrote:
> On Monday, April 4, 2011 4:34:10 PM UTC+1, bruno desthuilliers wrote:
>
> > If you really did test on the very same data set, same forum, *same
> > thread* (IOW ; same value for "self.pk") etc, you would'nt get an
> > IndexError, so there's obviously something different.
>
> I was literally just adding the [0] and refreshing the page, doing nothing
> else differently. With the [0], it errors. Without the [0], I get a list
> with two items.

This shouldn't happen, definitly. Getting at the first item of a non-
empty queryset is something that should JustWork(tm), and it's very
unlikely that such a major bug could make it's way into a stable
release - FWIW, I've been using Django since the 0.96 days and I'd be
very surprised to get such a problem even on the trunk.


>  The reason I posted this in here was for the very reason
> that I was getting an IndexError on a set that almost certainly shouldn't be
> empty.

Making 100% sure your queryset is not empty when this error occurs is
no big deal. If you manage to reproduce this behaviour with a proven
non-empty queryset, then you can submit a bug report.

> I also worked out that the set wasn't empty by accessing the first item from
> the template instead (i.e. adding '.0' to the end of the value in the
> template tag, instead of [0] to the end of the return function in the
> model).
>
> > ...
>
> > This returns all posts, whatever thread they belongs to.
>
> I know, I was trying to point out that the change in behaviour when I add
> the [0] is most likely due to the filter command.

If you mean that adding the call to queryset.filter can result in an
empty queryset, then yes, obviously you can't hope to subscript it.

>
> > It's not "causing it to return an empty queryset", it's raising an
> > index error because your queryset is already empty.
>
> If you know of a better way I can test it, I'd appreciate it, it will come
> in useful if something like this happens again.

I posted some code about this. Also and FWIW, "./manage.py shell" let
you run any arbitrary code against your models so you can try out and
explore interactively. And there's of course the debugger.

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



LDAP and 1.2

2011-04-05 Thread Szabo, Patrick (LNG-VIE)
Hi, 

 

has anyone sucessfully conncted their django 1.2 app with Active
Directory ?!

 

Which snippet did you use ?!

 

I'm concastantly getting  "Invalid credentials" Error -.-

 

 

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573 
Fax: +43 (1) 534 52 - 146 





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



Apache2 with static file

2011-04-05 Thread yongzhen zhang
Hi,
i have one problem with my apache2 work with static file.
In apache2/sites-available file:

ServerName www.imaboy.cn
ServerAlias shop.imaboy.cn
   Alias /static /home/yongzhen/workspace/www/iStore/static

I want use apache to route to my static file. It works somehow, like
if i type:imaboy.cn/static, i has the results .in my development
server i opened 8000 port, like that:http://imaboy.cn:8000/  .The
problem is that the static file is not shown, in the command window,
it shows: "GET /static/images/ipad2_6.jpg HTTP/1.1" 200 5175. Anyone
can help me? thanks a lot.

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



Extending django-admin.py startproject/manage.py startapp: a good layout for reusable apps

2011-04-05 Thread MrMuffin
I`m writing a simple extension of django-admin.py/manage.py so I can
have a predefined set of configurations and use those when I create a
new project or reusable app. For instance, I use sqlite3 in the
initial stage of development so that should be set automatically. My
name doesn`t change that often, same for me email. Those things should
go into the settings.py by default. And when I create reusable apps I
don`t want to bother with setting hardcoded links in settings.py to my
template-folder in settings.py either.

So what I`m thinking of is an extension of manage.py, let`s call it
"lime" for now, an executable script, working something like this:

1. All my default values; name, email, django settings that doesn`t
change much are stored in a config file in my home directory like
~/.lime/config.ini
2. When I call "lime app blog" the result is:

* a folder with a package called blog, a complete reusable django app
( I use the standard django code to generate the app itself )
* a setup.py with my name, email, package info, basics requirements -
all ready for pypi uploading and distribution
* a test-project to test my reusable app, configured to use that app
and find the templates and static content automatically without adding
hardcoded paths to the settings.py of the test-project and an admin
inteface enabled by default
* a virtualenv for my test-project
* code revision files for files to ignore etc
* 

The goal is to quickly create a standardized, complete and distribute-
friendly layout for a reusable app and to cut down on the manual,
repetetive typing. I`m also planning to support different configs so
calling something like "lime app blog --config postgresql" will use a
config specifying the app to use a config called postgresql instead of
the default.

So what are your thoughts? And what is a good layout for a reusable
app? What else could be automated in django development?

My main motivation for this project came when I started working on a
plugin for the Editra editor for django management. I wanted to create
django reusable apps from inside the editor and I saw that a lot of
the initial work on a new app is very repetetive - first create
project, then create app, then edit settings.py, then urls.py to
enable admin, then edit views.py to enable admin etc. I want to have a
configurable standard layout for my apps created in very few steps,
from within Editra and outside the editor as well.

Thanks for your attention and hope to hear some of your ideas or
thoughts.

Regards,
Thomas

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



Re: Advice: project hosting apps

2011-04-05 Thread Alex Kamedov
Eclipse mylyn can be integrated with Redmine too.
We are using Redmine with some plugins for time sheduling, SCRUM support
and generating charts about 2 years. It's very nice, but not all good
plugins is stable.

On Tue, Apr 5, 2011 at 9:03 AM, Sells, Fred wrote:

> Eclipse mylyn




-- 
Alex Kamedov
skype: kamedovwww: kamedov.ru

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