why not django's default server?

2008-10-24 Thread gniquil

I am deploying something for my immediate group in my company, which
has about 30 or so people. My app (report) would be viewed at most a
few thousand times day (which would already be more than most of the
current php apps out there in my group). I would like to know if it's
ok to break all the rules such as running the default server and also
use it for media (which primarily consists of some ~500k large flash
files -- I am using Flex front end).

By the way, I really like this micro-app architecture about django,
unlike pylons. I am primarily using it for generating business reports/
dashboards (converting large excel files to simple web apps). And this
way of loading small apps really works well.

The reason I don't want to use apache is primarily due to 1. restarts
2. lacking root access.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Ordering M2M field?

2008-10-24 Thread Russell Keith-Magee

On Fri, Oct 24, 2008 at 10:16 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> OK, I have a model with a many to many relationship.. pretty
> straightforward pre-1.0 code:
>
> class SpecialEvent(models.Model):
>sponsors = models.ManyToManyField(Advertiser, related_name="event
> sponsors", null=True, blank=True)
>
> Problem is, the Powers That Be want those sponsors in a certain order.
> I thought they just showed up in the order in which they were added in
> the admin (ordered by id on their table)
>
> That does not appear to be the case. They appear to order themselves
> based on their own id.
>
> So, how can I set the order in which they appear?

If you want reliable ordering, then you have to have something
reliable to order by. If you want reliable ordering of an m2m
relation, you will need to use a m2m-intermediate model for your m2m
relation and put an extra field on the intermediate model that can be
used as the basis for reliable ordering.

Yours,
Russ Magee %-)

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



Hi guys. I'm having problem with new-forms admin site.

2008-10-24 Thread astray

% settings.py %

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

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'mysite.books',
'django.contrib.admin',
)



% urls.py %

from django.conf.urls.defaults import *
from django.contrib import admin
from mysite.views import current_datetime, hours_ahead

admin.autodiscover()

urlpatterns = patterns('',
(r'^time/$', current_datetime),
(r'^time/plus/(\d{1,2})/$', hours_ahead),
(r'^admin/(.*)', admin.site.root),
)



% models.py %

from django.db import models

class Publisher(models.Model):
name = models.CharField(max_length=30)
address = models.CharField(max_length=50)
city = models.CharField(max_length=60)
state_province = models.CharField(max_length=30)
country = models.CharField(max_length=50)
website = models.URLField()
def __str__(self):
return self.name


class Author(models.Model):
salutation = models.CharField(max_length=10)
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=40)
email = models.EmailField()
headshot = models.ImageField(upload_to='/tmp')
def __str__(self):
return '%s %s' % (self.first_name, self.last_name)

class Book(models.Model):
title = models.CharField(max_length=100)
authors = models.ManyToManyField(Author)
publisher = models.ForeignKey(Publisher)
publication_date = models.DateField()
num_pages = models.IntegerField(blank=True, null=True)

def __str__(self):
return self.title



% admin.py (currently in my app folder (\books) %

from django.contrib import admin
from mysite.books.models import Book

admin.site.register(Book)


==> above are my settings. App name is books. I'm curious about where
to put admin.py file.
(Maybe in my app folder (\books)? That's what I'm doing right now.)



I was at first following my Django book's instruction to create
administration interface and soon realized that the method on the book
was not applicable to Django 1.0.

I'm not interested in several options I can override. Just wanting to
test default interface but It just doesn't work!

with these settings, I encounter this error

--
File "F:\Python26\Lib\site-packages\django\core\servers\basehttp.py",
line 278, in run
self.result = application(self.environ, self.start_response)

  File "F:\Python26\Lib\site-packages\django\core\servers
\basehttp.py", line 635, in __call__
return self.application(environ, start_response)

  File "F:\Python26\Lib\site-packages\django\core\handlers\wsgi.py",
line 243, in __call__
response = middleware_method(request, response)

  File "F:\Python26\Lib\site-packages\django\contrib\sessions
\middleware.py", line 35, in process_response
request.session.save()

  File "F:\Python26\Lib\site-packages\django\contrib\sessions\backends
\db.py", line 52, in save
session_key = self.session_key,

  File "F:\Python26\Lib\site-packages\django\contrib\sessions\backends
\base.py", line 152, in _get_session_key
self._session_key = self._get_new_session_key()

  File "F:\Python26\Lib\site-packages\django\contrib\sessions\backends
\base.py", line 144, in _get_new_session_key
if not self.exists(session_key):

  File "F:\Python26\Lib\site-packages\django\contrib\sessions\backends
\db.py", line 25, in exists
Session.objects.get(session_key=session_key)

  File "F:\Python26\Lib\site-packages\django\db\models\manager.py",
line 93, in get
return self.get_query_set().get(*args, **kwargs)

  File "F:\Python26\Lib\site-packages\django\db\models\query.py", line
304, in get
num = len(clone)

  File "F:\Python26\Lib\site-packages\django\db\models\query.py", line
160, in __len__
self._result_cache = list(self.iterator())

  File "F:\Python26\Lib\site-packages\django\db\models\query.py", line
275, in iterator
for row in self.query.results_iter():

  File "F:\Python26\Lib\site-packages\django\db\models\sql\query.py",
line 206, in results_iter
for rows in self.execute_sql(MULTI):

  File "F:\Python26\Lib\site-packages\django\db\models\sql\query.py",
line 1724, in execute_sql
cursor.execute(sql, params)

  File "F:\Python26\Lib\site-packages\django\db\backends\util.py",
line 19, in execute
return self.cursor.execute(sql, params)

ProgrammingError: error:  There's no relation named "django_session"
<--- message translated by my own because I'm not English user. Just
focus on the meanig of this message cause this might be not identical.

Hi guys, I'm having trouble with newform-admin interface

2008-10-24 Thread astray

% settings.py %

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

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'mysite.books',
'django.contrib.admin',
)



% urls.py %

from django.conf.urls.defaults import *
from django.contrib import admin
from mysite.views import current_datetime, hours_ahead

admin.autodiscover()

urlpatterns = patterns('',
(r'^time/$', current_datetime),
(r'^time/plus/(\d{1,2})/$', hours_ahead),
(r'^admin/(.*)', admin.site.root),
)



% models.py %

from django.db import models

class Publisher(models.Model):
name = models.CharField(max_length=30)
address = models.CharField(max_length=50)
city = models.CharField(max_length=60)
state_province = models.CharField(max_length=30)
country = models.CharField(max_length=50)
website = models.URLField()
def __str__(self):
return self.name


class Author(models.Model):
salutation = models.CharField(max_length=10)
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=40)
email = models.EmailField()
headshot = models.ImageField(upload_to='/tmp')
def __str__(self):
return '%s %s' % (self.first_name, self.last_name)

class Book(models.Model):
title = models.CharField(max_length=100)
authors = models.ManyToManyField(Author)
publisher = models.ForeignKey(Publisher)
publication_date = models.DateField()
num_pages = models.IntegerField(blank=True, null=True)

def __str__(self):
return self.title



% admin.py (currently in my app folder (\books) %

from django.contrib import admin
from mysite.books.models import Book

admin.site.register(Book)


==> above are my settings. App name is books. I'm curious about where
to put admin.py file.
(Maybe in my app folder (\books)? That's what I'm doing right now.)



I was at first following my Django book's instruction to create
administration interface and soon realized that the method on the book
was not applicable to Django 1.0.

I'm not interested in several options I can override. Just wanting to
test default interface but It just doesn't work!

with these settings, I encounter this error

--
File "F:\Python26\Lib\site-packages\django\core\servers\basehttp.py",
line 278, in run
self.result = application(self.environ, self.start_response)

  File "F:\Python26\Lib\site-packages\django\core\servers
\basehttp.py", line 635, in __call__
return self.application(environ, start_response)

  File "F:\Python26\Lib\site-packages\django\core\handlers\wsgi.py",
line 243, in __call__
response = middleware_method(request, response)

  File "F:\Python26\Lib\site-packages\django\contrib\sessions
\middleware.py", line 35, in process_response
request.session.save()

  File "F:\Python26\Lib\site-packages\django\contrib\sessions\backends
\db.py", line 52, in save
session_key = self.session_key,

  File "F:\Python26\Lib\site-packages\django\contrib\sessions\backends
\base.py", line 152, in _get_session_key
self._session_key = self._get_new_session_key()

  File "F:\Python26\Lib\site-packages\django\contrib\sessions\backends
\base.py", line 144, in _get_new_session_key
if not self.exists(session_key):

  File "F:\Python26\Lib\site-packages\django\contrib\sessions\backends
\db.py", line 25, in exists
Session.objects.get(session_key=session_key)

  File "F:\Python26\Lib\site-packages\django\db\models\manager.py",
line 93, in get
return self.get_query_set().get(*args, **kwargs)

  File "F:\Python26\Lib\site-packages\django\db\models\query.py", line
304, in get
num = len(clone)

  File "F:\Python26\Lib\site-packages\django\db\models\query.py", line
160, in __len__
self._result_cache = list(self.iterator())

  File "F:\Python26\Lib\site-packages\django\db\models\query.py", line
275, in iterator
for row in self.query.results_iter():

  File "F:\Python26\Lib\site-packages\django\db\models\sql\query.py",
line 206, in results_iter
for rows in self.execute_sql(MULTI):

  File "F:\Python26\Lib\site-packages\django\db\models\sql\query.py",
line 1724, in execute_sql
cursor.execute(sql, params)

  File "F:\Python26\Lib\site-packages\django\db\backends\util.py",
line 19, in execute
return self.cursor.execute(sql, params)

ProgrammingError: error:  There's no relation named "django_session"
<--- message translated by my own because I'm not English user. Just
focus on the meanig of this message cause this might be not identical.

Attribute Error when doing a syncdb.

2008-10-24 Thread Jared

Hello,

I'm doing a little blog app and I'm going to be using tagging in it.
So I wen to the google code page and downloaded it, named it tagging
(instead of tagging-0.2.1), and then ran the install. Once I did that
I made sure both my blog app and the tagging was included in the
installed apps. I then ran the syncdb command from my project folder
and get the following error:

AttributeError: 'module' object has no attribute 'tagging'


If you could point me in the right direction I would appreciate it.

Thanks,
Jared

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django on Apache (mod_python) administration cookie problem

2008-10-24 Thread Graham Dumpleton



On Oct 25, 11:59 am, "M.Ganesh" <[EMAIL PROTECTED]> wrote:
> Graham,
> Option 3: I use other utilities like wordpress and phpMyAdmin, so I cannot 
> afford to disable php completely
> Option 2: I use Linux Mint (Ubuntu variant) for developement and Debian Etch 
> for production. So for option 2, I will require two sets of instructions, 
> which means more trouble for you. So let me skip that.
> Option 1: If this work around works for me, I'll get going and think of 
> better permanent solutions later
> Kindly help me on option one (disabling PHP mhash)

That one I can't help you with as know nothing about PHP. I presume
there is a configuration file for PHP somewhere you need to edit and
comment out load line for PHP mhash module.

Graham

> Thanks in advance
> Regards Ganesh
> Graham Dumpleton wrote:Disabling the PHP mhash module is only a workaround 
> even if it does work. The proper fix if it is this issue is to refresh your 
> Python 2.4 installation to get fixed version from Debian repository, or even 
> perhaps upgrade to Python 2.5 and newer mod_python version which uses Python 
> 2.5. Alternatively, disable PHP from Apache completely if you do not need it. 
> Which of the three options don't you understand and are wanting more detail 
> for? GrahamThanks in advance Regards Ganesh Daniel bodom_lx Graziotin 
> wrote:Thank you very much for your replies, Alvaro and Graham! Removing 
> php5-mhash solved 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Cannot get user profile working.

2008-10-24 Thread kylewild

here's the model:

from django.db import models
from django.contrib.auth.models import User


# this will set us up to use user.get_gender_display, thanks to
django's get_FOO_display
GENDER_CHOICES = (
('M', 'Male'),
('F', 'Female'),
)


# defining the model for UserProfile, which extends Django's "User"
model and can be fetched using user.get_profile()
class UserProfile(models.Model):
phone_number = models.PhoneNumberField()
description = models.TextField()
gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
age = models.IntegerField()
user = models.ForeignKey(User, unique=True)






and here's the view with relevant imports:

from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required



@login_required
def chatrooms(request):
u = User.objects.get(pk=1) # Get the first user
user_address = u.get_profile().phone_number # fetch user's phone
number from the db
return render_to_response('chat/chatrooms.html',
{'user_address': user_address})




On Oct 24, 4:14 pm, Brian Neal <[EMAIL PROTECTED]> wrote:
> On Oct 24, 3:01 pm, kylewild <[EMAIL PROTECTED]> wrote:
>
> > thanks brian, good call
>
> > I had read that and somehow not parsed it!
>
> > However, I'm still having the issue after changing it to:
>
> > AUTH_PROFILE_MODULE = 'chat.userprofile'
>
> > (i tried myproject.userprofile as well)
>
> > 'NoneType' object has no attribute '_default_manager'
> > /home/mochat/webapps/django/lib/python2.5/django/contrib/auth/
> > models.py in get_profile, line 293
>
> We really need more info before anyone can even guess. Try posting
> some code, including your model code and the call site where you are
> calling .get_profile().
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



create objects from custom SQL

2008-10-24 Thread rory

Hello,

is there a way to execute a custom SQL query (as per below link) but
then generate actual Model objects instead of just raw rows?

http://docs.djangoproject.com/en/dev/topics/db/sql/#topics-db-sql

thanks,
rory

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django on Apache (mod_python) administration cookie problem

2008-10-24 Thread M.Ganesh





Graham,
Option 3: I use other utilities like wordpress and phpMyAdmin, so I
cannot afford to disable php completely
Option 2: I use Linux Mint (Ubuntu variant) for developement and Debian
Etch for production. So for option 2, I will require two sets of
instructions, which means more trouble for you. So let me skip that.
Option 1: If this work around works for me, I'll get going and think of
better permanent solutions later
Kindly help me on option one (disabling PHP mhash)

Thanks in advance

Regards Ganesh

Graham Dumpleton wrote:

  Disabling the PHP mhash module is only a workaround even if it does
work.

The proper fix if it is this issue is to refresh your Python 2.4
installation to get fixed version from Debian repository, or even
perhaps upgrade to Python 2.5 and newer mod_python version which uses
Python 2.5.

Alternatively, disable PHP from Apache completely if you do not need
it.

Which of the three options don't you understand and are wanting more
detail for?

Graham

  
  
Thanks in advance

Regards Ganesh

Daniel bodom_lx Graziotin wrote:


  Thank you very much for your replies, Alvaro and Graham!
Removing php5-mhash solved 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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users?hl=en  -~--~~~~--~~--~--~---





Re: wrong redirect from admins "View on site" link

2008-10-24 Thread je

using proto-coltrane code from _Practical Django Projects_, i get the
same error on trunk/apache/mod_python. i assume something around
contrib.sites is misconfigured, but it could also be bad urls.py
statements. any advice anyone?

On Oct 24, 2:15 pm, Adi Jörg Sieker <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I just noticed that the "View on site" link on the Admin change entry
> page redirects to localhost/. The dev server is running on
> localhost:8000 though.
> The model being used is the Entry model from coltrane_blog[1] which has
> a get_absolut_url method that looks like:
>      from django.db import models
>
>      def get_absolute_url(self):
>          return ('coltrane_entry_detail', (),
>                         { 'year': self.pub_date.strftime('%Y'),
>                            'month': self.pub_date.strftime('%b').lower(),
>                            'day': self.pub_date.strftime('%d'),
>                            'slug': self.slug })
>      get_absolute_url = models.permalink(get_absolute_url)
>
> Is this a config issue on my side?
>
> adi
>
> [1]http://code.google.com/p/coltrane-blog/

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Apps

2008-10-24 Thread Ian Maurer

You should probably start by looking at these 2 projects for CMS and
eCommerce:

http://django-cms.org/
http://www.satchmoproject.com/

Good luck and welcome to Django!

regards,
Ian

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



Re: order of apps in the admin panel

2008-10-24 Thread shacker

> On Oct 13, 11:00 am, Vokial <[EMAIL PROTECTED]> wrote:
>
> > Hello!
>
> > Is there a way to change the order of the applications shown in the
> > admin page? If i'm not wrong it used to be the order in which the
> > applications were written in the INSTALLED_APPS but now it seems to
> > follow the alphabetic order..

On Oct 13, 11:13 am, Eric <[EMAIL PROTECTED]> wrote:

>
> By default, it displays all the apps in INSTALLED_APPS that have been
> registered with the admin application, in alphabetical order. You may
> want to make significant changes to the layout. After all, the index
> is probably the most important page of the admin, and it should be
> easy to use.

So, to confirm... there is no way to customize the order of objects
shown in the admin *other than* to create a custom index page? I don't
see any mention of this capability in the docs.

Thanks,
Scot
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ANN: Initial release timelines for Django 1.0.1 and Django 1.1

2008-10-24 Thread James Bennett

(putting on release manager hat...)

We've just put up an entry over at the official Django project blog
with details of the timelines for Django 1.0.1
and Django 1.1:

http://www.djangoproject.com/weblog/2008/oct/24/upcoming-releases/

Please bear in mind the immediate consequences of these timelines:

* Django 1.0.1 will release November 14, which means that any 1.0
bugfixes you'd like to see make it in
  will need to have patches and tests prior to that date.

* If you have a feature proposal for Django 1.1 that you haven't
already brought up on the django-developers
  list, you'll want to do so quickly; the window for feature proposals
will close on November 15.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Cannot get user profile working.

2008-10-24 Thread Brian Neal

On Oct 24, 3:01 pm, kylewild <[EMAIL PROTECTED]> wrote:
> thanks brian, good call
>
> I had read that and somehow not parsed it!
>
> However, I'm still having the issue after changing it to:
>
> AUTH_PROFILE_MODULE = 'chat.userprofile'
>
> (i tried myproject.userprofile as well)
>
> 'NoneType' object has no attribute '_default_manager'
> /home/mochat/webapps/django/lib/python2.5/django/contrib/auth/
> models.py in get_profile, line 293
>

We really need more info before anyone can even guess. Try posting
some code, including your model code and the call site where you are
calling .get_profile().

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django Apps

2008-10-24 Thread Mike Hart

Hey all, I am the CEO of Artigrafx LLC and we are trying to create a
few Django apps. We would appreciate any help with any of these
projects, due to Django being new to us.

Current Projects:
A Django CMS
A Django eCommerce system

Links:
http://www.agfxsite.com/
http://www.agfxsite.com/board

Thanks in advance!
Michael

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: profiles not saving....just not seeing problem

2008-10-24 Thread Lar

nevermindserves me right for coding when tired.



On Oct 24, 2:23 pm, Lar <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've been beating my head against this for a couple of days.  I am
> creating a User with additional information stored in a profile
> model.  I create the user, then create the profile object. I get the
> form information and if it is valid, I just want to save the
> information and do a bit more processing.
>
> Two questions:
> 1. Why is the profile information not saving?
> 2. If I want to access the activation_string for a specific user and
> change it's value, how do I do that?  I'm sure the way I'm trying to
> do it is incorrect.
>
> Any assistance would be appreciated.
>
> Thanks,
> Laura
>
> **I have this Model:
>
> class StudentProfile(models.Model):
>     address = models.CharField(max_length=50)
>     city = models.CharField(max_length=60)
>     province = models.CharField(max_length=30)
>     postalcode = models.CharField(max_length=50)
>     telephone = models.CharField(max_length=12)
>     memberoffice = models.ForeignKey('memberoffices.MemberOffice')
>     creationdate = models.DateTimeField(auto_now_add=True)
>     activated = models.BooleanField(default=False)
>     activation_string = models.CharField(max_length=30, unique=True)
>     activationdate = models.DateTimeField(null=True)
>     user = models.ForeignKey(User,unique=True)
>
> **I have set it up in settings.py this way:
> AUTH_PROFILE_MODULE = 'students.StudentProfile'
>
> ** I have this form:
> class StudentForm(forms.Form):
>         username = forms.CharField(max_length=30)
>         first_name = forms.CharField(max_length=30)
>         last_name = forms.CharField(max_length=30)
>         email = forms.EmailField()
>         password1 =
> forms.CharField(max_length=30,widget=forms.PasswordInput(render_value=False))
>         password2 =
> forms.CharField(max_length=30,widget=forms.PasswordInput(render_value=False))
>         address = forms.CharField(max_length=50)
>         city = forms.CharField(max_length=60)
>         province = forms.CharField(max_length=30)
>         postalcode = forms.CharField(max_length=50)
>         telephone = forms.CharField(max_length=12)
>         memberoffice =
> forms.ModelMultipleChoiceField(queryset=MemberOffice.objects.all())
>
> **and this save routine associated with the form to save it:
>         def save(self):
>
>             newstudent =
> User.objects.create_user(username=self.cleaned_data['username'],
>
> email=self.cleaned_data['email'],
>
> password=self.cleaned_data['password1'])
>             newstudent.is_staff = False
>             newstudent.first_name = self.cleaned_data['first_name']
>             newstudent.last_name = self.cleaned_data['last_name']
>             newstudent.save()
>             try:
>                 newStudentProfile = request.newstudent.get_profile()
>             except:
>                 newStudentProfile = StudentProfile(user=newstudent)
>                 newStudentProfile.address =
> self.cleaned_data['address']
>                 newStudentProfile.city = self.cleaned_data['city']
>                 newStudentProfile.province =
> self.cleaned_data['province']
>                 newStudentProfile.postalcode =
> self.cleaned_data['postalcode']
>                 newStudentProfile.memberoffice =
> MemberOffice(id=self.cleaned_data['memberoffice'])
>                 newStudentProfile.save()
>             return newstudent
>
> **This is the controlling view.py file:
>
> def registerstudent(request,language):
>     if request.POST:
>        form = StudentForm(data=request.POST)
>        if form.is_valid():
>             newstudent = form.save()
>             newstudent.get_profile().activation_string =
> generate_activation_string()
>             email_content =
> create_activation_email_content(newprofile.activation_string)
>
> send_activation_email(newstudent.first_name,newstudent.email,email_content)
>             return HttpResponse('You\'ll receive an email. Click the
> link in the email.')
>        else:
>             errors = form.errors
>             return HttpResponse(errors)
>     else:
>         form = StudentForm()
>         return render_to_response('englishpublic/register.html',
> {'form':form,})
>
> **This is the error/traceback:
> Environment:
>
> Request Method: POST
> Request URL:http://127.0.0.1:8000/english/register/
> Django Version: 1.0-final-SVN-unknown
> Python Version: 2.5.1
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.admin',
>  'django.contrib.flatpages',
>  'django.contrib.admindocs',
>  'endeavor.students',
>  'endeavor.memberoffices',
>  'endeavor.membermanagers',
>  'endeavor.courses',
>  'endeavor.courseproviders']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  

Re: GeoDjango problem -- server hangs on GEOSGeometry calls

2008-10-24 Thread Info Cascade

I've got it set on Permissive... I checked that before...
Damn!  Just checked the audit log and it's denying when I access the
app.  Even in Permissive mode.  WTF?
Okay, then.  I'll disable it completely.
I am so sick of selinux!
...
Okay, disabled in /etc/selinux/config, rebooted and now... no messages
in audit log, but same behavior!
Now what?

Justin Bronn wrote:
>> Also, it's on CentOS 5.2
>> Just want to be complete.
>>
>> 
>
> Turn off SELinux.  I'm almost positive that's your problem.
>
> -Justin
> >
>
>   


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: GeoDjango problem -- server hangs on GEOSGeometry calls

2008-10-24 Thread Justin Bronn

> Also, it's on CentOS 5.2
> Just want to be complete.
>

Turn off SELinux.  I'm almost positive that's your problem.

-Justin
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



wrong redirect from admins "View on site" link

2008-10-24 Thread Adi Jörg Sieker

Hi,

I just noticed that the "View on site" link on the Admin change entry 
page redirects to localhost/. The dev server is running on 
localhost:8000 though.
The model being used is the Entry model from coltrane_blog[1] which has 
a get_absolut_url method that looks like:
 from django.db import models

 def get_absolute_url(self):
 return ('coltrane_entry_detail', (),
{ 'year': self.pub_date.strftime('%Y'),
   'month': self.pub_date.strftime('%b').lower(),
   'day': self.pub_date.strftime('%d'),
   'slug': self.slug })
 get_absolute_url = models.permalink(get_absolute_url)


Is this a config issue on my side?

adi

[1] http://code.google.com/p/coltrane-blog/

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Cannot get user profile working.

2008-10-24 Thread kylewild

thanks brian, good call

I had read that and somehow not parsed it!


However, I'm still having the issue after changing it to:

AUTH_PROFILE_MODULE = 'chat.userprofile'

(i tried myproject.userprofile as well)



'NoneType' object has no attribute '_default_manager'
/home/mochat/webapps/django/lib/python2.5/django/contrib/auth/
models.py in get_profile, line 293



On Oct 24, 12:54 pm, Brian Neal <[EMAIL PROTECTED]> wrote:
> On Oct 24, 2:23 pm, kylewild <[EMAIL PROTECTED]> wrote:
>
> > I'm having this same issue and the fix here, as best I can attempt to
> > apply it, didn't work for me
>
> > I had AUTH_PROFILE_MODULE set to "myproject.UserProfile"
>
> > After reading this thread, I changed it to "chat.UserProfile" -- to no
> > avail
>
> > In my "chat" directory, I have the model "UserProfile" defined in
> > models.py -- doesn't that mean "chat" is the name of the app?
>
> Read 
> this:http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-...
>
> I think you want all lower case.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



database API from external tools?

2008-10-24 Thread Andrew Chapman

Hi everyone,

Very much a Django newbie here, I'm trying to evaluate a few things 
before diving right in.

I was all set to write something in Ruby Rails, but the reason for 
looking at Django is because I also need python access to all the same 
data that the web app is dealing with. The Django database API seems 
great, but I can only easily run it on the web app server.

My question is how to package up and deploy the Django python code for 
external tools to access the database? I'm hoping to have the Django app 
sitting on the web server, with the source tree inaccessible to a bunch 
of workstations. The workstations need some command line tools for 
interacting with the database, and I don't want to have to bundle up the 
whole app and duplicate it out on the workstations, just so they can 
access the database API.

If I can access the whole app source code I can set the 
DJANGO_SETTINGS_MODULE env var and run python in a shell, and from there 
import my app's python module, and it all seems to work pretty well, but 
I'm looking for a more encapsulated/packaged way of deploying access to 
the database API without the whole app tree.

If anyone has any tips or online guides for this issue it would be much 
appreciated.

Cheers,
AC.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Cannot get user profile working.

2008-10-24 Thread Brian Neal

On Oct 24, 2:23 pm, kylewild <[EMAIL PROTECTED]> wrote:
> I'm having this same issue and the fix here, as best I can attempt to
> apply it, didn't work for me
>
> I had AUTH_PROFILE_MODULE set to "myproject.UserProfile"
>
> After reading this thread, I changed it to "chat.UserProfile" -- to no
> avail
>
> In my "chat" directory, I have the model "UserProfile" defined in
> models.py -- doesn't that mean "chat" is the name of the app?
>

Read this:
http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users

I think you want all lower case.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: GeoDjango problem -- server hangs on GEOSGeometry calls

2008-10-24 Thread Liam

Also, it's on CentOS 5.2
Just want to be complete.

On Oct 24, 9:22 am, Info Cascade <[EMAIL PROTECTED]> wrote:
> Hi, Justin,
>
> Thanks SO much for responding!
> We met at the WhereCamp meeting, you probably don't remember...
> Thanks for looking at this.
>
> Liam
>
> Here's the info...
>
> Server version: Apache/2.2.3
> Server built:   Jan 15 2008 20:33:41
> With mod_python
> Python 2.4.3
>
> 
> ServerName rocket.domain.com
> ServerAdmin [EMAIL PROTECTED]
> DocumentRoot /var/www/vhosts/rocket.domain.com/html
> ErrorLog logs/rocket.domain.com-error_log
> CustomLog logs/rocket.domain.com-access_log common
> 
> SetHandler python-program
> PythonPath "sys.path +
> ['/var/www/vhosts/rocket.domain.com/django']"
> PythonHandler django.core.handlers.modpython
> SetEnv PYTHON_EGG_CACHE /var/cache/www/pythoneggs
> PythonOption PYTHON_EGG_CACHE /var/cache/www/pythoneggs
> SetEnv DJANGO_SETTINGS_MODULE rocket.settings
> PythonOption DJANGO_SETTINGS_MODULE rocket.settings
> PythonDebug On
> PythonAutoReload On
> 
> 
> SetHandler default-handler
> 
> 
>
> # Django settings for rocket project.
> from aws.S3 import CallingFormat
>
> DEFAULT_FILE_STORAGE = 'aws.S3Storage.S3Storage'
>
> AWS_ACCESS_KEY_ID = 'X'
> AWS_SECRET_ACCESS_KEY = 'X'
>
> AWS_STORAGE_BUCKET_NAME = 'xxx'
> AWS_CALLING_FORMAT = CallingFormat.PATH
> #AWS_CALLING_FORMAT = 'CallingFormat.SUBDOMAIN'
>
> DEBUG = True
> TEMPLATE_DEBUG = DEBUG
>
> ADMINS = (
> # ('Your Name', '[EMAIL PROTECTED]'),
> )
>
> MANAGERS = ADMINS
>
> DATABASE_ENGINE = 'mysql'   # 'postgresql_psycopg2',
> 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
> DATABASE_NAME = 'rocket' # Or path to database file if using
> sqlite3.
> DATABASE_USER = 'user1' # Not used with sqlite3.
> DATABASE_PASSWORD = 'XX' # 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.
>
> # Local time zone for this installation. Choices can be found here:
> #http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
> # although not all choices may be available on all operating systems.
> # If running in a Windows environment this must be set to the same as your
> # system time zone.
> TIME_ZONE = 'America/Chicago'
>
> # Language code for this installation. All choices can be found here:
> #http://www.i18nguy.com/unicode/language-identifiers.html
> LANGUAGE_CODE = 'en-us'
>
> SITE_ID = 1
>
> # If you set this to False, Django will make some optimizations so as not
> # to load the internationalization machinery.
> USE_I18N = True
>
> # Absolute path to the directory that holds media.
> # Example: "/home/media/media.lawrence.com/"
> MEDIA_ROOT = ''
>
> # URL that handles the media served from MEDIA_ROOT. Make sure to use a
> # trailing slash if there is a path component (optional in other cases).
> # Examples: "http://media.lawrence.com;, "http://example.com/media/;
> MEDIA_URL = ''
>
> # URL prefix for admin media -- CSS, JavaScript and images. Make sure to
> use a
> # trailing slash.
> # Examples: "http://foo.com/media/;, "/media/".
> ADMIN_MEDIA_PREFIX = '/media/'
>
> # Make this unique, and don't share it with anybody.
> SECRET_KEY = 'xx'
>
> # List of callables that know how to import templates from various sources.
> TEMPLATE_LOADERS = (
> 'django.template.loaders.filesystem.load_template_source',
> 'django.template.loaders.app_directories.load_template_source',
> # 'django.template.loaders.eggs.load_template_source',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> )
>
> ROOT_URLCONF = 'rocket.urls'
>
> TEMPLATE_DIRS = (
> # Put strings here, like "/home/html/django_templates" or
> "C:/www/django/templates".
> # Always use forward slashes, even on Windows.
> # Don't forget to use absolute paths, not relative paths.
> )
>
> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.gis',
> 'django.contrib.sites',
> 'rocket.obs'
> )
> ~
>
> Justin Bronn wrote:
>
> >> However, if I access the application over http, the server hangs at
> >> exactly that spot.  No error logged.
> >> If I comment out the line, everything runs fine.
>
> > You're going to have to provide more details on exactly what "http"
> > means here.  How are you deploying, e.g., mod_wsgi, mod_python,
> > fastcgi?  What's the configuration look like?  What's the web server,
> > it's version?
>
> > -Justin
--~--~-~--~~~---~--~~
You 

Re: What do you use for design interface / mockup

2008-10-24 Thread Dana

Personally, I find paper to be an amazingly useful (and sometimes
under-rated media). It seems unsophisticated to some, but it gives you
many options to change things around, rework ideas, emphasis certain
elements or workflow. If you need to share you can scan or take a
photo of it. Once you've got a good idea of the pages and their
designs, you can Photoshop/Gimp it and then make the HTML/CSS mockups
to test actual usability.

I think the choice comes down to a few factors, including the size of
your team, budget, and project needs. If you are working on large,
highly complicated projects, maybe omnigraffle will work for you and
your team (although you should still do paper prototyping where
possible). If you are small (say less than 5 or 10 people) I would try
and do as much on paper/chalkboard/whiteboard as possible before using
any "techy" tools.

Even if youre not a graphic designer, Photoshop/Gimp can come in handy
to make simple layouts and mockups of pages, even if they are ugly :).

Ultimately it is what works best for you and your team.

Cheers

On Oct 23, 6:46 pm, Francis <[EMAIL PROTECTED]> wrote:
> I prefer not to use software like photoshop or gimp, mainly because
> I'm no graphic designer.
>
> What I want to do is to design layout, forms and presentation. To find
> the most 'user friendly' interface and to have a clear picture of my
> application before writing any code. Then the graphic artist will make
> it aesthetically nice.
>
> I found fireworks from adobe, but it looks like more gear towards
> designer. It's 300$ no demo.
> Pencil for firefox is buggy on mac and it has a very limited set of
> widgets. (but it shows much potential)
> Omnigraffle looks nice (tried the demo), but it's 200$ and Mac only.
>
> In the end, if Omnigraffle worth the price, I'll go for it.
>
> Thank you for your suggestion,
>
> Francis
>
> On Oct 23, 7:24 pm, "Peter Herndon" <[EMAIL PROTECTED]> wrote:
>
> > At the risk of being flamed, I'd say that nothing is better than 
> > OmniGraffle.
>
> > That aside, both Gimp and Dia are cross-platform and very reasonable
> > choices.  They may not fit the Mac gui, but they work well enough if
> > cross-platform is a higher priority than best-of-breed.  You can get
> > the job done with them.
>
> > If cross-platform is not your highest priority, I'd pick OmniGraffle
> > and Acorn, with Photoshop and such as the big guns, as required.
> > Though, there's a lot to be said for wireframing in HTML, and for
> > paper prototypes.
>
> > ---Peter
>
> > On 10/23/08, Gerard Petersen <[EMAIL PROTECTED]> wrote:
>
> > > Francis,
>
> > > I'm not a designer but I start my global layout on paper or in my head and
> > > then it's (x)html and CSS. The first thing that comes to mind on doing 
> > > this
> > > electronically is photoshop (and siblings ... CS3?). And the Gimp but that
> > > would not be a good choice on OSX (gui handling wise).
>
> > > Regards,
>
> > > Gerard.
>
> > > Francis wrote:
> > >> Hi,
>
> > >> What do you use for design interface / mockup?
>
> > >> I made some search, omnigraph seems pretty popular. But I often switch
> > >> between linux and Mac and omnigraffle isn't cross platform.
>
> > >> Is there any tools out there that work on Mac OS X and Linux? (or
> > >> something better than omnigraffle)
>
> > >> Thank you
>
> > > --
> > > urls = { 'fun':  'www.zonderbroodje.nl',  'tech':  'www.gp-net.nl'}
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Cannot get user profile working.

2008-10-24 Thread kylewild

I'm having this same issue and the fix here, as best I can attempt to
apply it, didn't work for me

I had AUTH_PROFILE_MODULE set to "myproject.UserProfile"

After reading this thread, I changed it to "chat.UserProfile" -- to no
avail


In my "chat" directory, I have the model "UserProfile" defined in
models.py -- doesn't that mean "chat" is the name of the app?



On Sep 2, 7:13 am, Alex <[EMAIL PROTECTED]> wrote:
> Thanks, worked perfectly.
>
> Not sure if it's just me and my lack of sleep or the docs aren't that
> clear on this item.  I didn't see much regarding this on the Internet
> so there must not be scores of others making the same mistake.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: profiles not saving....just not seeing problem

2008-10-24 Thread Matias
Hello,

ModelMultipleChoiceField fields cleaned data are lists, so you are trying to
create an object with a list of ids as id. Also I think you want to retrive
the object, in that case you have to use the get function of the model
manager (e.g.  Object.objects.get(id=someid). )
If you need to get all the options of a multiple choice field, you must use
a ManyToMany relationship instead of a ForeingKey.

Regards,
Matias.


On Fri, Oct 24, 2008 at 4:23 PM, Lar <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I've been beating my head against this for a couple of days.  I am
> creating a User with additional information stored in a profile
> model.  I create the user, then create the profile object. I get the
> form information and if it is valid, I just want to save the
> information and do a bit more processing.
>
> Two questions:
> 1. Why is the profile information not saving?
> 2. If I want to access the activation_string for a specific user and
> change it's value, how do I do that?  I'm sure the way I'm trying to
> do it is incorrect.
>
> Any assistance would be appreciated.
>
> Thanks,
> Laura
>
> **I have this Model:
>
> class StudentProfile(models.Model):
>address = models.CharField(max_length=50)
>city = models.CharField(max_length=60)
>province = models.CharField(max_length=30)
>postalcode = models.CharField(max_length=50)
>telephone = models.CharField(max_length=12)
>memberoffice = models.ForeignKey('memberoffices.MemberOffice')
>creationdate = models.DateTimeField(auto_now_add=True)
>activated = models.BooleanField(default=False)
>activation_string = models.CharField(max_length=30, unique=True)
>activationdate = models.DateTimeField(null=True)
>user = models.ForeignKey(User,unique=True)
>
> **I have set it up in settings.py this way:
> AUTH_PROFILE_MODULE = 'students.StudentProfile'
>
>
> ** I have this form:
> class StudentForm(forms.Form):
>username = forms.CharField(max_length=30)
>first_name = forms.CharField(max_length=30)
>last_name = forms.CharField(max_length=30)
>email = forms.EmailField()
>password1 =
>
> forms.CharField(max_length=30,widget=forms.PasswordInput(render_value=False))
>password2 =
>
> forms.CharField(max_length=30,widget=forms.PasswordInput(render_value=False))
>address = forms.CharField(max_length=50)
>city = forms.CharField(max_length=60)
>province = forms.CharField(max_length=30)
>postalcode = forms.CharField(max_length=50)
>telephone = forms.CharField(max_length=12)
>memberoffice =
> forms.ModelMultipleChoiceField(queryset=MemberOffice.objects.all())
>
> **and this save routine associated with the form to save it:
>def save(self):
>
>newstudent =
> User.objects.create_user(username=self.cleaned_data['username'],
>
> email=self.cleaned_data['email'],
>
> password=self.cleaned_data['password1'])
>newstudent.is_staff = False
>newstudent.first_name = self.cleaned_data['first_name']
>newstudent.last_name = self.cleaned_data['last_name']
>newstudent.save()
>try:
>newStudentProfile = request.newstudent.get_profile()
>except:
>newStudentProfile = StudentProfile(user=newstudent)
>newStudentProfile.address =
> self.cleaned_data['address']
>newStudentProfile.city = self.cleaned_data['city']
>newStudentProfile.province =
> self.cleaned_data['province']
>newStudentProfile.postalcode =
> self.cleaned_data['postalcode']
>newStudentProfile.memberoffice =
> MemberOffice(id=self.cleaned_data['memberoffice'])
>newStudentProfile.save()
>return newstudent
>
> **This is the controlling view.py file:
>
> def registerstudent(request,language):
>if request.POST:
>   form = StudentForm(data=request.POST)
>   if form.is_valid():
>newstudent = form.save()
>newstudent.get_profile().activation_string =
> generate_activation_string()
>email_content =
> create_activation_email_content(newprofile.activation_string)
>
> send_activation_email(newstudent.first_name,newstudent.email,email_content)
>return HttpResponse('You\'ll receive an email. Click the
> link in the email.')
>   else:
>errors = form.errors
>return HttpResponse(errors)
>else:
>form = StudentForm()
>return render_to_response('englishpublic/register.html',
> {'form':form,})
>
>
> **This is the error/traceback:
> Environment:
>
> Request Method: POST
> Request URL: http://127.0.0.1:8000/english/register/
> Django Version: 1.0-final-SVN-unknown
> Python Version: 2.5.1
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  

Re: Default values/prepopulate fields in ModelAdmin add view

2008-10-24 Thread Delta20

In case anyone else is trying to figure out how to do this, the
solution I came up with was to put a dictionary of the values into the
request and pass it to the ModelAdmin add_view function

def some_view(request, ... ):
...
values = { 'title': t, 'author': a }
# make QueryDict mutable
request.GET = request.GET.copy()
request.GET.update(values)
modelAdmin = admin.site._registry[Article]
return modelAdmin.add_view(request)

It's not ideal because it accesses what really should be a private
variable in admin.site, but it works. If anyone knows of a more
elegant to do this, please let me know.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



profiles not saving....just not seeing problem

2008-10-24 Thread Lar

Hi,

I've been beating my head against this for a couple of days.  I am
creating a User with additional information stored in a profile
model.  I create the user, then create the profile object. I get the
form information and if it is valid, I just want to save the
information and do a bit more processing.

Two questions:
1. Why is the profile information not saving?
2. If I want to access the activation_string for a specific user and
change it's value, how do I do that?  I'm sure the way I'm trying to
do it is incorrect.

Any assistance would be appreciated.

Thanks,
Laura

**I have this Model:

class StudentProfile(models.Model):
address = models.CharField(max_length=50)
city = models.CharField(max_length=60)
province = models.CharField(max_length=30)
postalcode = models.CharField(max_length=50)
telephone = models.CharField(max_length=12)
memberoffice = models.ForeignKey('memberoffices.MemberOffice')
creationdate = models.DateTimeField(auto_now_add=True)
activated = models.BooleanField(default=False)
activation_string = models.CharField(max_length=30, unique=True)
activationdate = models.DateTimeField(null=True)
user = models.ForeignKey(User,unique=True)

**I have set it up in settings.py this way:
AUTH_PROFILE_MODULE = 'students.StudentProfile'


** I have this form:
class StudentForm(forms.Form):
username = forms.CharField(max_length=30)
first_name = forms.CharField(max_length=30)
last_name = forms.CharField(max_length=30)
email = forms.EmailField()
password1 =
forms.CharField(max_length=30,widget=forms.PasswordInput(render_value=False))
password2 =
forms.CharField(max_length=30,widget=forms.PasswordInput(render_value=False))
address = forms.CharField(max_length=50)
city = forms.CharField(max_length=60)
province = forms.CharField(max_length=30)
postalcode = forms.CharField(max_length=50)
telephone = forms.CharField(max_length=12)
memberoffice =
forms.ModelMultipleChoiceField(queryset=MemberOffice.objects.all())

**and this save routine associated with the form to save it:
def save(self):

newstudent =
User.objects.create_user(username=self.cleaned_data['username'],
 
email=self.cleaned_data['email'],
 
password=self.cleaned_data['password1'])
newstudent.is_staff = False
newstudent.first_name = self.cleaned_data['first_name']
newstudent.last_name = self.cleaned_data['last_name']
newstudent.save()
try:
newStudentProfile = request.newstudent.get_profile()
except:
newStudentProfile = StudentProfile(user=newstudent)
newStudentProfile.address =
self.cleaned_data['address']
newStudentProfile.city = self.cleaned_data['city']
newStudentProfile.province =
self.cleaned_data['province']
newStudentProfile.postalcode =
self.cleaned_data['postalcode']
newStudentProfile.memberoffice =
MemberOffice(id=self.cleaned_data['memberoffice'])
newStudentProfile.save()
return newstudent

**This is the controlling view.py file:

def registerstudent(request,language):
if request.POST:
   form = StudentForm(data=request.POST)
   if form.is_valid():
newstudent = form.save()
newstudent.get_profile().activation_string =
generate_activation_string()
email_content =
create_activation_email_content(newprofile.activation_string)
 
send_activation_email(newstudent.first_name,newstudent.email,email_content)
return HttpResponse('You\'ll receive an email. Click the
link in the email.')
   else:
errors = form.errors
return HttpResponse(errors)
else:
form = StudentForm()
return render_to_response('englishpublic/register.html',
{'form':form,})


**This is the error/traceback:
Environment:

Request Method: POST
Request URL: http://127.0.0.1:8000/english/register/
Django Version: 1.0-final-SVN-unknown
Python Version: 2.5.1
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django.contrib.flatpages',
 'django.contrib.admindocs',
 'endeavor.students',
 'endeavor.memberoffices',
 'endeavor.membermanagers',
 'endeavor.courses',
 'endeavor.courseproviders']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "/Library/Python/2.5/site-packages/django/core/handlers/base.py"
in get_response
  86. response = callback(request, *callback_args,
**callback_kwargs)
File "/Users/laurarey/LAR Studios/endeavor/../endeavor/students/
views.py" in registerstudent
  29.

Anyone have any good solutions for site navigation?

2008-10-24 Thread Matt Wilson

My site has a global-navigation header, with links to 5 sections of
the site.

I highlight the section that the viewer is currently viewing in the
global header.  Other than the highlighting, the header is the same on
every page of the site.

Then I also have a "local" navigation that shows different links based
on what global section is being viewed.

Finally, each page has its own set of buttons and forms that govern
how that particular page works.

For example, my global nav for a newspaper site might be WEATHER,
SPORTS, NATIONAL, and LOCAL.

Then if the person is looking at WEATHER, the local nav might be
HISTORICAL and FORECAST.

On the FORECAST view, I might allow choices of 3-day forecast and 10-
day forecast.

Right now, to make all this happen, I'm using lots of homemade widgets
and config files.  The system all works fine, but it ain't awesome,
and it certainly is not easy to explain to another developer when I
want them to make a change

I suspect that a lot of sites have funky navigation systems.  Is there
any standard solution?

At the heart, I would like to define a tree data structure in a config
file or a database table and then let the code parse it all, doing all
the right highlighting.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Reset trac account password

2008-10-24 Thread Matias
Hello everyone,

Is there a way to reset the password of the trac account?
I didnt find even an email address to do this request.

Thanks in advance,

Matias.

-- 
:wq

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Multi-Table Inheritance

2008-10-24 Thread [EMAIL PROTECTED]

Does anyone have any suggestions on how to use mutli-table inheritance
with model forms or some other way of creating it.  For example if I
have a model setup like this:

class MetaData(models.Model):
  date = models.DateField()
  subject = models.CharField()

class Body(MetaData):
  body = models.TextField()

Basically I want create or edit all the fields for both models at the
same time.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Creating a system with multiple types of users

2008-10-24 Thread itsnotvalid

Is there any posts related to the permission system? I didn't looked
into that part yet, but seems interesting. Of course groups also seems
to solve the problem as well.

However I also saw @user_passes_test in the doc. What is the
difference or use cases from @user_passes_test and
@permission_required?
On Oct 23, 7:54 am, felix <[EMAIL PROTECTED]> wrote:
> perhaps when you create-save the models (Providers, Customers etc.) it adds
> that User to the appropriate group.
>
> but I'm not sure I would use groups.  That would make the most sense if
> there were people with overlapping roles.  somebody who is Agent + Provider
>
> you could use the permissions system.  again, also saving it to the User at
> the time you create the Agent, Provider etc.
>
> I have a form that creates a Person and optionally creates a User account at
> the same time linked to it.  you can also create a User (an account) later
> for some person who is in the contact database.  so I do that action in the
> Form.  its the form's responsibility (it represents/encapsulates the action
> that the admin is taking)
>
> I guess what you are asking is : how can you check on the template or in the
> views what type of person the user is and show them certain things.
>
> you can make use of the template tags that check for perms.
>
> and some views are only accessible for certain types of peoples.  for that,
> using perms is good.
>
> @permission_required("app.provider.can_view")
> def view_func(request):
>
> also this way you can give the staff or Agents perms that the plebs also
> have.
>
> you could also set a cookie/session var on login for is_a
> that would be less db hits
>
> -f;lix
>
> On Tue, Oct 21, 2008 at 10:39 PM, itsnotvalid <[EMAIL PROTECTED]> wrote:
>
> > I am going to help some people making a website that has a few admins,
> > a crowd of service providers (individuals) and customers. There could
> > be agents who invites people to become service providers or customers
> > as well.
>
> > Looking at the user system provided by django, and as a new programmer
> > to django, I am not sure how can I separate different kinds of user
> > here. I actually want to make it look like that different people login
> > in different location, and do not share the same view after they
> > logged in.
>
> > So I am thinking a model schema like this:
>
> > Users (as usual)
>
> > Providers(link to a specific user, one-to-one)
>
> > Customers(link to a specific user, many-to-one, as one user may find
> > services for more that one actual person)
>
> > Agents(link to a specific user, one-to-one)
>
> > But how effectively can I separate their views? By defining different
> > apps? Any other suggestions?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Comments in reversed order

2008-10-24 Thread jrivero

yes! but the previous solution was useful to paginate the result with
a another templatetag

{% get_comment_list for entry as comment_list reversed %}
{% paginate comment_list 10 as page using comment_list_page %}
{% for comment in comment_list_page %}
  comment.comment
{% endfor %}

what method use you? generic object-list with a paginated?

Thanks!

Jordi.


On 22 oct, 14:26, Dmitry Dzhus <[EMAIL PROTECTED]> wrote:
> jrivero wrote:
> > Is possible obtain the comments of django.contrib in reversed order?
>
> > In old version:
> > {% get_free_comment_list for workgroups.workgroup group.id as
> > comment_list reversed %}
>
> > But in new version the templatetag not have control of this parameter.
> > The method for order is other?
>
> I suppose that you obtain comments to loop over the list, displaying
> comments one-by-one on your page. You may use `reversed` keyword in `{%
> for %}` tag then, for example:
>
> {% get_comment_list for entry as entry_comments %}
> {% for comment in entry_comments reversed %}
> comment.comment
> {% endfor %}
> --
> Happy Hacking.
>
> http://sphinx.net.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Model design solution

2008-10-24 Thread aiko

I am creating shop, but need advise on model/db design on product
part:

class Product(models.Model):
name = models.CharField(max_length=250)
typeid = models.IntegerField()
pdata = models.IntegerField()
price = ...
visible = ...

typeid and pdata is for extending product information by product type
(book, music-cd, ..)
typeid is for selecting table (ID1 - productbook, ...)
pdata is pointer to ID in selected table by typeid.


class ProductBook(models.Model):
product = models.ForeignKey(Product)
pageno = models.IntegerField()
author = ...


Question1:

How to edit ProductBook all infomartion in 1 admin page (including
Product entries)?

Question1:

How to create ProductBook and Product in 1 page?
(To avoid 2 steps: 1. create Product, 2. create ProductBook by
assigning to right Product)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: aggregation filter?

2008-10-24 Thread kbs

I can confirm it worked.

Thanks guys!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: GeoDjango problem -- server hangs on GEOSGeometry calls

2008-10-24 Thread Info Cascade
Hi, Justin,

Thanks SO much for responding!
We met at the WhereCamp meeting, you probably don't remember...
Thanks for looking at this.

Liam

Here's the info...

Server version: Apache/2.2.3
Server built:   Jan 15 2008 20:33:41
With mod_python
Python 2.4.3


ServerName rocket.domain.com
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /var/www/vhosts/rocket.domain.com/html
ErrorLog logs/rocket.domain.com-error_log
CustomLog logs/rocket.domain.com-access_log common

SetHandler python-program
PythonPath "sys.path +
['/var/www/vhosts/rocket.domain.com/django']"
PythonHandler django.core.handlers.modpython
SetEnv PYTHON_EGG_CACHE /var/cache/www/pythoneggs
PythonOption PYTHON_EGG_CACHE /var/cache/www/pythoneggs
SetEnv DJANGO_SETTINGS_MODULE rocket.settings
PythonOption DJANGO_SETTINGS_MODULE rocket.settings
PythonDebug On
PythonAutoReload On


SetHandler default-handler




# Django settings for rocket project.
from aws.S3 import CallingFormat

DEFAULT_FILE_STORAGE = 'aws.S3Storage.S3Storage'

AWS_ACCESS_KEY_ID = 'X'
AWS_SECRET_ACCESS_KEY = 'X'

AWS_STORAGE_BUCKET_NAME = 'xxx'
AWS_CALLING_FORMAT = CallingFormat.PATH
#AWS_CALLING_FORMAT = 'CallingFormat.SUBDOMAIN'

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', '[EMAIL PROTECTED]'),
)

MANAGERS = ADMINS

DATABASE_ENGINE = 'mysql'   # 'postgresql_psycopg2',
'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'rocket' # Or path to database file if using
sqlite3.
DATABASE_USER = 'user1' # Not used with sqlite3.
DATABASE_PASSWORD = 'XX' # 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.

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

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

SITE_ID = 1

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

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com;, "http://example.com/media/;
MEDIA_URL = ''

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

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'xx'

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

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

ROOT_URLCONF = 'rocket.urls'

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

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.gis',
'django.contrib.sites',
'rocket.obs'
)
~ 
Justin Bronn wrote:
>   
>> However, if I access the application over http, the server hangs at
>> exactly that spot.  No error logged.
>> If I comment out the line, everything runs fine.
>> 
>
> You're going to have to provide more details on exactly what "http"
> means here.  How are you deploying, e.g., mod_wsgi, mod_python,
> fastcgi?  What's the configuration look like?  What's the web server,
> it's version?
>
> -Justin
> >
>
>   


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en

Re: Apache2 + mod_python --> not working

2008-10-24 Thread Karen Tracey
On Fri, Oct 24, 2008 at 11:51 AM, tsmets <[EMAIL PROTECTED]> wrote:

>
> I installed mod_python & apache2.
> mod_python is OK
> http://ubuntuforums.org/showthread.php?t=91101
>
> I then a adapted the http.conf to
> [EMAIL PROTECTED]:/etc/apache2$ cat httpd.conf
> 
>SetHandler python-program
>PythonHandler django.core.handler.modpython


This is wrong.  It's supposed to be:

   PythonHandler django.core.handlers.modpython

(You're missing the s in 'handlers'.)

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



django.contrib.auth Password Reset Form

2008-10-24 Thread mccomas . chris

I posted this on the IRC channel and didn't get a definite answer, but
I'm trying to use the django.contrib.auth Password Reset Form.

Here's the code in the django/contrib/auth/forms.py http://dpaste.com/86595/

In the default templates the template attempts to display the new
password by using {{ new_password }}, but new_password is not declared/
set anywhere that I can see in the forms.py in the context.

I have it up and running on my site, but when I use the reset form to
reset a test-user account it doesn't reset the password in the
database and it also doesn't display anything in the email where
{{ new_password }} is displayed.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: max_length for TextField is not respected

2008-10-24 Thread Karen Tracey
On Fri, Oct 24, 2008 at 11:26 AM, omat <[EMAIL PROTECTED]> wrote:

>
> Thanks for the reply Karen.
>
> Accepted but not used? Neither in the model nor in the forms? This is
> not how I would expect it to be.


Yes, that's the way it is.  max_length is specified as a possible keyword
argument in django.db.models.fields.Field.__init__ and there is no code in
any of the Field subclasses which don't use it (that I see) to object to its
unexpected/unused presence.  So you can specify max_length on a DateField,
e.g., and it's not an error.  It's just not used for anything.  This is
maybe a bit surprising but I don't know that it's worth "fixing".


>
> Then, how can I limit a, say comment field to 500 chars in a djangoic
> way?
>

Use a CharField with max_length 500 and override the widget used in your
forms, since a single-line input for something that large is pretty
obnoxious.

Or write your own limited text field that enforces a max_length, either at
the model field level or just at the forms level.

(Or rethink the idea of artificially limiting such things.)

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



Re: Apache2 + mod_python --> not working

2008-10-24 Thread tsmets

Forgot to add that I adapted the
/etc/apache2/sites-available/default

///
NameVirtualHost *

 
  ServerAdmin [EMAIL PROTECTED]
  
PythonPath "['/home/me/Documents/django'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE customer.settings
PythonInterpreter utils
  
 
...


///

but with or without this ... :(
under the folder /home/me/Documents/django, I have a folder 'customer'
with in it the 'setting.py' as one could have challenged...

Tx,

\T,
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: max_length for TextField is not respected

2008-10-24 Thread Matías Costa
Any reason? Seems pretty basic and easy to limit TextField length. On code
and db level.

On Fri, Oct 24, 2008 at 5:09 PM, Karen Tracey <[EMAIL PROTECTED]> wrote:

> On Fri, Oct 24, 2008 at 10:24 AM, omat <[EMAIL PROTECTED]> wrote:
>
>>
>> Hi,
>>
>> I have a form class derived from a model using ModelForm.
>>
>> The model has a TextField(max_length=300) field, but length limit is
>> not taken into account and the form passes validation when texts > 300
>> char are submitted. Same when submitting through admin.
>>
>> Is max_length not used for TextField? Is it something supported at db
>> level?
>>
>> I am using sqlite and django 1.0.
>>
>>
> max_length is not used for TextFields.
>
> 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Apache2 + mod_python --> not working

2008-10-24 Thread tsmets

I installed mod_python & apache2.
mod_python is OK
http://ubuntuforums.org/showthread.php?t=91101

I then a adapted the http.conf to
[EMAIL PROTECTED]:/etc/apache2$ cat httpd.conf

SetHandler python-program
PythonHandler django.core.handler.modpython
SetEnv DJANGO_SETTINGS_MODULES de_post.settings
PythonOption django.root /utils
PythonDebug On
PythonPath "['/home/me/Documents/django'] + sys.path"


I however keep on receiving :
/// http://localhost/followDeploys/viewDeployed/poc
///
MOD_PYTHON ERROR

ProcessId:  26322
Interpreter:'utils'

ServerName: '127.0.1.1'
DocumentRoot:   '/htdocs'

URI:'/utils/'
Location:   '/utils'
Directory:  None
Filename:   '/htdocs'
PathInfo:   '/utils/'

Phase:  'PythonHandler'
Handler:'django.core.handler.modpython'

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
1202, in _process_target
module = import_module(module_name, path=path)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
304, in import_module
return __import__(module_name, {}, {}, ['*'])

ImportError: No module named handler.modpython
/// END OF
FILE  ///

I believe I need to adapt my /etc/apache2/sites-available/default
but ... with what ...

Tx,

\T,

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: GeoDjango problem -- server hangs on GEOSGeometry calls

2008-10-24 Thread Justin Bronn


> However, if I access the application over http, the server hangs at
> exactly that spot.  No error logged.
> If I comment out the line, everything runs fine.

You're going to have to provide more details on exactly what "http"
means here.  How are you deploying, e.g., mod_wsgi, mod_python,
fastcgi?  What's the configuration look like?  What's the web server,
it's version?

-Justin
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: aggregation filter?

2008-10-24 Thread Matías Costa
Sure exists a better way. Get the tags (using django-tagging) used by more
than 3 items:

Tag.objects.extra(where=["id in (select tag_id from tagging_taggeditem group
by tag_id having count(tag_id)>3)"]

On Fri, Oct 24, 2008 at 4:37 PM, kbs <[EMAIL PROTECTED]> wrote:

>
> Hello all,
>
> is it possible to filter based on an aggregate value? like count using
> django orm?
>
> for example:
>
> class Group(model):
>name = CharField()
>
> class Member(model):
>name = charfield()
>group = ForeignKey(Group)
>
>
> How can I filter the groups that have 10+ members using the django
> orm?
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: aggregation filter?

2008-10-24 Thread gordyt

Forgot to say that I did that test in a sample app called "filters".
Hence the table name "filters_member".

--g
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: aggregation filter?

2008-10-24 Thread gordyt

Hi kbs,

Given this:


class Group(models.Model):
name = models.CharField(max_length=64)

class Member(models.Model):
name = models.CharField(max_length=64)
group = models.ForeignKey(Group)


This will return what you want:


Group.objects.extra(where=['id in (select group_id from filters_member
group by group_id having count(*) > %s)'],params=[10])


--gordy
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: max_length for TextField is not respected

2008-10-24 Thread omat

Thanks for the reply Karen.

Accepted but not used? Neither in the model nor in the forms? This is
not how I would expect it to be.

Then, how can I limit a, say comment field to 500 chars in a djangoic
way?


Thanks...

--
omat



On Oct 24, 6:09 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Fri, Oct 24, 2008 at 10:24 AM, omat <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I have a form class derived from a model using ModelForm.
>
> > The model has a TextField(max_length=300) field, but length limit is
> > not taken into account and the form passes validation when texts > 300
> > char are submitted. Same when submitting through admin.
>
> > Is max_length not used for TextField? Is it something supported at db
> > level?
>
> > I am using sqlite and django 1.0.
>
> max_length is not used for TextFields.
>
> 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: where is the error ?? dictionary update sequence element #0 has length 1; 2 is required

2008-10-24 Thread Net_Boy

Thank you for your 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: admin DATE_FORMAT not working?

2008-10-24 Thread Lars Stavholm

Low Kian Seong wrote:
> Maybe this would shed some light:
> http://code.djangoproject.com/ticket/2203

Yup, that explains it, thanks.
/L

> On Fri, Oct 24, 2008 at 4:57 PM, Lars Stavholm <[EMAIL PROTECTED]
> > wrote:
> 
> I've got...
> 
> TIME_ZONE = 'Europe/Stockholm'
> DATE_FORMAT = "Y-m-d"
> TIME_FORMAT = "H:i"
> DATETIME_FORMAT = DATE_FORMAT + " " + TIME_FORMAT
> 
> ...in my settings.py file, but no joy, these definitions are not
> used in the admin interface when running the development server.
> Instead I get the US format or whatever it is, something like
> "Oct. 24, 2008, 10:51 a.m.".
> 
> Any hints on what I am doing wrong here?
> Maybe there's more settings needed that I'm not aware off?
> 
> Any input appreciated
> /Lars


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: max_length for TextField is not respected

2008-10-24 Thread Karen Tracey
On Fri, Oct 24, 2008 at 10:24 AM, omat <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I have a form class derived from a model using ModelForm.
>
> The model has a TextField(max_length=300) field, but length limit is
> not taken into account and the form passes validation when texts > 300
> char are submitted. Same when submitting through admin.
>
> Is max_length not used for TextField? Is it something supported at db
> level?
>
> I am using sqlite and django 1.0.
>
>
max_length is not used for TextFields.

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



aggregation filter?

2008-10-24 Thread kbs

Hello all,

is it possible to filter based on an aggregate value? like count using
django orm?

for example:

class Group(model):
name = CharField()

class Member(model):
name = charfield()
group = ForeignKey(Group)


How can I filter the groups that have 10+ members using the django
orm?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



max_length for TextField is not respected

2008-10-24 Thread omat

Hi,

I have a form class derived from a model using ModelForm.

The model has a TextField(max_length=300) field, but length limit is
not taken into account and the form passes validation when texts > 300
char are submitted. Same when submitting through admin.

Is max_length not used for TextField? Is it something supported at db
level?

I am using sqlite and django 1.0.


Thanks for any comments...


--
omat

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: from mysite.polls.models import Poll, Choice

2008-10-24 Thread Carl Meyer

On Oct 24, 9:30 am, Carl Meyer <[EMAIL PROTECTED]> wrote:
> manage.py puts both the project dir itself and its parent dir
> onto the Python path.

Sorry, this is not accurate.  manage.py only adds the project's parent
dir explicitly.  Importing by app name works because generally you'd
run manage.py from within the project dir ("./manage.py"), thus it is
the current directory, which is on the Python path.

Nonetheless, the point stands.  Since the tutorial only advises
running manage.py from in the project dir, everything in the tutorial
would work just as well if the project name were removed from every
app import statement.

Carl
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



GeoDjango problem -- server hangs on GEOSGeometry calls

2008-10-24 Thread Liam

Hi --

I could really use some help with this one!

In my application I have a call to get_coords().  It works fine if I
call the function containing it from 'manage.py shell'.
It works fine if I call it from a short command line test program.

However, if I access the application over http, the server hangs at
exactly that spot.  No error logged.
If I comment out the line, everything runs fine.

What am I missing here?  Anyone?

Liam

P.S. I was having the same problem with another call, fromstr()
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Foreign Key Problem

2008-10-24 Thread cwurld

>
> ALTER TABLE  ENGINE=INNODB;
>

I changed all my tables to InnoDB. That seems to have solved the
problem. Thanks for the suggestion.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Ordering M2M field?

2008-10-24 Thread [EMAIL PROTECTED]

OK, I have a model with a many to many relationship.. pretty
straightforward pre-1.0 code:

class SpecialEvent(models.Model):
sponsors = models.ManyToManyField(Advertiser, related_name="event
sponsors", null=True, blank=True)

Problem is, the Powers That Be want those sponsors in a certain order.
I thought they just showed up in the order in which they were added in
the admin (ordered by id on their table)

That does not appear to be the case. They appear to order themselves
based on their own id.

So, how can I set the order in which they appear?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problems with unicode characters in templates

2008-10-24 Thread Karen Tracey
On Fri, Oct 24, 2008 at 10:04 AM, MrMuffin <[EMAIL PROTECTED]> wrote:

>
> When I use norwegian characters in templates django spews out errors
> about encoding. What encoding ( UTF-8, iso-8859-1 ) should I use and
> where do I put it to avoid these errors?
>

UTF-8 is what is assumed by default, but if you want to use something else
there's a setting:

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



Problems with unicode characters in templates

2008-10-24 Thread MrMuffin

When I use norwegian characters in templates django spews out errors
about encoding. What encoding ( UTF-8, iso-8859-1 ) should I use and
where do I put it to avoid these errors?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Adding a custom permission to the User model

2008-10-24 Thread Benedict Verheyen

Benedict Verheyen wrote:
> Hi,
> 
> I'm trying to specify a custom permission on the User model.
> I would use it to delegate control to users over certain models.
> 
> I have an admin.py file where i add this:
> 
> from django.contrib.auth.models import User
> ...
> class UserAdmin(admin.ModelAdmin):
> class Meta:
> permissions = (
> ("create_user", "Create a user from the standard view"),
> )
> 
> I can't add admin.site.register(User, UserAdmin) because then i get
> a message that it's already registered.
> 
> When i do python manage.py syncdb i don't see anything written to the
> db. The permission is also not visible from within the users part of the
> admin site.
> 
> How can i add a custom permission to the standard User model?
> 
> Thanks,
> Benedict

Is there a way to add custom permissions to the standard User model or
not ? I can't seem to get this working so any info would be appreciated?.

Regards,
Benedict


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ignore url

2008-10-24 Thread Karen Tracey
On Fri, Oct 24, 2008 at 6:56 AM, Niall Mccormack <
[EMAIL PROTECTED]> wrote:

>
> Is it possible to tell Django to ignore certain url's so that it
> resorts to showing what is on the server at that url.
>
> i.e. if I have a file at the url
> http://www.mywebsite.com/myfiles/image.jpg
>
> Can I instruct Django to ignore the /myfiles/ url so I can link
> directly to that file?
>
>
The place to do this is in the web server configuration.  You configure it
so that such files are served directly rather than sending the request
through Django.  Unless you are talking about the Djagno development server;
there you can use the static server to serve these files.  Search for
"static files" in the docs for details on how to do that.

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



Re: from mysite.polls.models import Poll, Choice

2008-10-24 Thread Carl Meyer

On Oct 23, 3:30 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
> It's documented that way because it means we can have a tutorial that
> doesn't immediately dump import-path configuration issues onto people
> who are brand-new to Python; doing things the way the tutorial does
> them, everything automatically ends up on the Python path thanks to
> manage.py.

Things work just as magically with the dev server for apps inside the
project dir if you simply import by the app name and omit the project
name.  manage.py puts both the project dir itself and its parent dir
onto the Python path.  So AFAICT, this particular reasoning is
baseless.

Carl
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: variable tag / filter

2008-10-24 Thread Jeff FW

Write one base template, and have as many as you need extend from it,
overriding whatever blocks you need.  The "child" templates could be
as simple as one or two lines.  There's no harm in having more,
smaller templates--in fact, it makes it more flexible and easier to
change in the future.

-Jeff

On Oct 24, 1:01 am, ramya <[EMAIL PROTECTED]> wrote:
> I wanted to write one all purpose generic template..
>
> Now I have split that and extended multiple specific templates.. :(
>
> Thanks,
> ~ramyak/
>
> On Oct 23, 6:34 pm, Jeff FW <[EMAIL PROTECTED]> wrote:
>
> > To my knowledge, no, it's not possible to do that.  Even if it was,
> > however, I would strongly argue against it, as it would make your
> > templates unreadable--how would you know what filter/tag would be
> > called without mucking through the rest of your code? Maybe there's a
> > better way to get the effect you want--what are you trying to achieve?
>
> > -Jeff
>
> > On Oct 23, 6:59 am, ramya <[EMAIL PROTECTED]> wrote:
>
> > > Is it possible to have variable tags / filters
>
> > > {{ my_value | my_filter }}
> > > where c['my_filter'] = 'formatDateTime'
> > > formatDateTime is the actual filter function defined in templatetags
>
> > > similarly
>
> > > {{ my_tag my_filter }}
> > > where c['my_tag'] = 'formatDateTime'
> > > formatDateTime is the actual tag function defined in templatetags
>
> > > say in both the cases  formatDateTime is registered tag/filter and has
> > > been loaded
>
> > > Regards,
> > > ~ramyak/
>
>
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django 1.0: XML documents in database, view as HTML, download as RTF

2008-10-24 Thread Horst Gutmann

You might get some ideas from Andrew West's and Zeth Green's Pixelise
project which basically uses Django as a frontend application with a
DB XML backend for document management:

http://pixelise.org/

The transformation itself shouldn't be a big problem with some nice
cronjobs + Python's zip-module and XSLT :-)

-- Horst

On Thu, Oct 23, 2008 at 5:47 PM, Mirto Silvio Busico <[EMAIL PROTECTED]> wrote:
> Hi all django gurus,
>
> There is any hint, snippet, google code related to the object?
>
> Use case:
>
>* publish an online magazine with content saved as XML inside the
>  database
>* every article is shown as a web page (so in HTML)
>* there should be an download magazine function that gives a zipfile
>  containing the tree structure of the magazine and the articles
>  converted in rtf (or ODT)
>
> Thanks
>Mirto
>
> --
>
> _
> Busico Mirto Silvio
> Consulente ICT
> cell. 333 4562651
> email [EMAIL PROTECTED]
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: CSS link problem(how to call css)

2008-10-24 Thread srini

Thank you so much Low Kian for your help.
now i got the answer
here is the solution

(r'^media/(?P.*)$', 'django.views.static.serve',
{'document_root': 'media'}),

Thank

On Oct 24, 5:00 pm, "Dj Gilcrease" <[EMAIL PROTECTED]> wrote:
> {% block stylesheet %}{{ MEDIA_URL }}/css/gaslog.css{% endblock %}
>
> Should work
>
> Dj Gilcrease
> OpenRPG Developer
> ~~http://www.openrpg.com
>
> On Fri, Oct 24, 2008 at 1:10 AM, srini <[EMAIL PROTECTED]> wrote:
>
> > Hi All,
> > i created one page template where i am trying to use my css and i am
> > calling that css in this fashion
>
> > {% block stylesheet %}/css/gaslog.css{% endblock %}
>
> > but its not calling my css file. i think i attempted some silly thing
> > or do not know exact way how to call my css.
>
> > could any one suggest me or may refer any link to resolve it.
>
> > 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: css

2008-10-24 Thread srini

Thank you so much Low Kian for your help.
now i got the answer
here is the solution

(r'^media/(?P.*)$', 'django.views.static.serve',
{'document_root': 'media'}),

Thanks

On Oct 24, 12:23 pm, "Low Kian Seong" <[EMAIL PROTECTED]> wrote:
> Read up on serving static files from django. The documentation is quite
> complete and you should be up and on your way in no time by just adapting
> examples from there.
>
> On Fri, Oct 24, 2008 at 2:46 PM, srini <[EMAIL PROTECTED]> wrote:
>
> > Dear users,
>
> >I am beginner in Djago, Well i have created my new project
> > in django , But the problem is i am unable to link css static files to
> > my template which ever i created in django application.
>
> >Well, i do not know the right way to link css to my
> > template in django, Please help me it's urgent without that i cannot
> > move ahead in my project.
>
> > 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: where is the error ?? dictionary update sequence element #0 has length 1; 2 is required

2008-10-24 Thread Dj Gilcrease

url(r'^auction/(?P\d+)/bid_history/$',
'assignment3.auction.views.bid_history' , {}, name='bid_history'),

try that

Dj Gilcrease
OpenRPG Developer
~~http://www.openrpg.com



On Fri, Oct 24, 2008 at 5:38 AM, Net_Boy <[EMAIL PROTECTED]> wrote:
>
> I change it to :  (r'^auction/(?P\d+)/bid_history/$',
> 'assignment3.auction.views.bid_history' , 'bid_history'),
>
> but I get  error msg:
> Caught an exception while rendering: Reverse for
> 'assignment3.bid_history' with arguments '(2,)' and keyword arguments
> '{}' not found.
> it should say 'assignment3.auction.bid_history' !?
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: CSS link problem(how to call css)

2008-10-24 Thread Dj Gilcrease

{% block stylesheet %}{{ MEDIA_URL }}/css/gaslog.css{% endblock %}

Should work


Dj Gilcrease
OpenRPG Developer
~~http://www.openrpg.com



On Fri, Oct 24, 2008 at 1:10 AM, srini <[EMAIL PROTECTED]> wrote:
>
> Hi All,
> i created one page template where i am trying to use my css and i am
> calling that css in this fashion
>
> {% block stylesheet %}/css/gaslog.css{% endblock %}
>
> but its not calling my css file. i think i attempted some silly thing
> or do not know exact way how to call my css.
>
> could any one suggest me or may refer any link to resolve it.
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: where is the error ?? dictionary update sequence element #0 has length 1; 2 is required

2008-10-24 Thread Net_Boy

I change it to :  (r'^auction/(?P\d+)/bid_history/$',
'assignment3.auction.views.bid_history' , 'bid_history'),

but I get  error msg:
Caught an exception while rendering: Reverse for
'assignment3.bid_history' with arguments '(2,)' and keyword arguments
'{}' not found.
it should say 'assignment3.auction.bid_history' !?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: where is the error ?? dictionary update sequence element #0 has length 1; 2 is required

2008-10-24 Thread Net_Boy

it is an honor to get a reply from you sir , I saw your presentation
in DjangoCon 2008   and I loved 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



ignore url

2008-10-24 Thread Niall Mccormack

Is it possible to tell Django to ignore certain url's so that it  
resorts to showing what is on the server at that url.

i.e. if I have a file at the url
http://www.mywebsite.com/myfiles/image.jpg

Can I instruct Django to ignore the /myfiles/ url so I can link  
directly to that file?

Cheers
Niall

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Custom include tag to parse locale into filename

2008-10-24 Thread Jarek Zgoda

Wiadomość napisana w dniu 2008-10-23, o godz. 22:26, przez Gerard  
Petersen:

> I have an include tag to a file with context help information. My  
> app is fully i18n-ed, but I don't want to handle the bigger the  
> helptext via i18n because of its size. I want to end up with  
> something like this: myapp/customer_side.en.html.
>
> The code snippet:
>
> 
>{% include "myapp/customer_side.html" %}
> 
>
> I'm thinking about a custom templatetag that picks up on the locale.  
> Does anybody have other suggestions on how to do this?


I'd suggest writing your own template loader, it works also with {%  
include %} tag. There is a section on this in Django Book (maybe this  
should find its way to official docs too?).

-- 
We read Knuth so you don't have to. - Tim Peters

Jarek Zgoda, R, Redefine
[EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Wholesale sony ps3 ...ipod...wii....NOKIA Website: http://www.sonyecvv.com

2008-10-24 Thread 008

hi
We are the most professional with the biggest wholesale electronics
merchandise supply merchandise
..We have a lot of very nice quality merchandises with the
very special price
  They are all brand new with full accessories and 1 year
international warranty, unlocked, work effectively with any network
worldwide and come with user manual guide in various languages.
Ipod nano Ipod Nano II  1G 45$ ,2G 55$, 4G 65$,8G 70$, 30G 100$ ,60G
120$
 Ipod Itouch 4GB 60$ 8gb 80$  16gb 120$ 32gb   200$
ps3  60GB 280$  20GB 180$  80GB 300$
psp  100$
wii  250$
x360  250$
Apple Iphone  180$
Robot Dog  150$
We have all models of nokia
VERTU 250$
NOKIA N96 $280
NOKIA 8600 $260
NOKIA N800  $230
NOKIA N95 8G  $260
NOKIA N95 $220
NOKIA N93 $150
NOKIA N92 $130
NOKIA N91 $130
NOKIA N90 $120
Nokia N70 $160
NOKIA N73 $180
NOKIA 7600 (UNLOCK) $150
Nokia 8800 Sirocco Gold Edtion -$250
Nokia 8800 Sirocco Black$250
Garmin Nuvi GPS
Garmin Nuvi 770 250$Garmin Nuvi 760  220$  Garmin Nuvi 750  280$Garmin
Nuvi 680  210$ Garmin Nuvi 710 290$ Garmin Nuvi 670 190$ Garmin Nuvi
660 150$ Garmin Nuvi 610 180$ Garmin Nuvi 250W 160$ Garmin Nuvi 300
180$
(1).all products are all original and new
(2).they have 1year international warranty.
(3).free shipping include ems, tnt, dhl, ups. you may choose one kind
(4).deliver time is in 5days to get your door
We insist the principia: Prestige first,high-quality,competitive
price,
best services,and timely delivery.
Website:  http://www.sonyecvv.com
 msn: [EMAIL PROTECTED]
Fa-Fa  Co., Ltd.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



CSS link problem(how to call css)

2008-10-24 Thread srini

Hi All,
i created one page template where i am trying to use my css and i am
calling that css in this fashion

{% block stylesheet %}/css/gaslog.css{% endblock %}

but its not calling my css file. i think i attempted some silly thing
or do not know exact way how to call my css.

could any one suggest me or may refer any link to resolve it.

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: css

2008-10-24 Thread srini

i did the same way

i.e


   


 but still its not calling the css..

On Oct 24, 12:10 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> On Friday 24 October 2008 12:16:50 pm srini wrote:
>
> >Well, i do not know the right way to link css to my
> > template in django, Please help me it's urgent without that i cannot
> > move ahead in my project.
>
> a template is just html - so attach the css just as you would in an ordinary
> html file. Uusually it is put in the head section of base.html.
>
> --
> regards
> KGhttp://lawgon.livejournal.com

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



Re: Different settings.py files for server and development

2008-10-24 Thread Ross Dakin

I do it like this:


# settings.py
[ ... ]
try:
from settings_dev import *
except ImportError:
pass


# settings_dev.py
import os

DEBUG = True
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'dev.db'
MEDIA_ROOT = os.path.abspath('../') + '/public/media/'
MEDIA_URL = 'http://127.0.0.1:8000/media/'
TEMPLATE_DIRS = (os.path.abspath('') + '/templates')
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



[solved] Custom include tag to parse locale into filename

2008-10-24 Thread Gerard Petersen

Should anybody need this, I customised the include tag (and copied it into 
templatetags).

The code:

from django.template.loader_tags import IncludeNode,ConstantIncludeNode

def do_i18n_include(parser, token):
bits = token.contents.split()
if len(bits) != 2:
raise TemplateSyntaxError, "%r tag takes one argument: the name of the 
template to be included" % bits[0]
path = bits[1]

# @todo: fallback to 'en' if non existed locale helpfile is detected
language = get_language()[0:2]
i18npath = path.replace('.', '.'+language+'.')
path = i18npath

if path[0] in ('"', "'") and path[-1] == path[0]:
return ConstantIncludeNode(path[1:-1])
return IncludeNode(bits[1])

register.tag('my18n_include')(do_i18n_include)


Note: there's no fallback yet to a default for none existent locale files.

Regards,

Gerard.


Gerard Petersen wrote:
> Hi All,
> 
> I have an include tag to a file with context help information. My app is 
> fully i18n-ed, but I don't want to handle the bigger the helptext via i18n 
> because of its size. I want to end up with something like this: 
> myapp/customer_side.en.html.
> 
> The code snippet:
> 
> 
> {% include "myapp/customer_side.html" %}
> 
> 
> I'm thinking about a custom templatetag that picks up on the locale. Does 
> anybody have other suggestions on how to do this?
> 
> 
> Thanx a lot.
> 
> Regards,
> 
> Gerard.
> 
> 

-- 
urls = { 'fun':  'www.zonderbroodje.nl',  'tech':  'www.gp-net.nl' }


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Problem with contrib.comments and signals: instance is not defined

2008-10-24 Thread Eric Abrahamsen


On Oct 24, 2008, at 12:23 PM, Brandon Taylor wrote:

>
> Hi everyone,
>
> I'm using Django 1.0, and attempting to do some comment moderation
> with Akismet. When I try to wire up a pre_save signal, I'm getting an
> error saying 'instance' is not defined. Here is my code:

You might also consider using one of the custom signals that come with  
the comment app, they are part of the comment posting process and as  
such are easier to use for some things like this:

http://docs.djangoproject.com/en/dev/ref/contrib/comments/signals/

Eric


> def moderate_comment(sender, **kwargs):
>if not instance.id:  # <-- instance is not defined
>entry = instance.get_content_object()
>delta = datetime.datetime.now() - entry.pub_date
>if delta.days > 30:
>instance.is_public = False
>else:
>akismet_api = Akismet(key=settings.AKISMET_API_KEY,
> blog_url='http://%s/' % Site.objects.get_current().domain)
>
>if akismet_api.verify_key():
>akistmet_data = {'comment_type' : 'comment',
> 'referrer' : '', 'user_ip' : instance.ip_address, 'user-agent' : ''}
>if
> akismet_api.comment_check(smart_str(instance.comment), akistmet_data,
> build_data=True):
>instance.is_public = False
>
>email_body = '%s posted a new comment on the entry %s.'
>mail_managers('New comment posted', email_body %
> (instance.user_name, instance.get_content_object()))
>
> models.signals.pre_save.connect(moderate_comment, sender=Comment)
>
>
> Not sure what I'm doing wrong, but I would appreciate an extra set of
> eyes.
>
> TIA,
> Brandon
> >


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Multiple selects for ForeignKey in admin

2008-10-24 Thread Nick Sandford

Just wondering how easy it would be to implement something like this:

class Foo(models.Model):
name = models.CharField(max_length=200)
bar = models.ForeignKey(Bar)

class Bar(models.Model):
name = models.CharField(max_length=200)
category = models.CharField(max_length=200)

def __unicode__(self):
return self.name

Then, in the admin have multiple select boxes to choose a Bar while
creating a new Foo object: one to chose the category of the Bar object
and one to chose the Bar object itself.
When you select a category, the select to chose the Bar filters based
on the category chosen. Would be useful for having lots of Bar objects
to chose from and not having to use raw_id_fields

Any ideas?

Cheers,
Nick

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: admin DATE_FORMAT not working?

2008-10-24 Thread Low Kian Seong
Maybe this would shed some light:

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

On Fri, Oct 24, 2008 at 4:57 PM, Lars Stavholm <[EMAIL PROTECTED]> wrote:

>
> I've got...
>
> TIME_ZONE = 'Europe/Stockholm'
> DATE_FORMAT = "Y-m-d"
> TIME_FORMAT = "H:i"
> DATETIME_FORMAT = DATE_FORMAT + " " + TIME_FORMAT
>
> ...in my settings.py file, but no joy, these definitions are not
> used in the admin interface when running the development server.
> Instead I get the US format or whatever it is, something like
> "Oct. 24, 2008, 10:51 a.m.".
>
> Any hints on what I am doing wrong here?
> Maybe there's more settings needed that I'm not aware off?
>
> Any input appreciated
> /Lars
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



admin DATE_FORMAT not working?

2008-10-24 Thread Lars Stavholm

I've got...

TIME_ZONE = 'Europe/Stockholm'
DATE_FORMAT = "Y-m-d"
TIME_FORMAT = "H:i"
DATETIME_FORMAT = DATE_FORMAT + " " + TIME_FORMAT

...in my settings.py file, but no joy, these definitions are not
used in the admin interface when running the development server.
Instead I get the US format or whatever it is, something like
"Oct. 24, 2008, 10:51 a.m.".

Any hints on what I am doing wrong here?
Maybe there's more settings needed that I'm not aware off?

Any input appreciated
/Lars


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Date Format in Admin

2008-10-24 Thread Matias Surdi

http://docs.djangoproject.com/en/dev/ref/settings/#date-format

Botolph escribió:
> I would like to change the formatting of dates in the admin from -
> MM-DD to DD-MM-. I have set "DATE_FORMAT" in the settings file,
> but that only changes list_display and not the DateField input. In a
> post from Januar 2007 Adrian wrote:
> 
>> Yes, newforms DateFields let you specify the input format(s). This has
>> yet to be integrated into the Django admin, but it will be sooner
>> rather than later.
> 
> Has this been integrated now? If so, where can I change it? I have
> been searching for hours without finding a solution.
> 
> > 
> 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: css

2008-10-24 Thread Low Kian Seong
Read up on serving static files from django. The documentation is quite
complete and you should be up and on your way in no time by just adapting
examples from there.

On Fri, Oct 24, 2008 at 2:46 PM, srini <[EMAIL PROTECTED]> wrote:

>
> Dear users,
>
>I am beginner in Djago, Well i have created my new project
> in django , But the problem is i am unable to link css static files to
> my template which ever i created in django application.
>
>Well, i do not know the right way to link css to my
> template in django, Please help me it's urgent without that i cannot
> move ahead in my project.
>
> 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: where is the error ?? dictionary update sequence element #0 has length 1; 2 is required

2008-10-24 Thread Malcolm Tredinnick


On Thu, 2008-10-23 at 23:59 -0700, Net_Boy wrote:
[...]
> ---
> views.py:
> def bid_history(request, object_id):item = get_object_or_404(Item,
> item_id=object_id)
> bid_history = Bid.objects.filter(bid_item=item).order_by('-
> bid_price')
> return render_to_response("bid_list.html", {"bid_history":
> bid_history}, context_instance=RequestContext(request))

For future reference, you're going to want to pay attention to indenting
when pasting code fragments like this, since this code is basically
illegal Python (and fairly unreadable for us as well).

> -
> urls.py:
> (r'^auction/(?P\d+)/bid_history/$', 'bid_history',
> 'assignment3.auction.views.bid_history'),

The third argument to a URL Conf pattern is not a string. It's a
dictionary. I'm not sure what you're trying to do here, but this isn't
correct. So the problem is in this line.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: css

2008-10-24 Thread Kenneth Gonsalves

On Friday 24 October 2008 12:16:50 pm srini wrote:
>    Well, i do not know the right way to link css to my
> template in django, Please help me it's urgent without that i cannot
> move ahead in my project.

a template is just html - so attach the css just as you would in an ordinary 
html file. Uusually it is put in the head section of base.html.

-- 
regards
KG
http://lawgon.livejournal.com

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



where is the error ?? dictionary update sequence element #0 has length 1; 2 is required

2008-10-24 Thread Net_Boy

I made a function for the bid_history and when I click on the Bid link
in the item's details it gets the id of the item and got to the
views.bidd_history

it shows me an error :
dictionary update sequence element #0 has length 1; 2 is required
Why?
---
views.py:
def bid_history(request, object_id):item = get_object_or_404(Item,
item_id=object_id)
bid_history = Bid.objects.filter(bid_item=item).order_by('-
bid_price')
return render_to_response("bid_list.html", {"bid_history":
bid_history}, context_instance=RequestContext(request))
-
urls.py:
(r'^auction/(?P\d+)/bid_history/$', 'bid_history',
'assignment3.auction.views.bid_history'),
---
the link in thetemplate Bid

anyone?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



css

2008-10-24 Thread srini

Dear users,

I am beginner in Djago, Well i have created my new project
in django , But the problem is i am unable to link css static files to
my template which ever i created in django application.

Well, i do not know the right way to link css to my
template in django, Please help me it's urgent without that i cannot
move ahead in my project.

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