Re: I'm so confused...

2006-09-25 Thread iain duncan

On Tue, 2006-26-09 at 07:50 +0530, Kenneth Gonsalves wrote:
> 
> On 26-Sep-06, at 2:20 AM, Julio Nobrega wrote:
> 
> > committed, and learn 2 programming languages, Javascript and Python,
> > plus HTML.
> 
> and SQL and CSS

If you are new to coding, I would suggest that you focus on the python
stuff for now. You'll be fine with a cursory knowledge of SQL as Django
hides most of the SQL drudgery from you, but it's worth at least being
familiar with the basics. And I would not say that javascript is a good
first language in the slightest! 

Get comfortable with Python and a good editor and learn your regular
expressions. I like gvim, but people will fight me to the death on that
one, ha ha.

Iain


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



Re: Confused about generic.create_update

2006-09-25 Thread Russell Keith-Magee

On 9/26/06, froke <[EMAIL PROTECTED]> wrote:
> When I submit the form, I get the following in errors
> (update_object.errors):
> 'user': ['This field is required.']

When you submit your form, you are using create_object/update_object
to create/update your UserProfile instance, based upon the form values
from the Request.

However, there is nothing in the form data that can be used to
populate UserProfile.user. While the current user _is_ stored as
request.user, the generic views don't know that they have to populate
UserProfile.user with the value of request.user. Hence the 'user' is
required message.

The easiest fix I can think of would be to put a hidden field in your
form that holds the id of the current user. This will put a 'user'
entry into your form data, which will allow the create/update generic
views to submit without error.

Another option would be to use the 'follow' argument in the
create/update generic views: this argument describes which attributes
of an object will be represented as field data; if you list the
attributes that _are_ present as fields, but exclude 'user', then the
error should go away. However, this assumes that UserProfile.user
is/will be assigned at some other time.

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



[SLIGHTLY OT] Adrian to speak at Web Directions North

2006-09-25 Thread Paulo

Apologies if this has been posted to the list already but I just
learned about this. It looks like Adrian will be speaking at Web
Directions North in Vancouver next Feb. 6-10 <
http://north.webdirections.org/detail/speakers/#holovaty >. Pretty
damn cool!

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



Re: I'm so confused...

2006-09-25 Thread Alan Green

On 9/26/06, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
>
>
> On 26-Sep-06, at 2:20 AM, Julio Nobrega wrote:
>
> > committed, and learn 2 programming languages, Javascript and Python,
> > plus HTML.
>
> and SQL and CSS

And let's not forget configuring your web server and database of choice.

Alan.
>
> --
>
> regards
> kg
> http://lawgon.livejournal.com
> http://nrcfosshelpline.in/web/
>
>
>
> >
>


-- 
Alan Green
[EMAIL PROTECTED] - http://bright-green.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
-~--~~~~--~~--~--~---



Re: What I lost if run django under Python 2.3?

2006-09-25 Thread mamcxyz

Ok...

The problem is that i don't be able to compile PIL, I'm getting this
error and behaviour:

http://www.mail-archive.com/image-sig@python.org/msg00859.html

However the instrucctions not fix 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
-~--~~~~--~~--~--~---



Re: Running Multiple Versions of Django (91 and trunk) on the same machine

2006-09-25 Thread [EMAIL PROTECTED]

Thanks to all who offered their suggestions. I'll document what worked
for me:

With a single installation of Python 2.4, I purposely did not symlink
or install Django in the site-packages folder.

I took out all references to PYTHONPATH and PYTHONBIN from my
.bash_login file.

I created a shell script to wrap manage.py:

#!/bin/bash
export PYTHONPATH=/core/django91_src
export DJANGO_SETTINGS_MODULE=ellington.settings
python manage.py runserver 3000

and with my 95 apps:

#!/bin/bash
export PYTHONPATH=/code/django95_src
export DJANGO_SETTINGS_MODULE=test.settings
python manage.py runserver 3000

As soon as I get it working with MOD_PYTHON, I'll document the same
here to help anyone who might get stuck where I did.


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



Re: Re: I'm so confused...

2006-09-25 Thread Brandon Aaron

Completely off-topic but wanted to say, right on with jQuery! I'm also
learning Python and can't wait to get my hands dirty with Django.

On 9/25/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Great replies!
>
> Yes I am a web designer by trade and I am fluent in XHTML and CSS.
>
> I'm learning jQuery and I thought it was about time I learnt how to
> code a CMS.
>
> If I get in any bother I'll post again!
>
>
> >
>

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



Re: autoreload files stored on SMB share

2006-09-25 Thread Malcolm Tredinnick

On Mon, 2006-09-25 at 23:12 +, Steve M wrote:
> Hi,
> 
> I have my Django project source files on a SMB share (it is a Linux
> file server).
> 
> I am running the development server on a different Linux computer,
> which has the SMB share mounted (with smbfs).
> 
> The autoreload feature causes the server to restart every second
> whether or not I have modified the files. If I use the --noreload
> option it stops this, but I like autoreload!
> 
> I've had a look at the django/utils/autoreload.py and, well, honestly
> it would be painful to work out why exactly it is happening and how it
> might be fixed. I don't really know the details of how SMB interacts
> with file stats.
> 
> Anyone know whether my setup is misguided? Or is a fix possible?

Since the autoreloader works by monitoring the mtime (last-modified
time) on the files, it is important that both machines have the same
concept of the current time.

Are the times on both boxes *exactly* in sync? Preferably using
something like NTP to ensure they stay that way? If not, then stat()
calls to check the last modified time on the remote machine are going to
look wrong (and possibly even from the future) on the machine you are
working on.

You could do a quick tests here by just running "date" and "ls -l " to see if they are roughly in sync.

I can't remember precisely how stat() behaves across SMB/CIFS mounts,
but it should be returning the correct last-modified times (although
with I've seen older Linux systems boxes periodically -- but not always
-- return dates from outer space, triggering no end of hilarity and
debugging of monitoring processes gone wild).

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



Re: I'm so confused...

2006-09-25 Thread Kenneth Gonsalves


On 26-Sep-06, at 2:20 AM, Julio Nobrega wrote:

> committed, and learn 2 programming languages, Javascript and Python,
> plus HTML.

and SQL and CSS

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



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



Re: urls.py error

2006-09-25 Thread brad

Thanks Shaun Li. I just figured that out, but thank you because I very
well could have still been stumped until you posted.


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



Re: Template For Loops

2006-09-25 Thread Malcolm Tredinnick

On Mon, 2006-09-25 at 17:25 -0700, brad wrote:
> Now I am getting an error of:
> 
> Exception Type:   TypeError
> Exception Value:  'tuple' object is not callable
> Exception Location:   E:\dp1\mysite\..\mysite\urls.py in ?, line 10
> 
> And line ten of 'urls.py' is the following:
> 
> (r'^select/$', 'mysite.polls.views.select')

When you import mysite.polls.views.select at a Python prompt (e.g. "from
mysite.polls.views import select") is it really a function? Sounds like
it might be a tuple. Have a look at type(select) to see this.

Also, is the first parameter to the patterns() function a string? I
think I've seen this error when you accidently leave off the first
argument to patterns (which is the uniform namespace for that part of
the URL configuration) and just launch into reg-exp and function pairs.

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



Re: urls.py error

2006-09-25 Thread brad

Opps. I posted before I treid all that I could try. I found my error
thanks to you help Don Arbow  and everybody's help on my last post.
Thanks you all.


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



Re: generic views : how i'd like to have it

2006-09-25 Thread Malcolm Tredinnick

On Mon, 2006-09-25 at 07:22 -0700, xaranduu wrote:
> I want to build a generic view for all of my objects and according to
> the documentation
> (http://www.djangoproject.com/documentation/url_dispatch/#captured-parameters)
> it is possible to capture a parameter and forward it to the view .
> 
> Target is to get completely automated generic views, without having to
> edit any template
> (maybe have a set of templates designed once, but valid for all
> objects)
> 
> So I dont want to pass the parameter to the template but to the second
> urls.py
> 
> 
> My approach would be more a kind of
> 
> # In urls.py
> urlpatterns = patterns('',
> (r'^(?P\w+)/', include('foo.urls.mygenericurls')),
> )
> 
> # In foo/urls/mygenericurls.py
> 
> infodict = {}
> 
> info_dict["myobject"] = {'queryset': Myobject.objects.all(),}
> info_dict["myotherobject"] = {'queryset':
> Myotherobject.objects.all(),}
> 
> 
> urlpatterns = patterns('foo.genericviews',
> (r'^list/$', 'blog.index', info_dict[objecttype]),
> (r'^detail/$', 'blog.archive',info_dict[objecttype]),
> ...
> )
> 
> but the objecttype is not visible in the foo/urls/mygeneric.py but only
> in the genericviews!
> 
> Can anybody help 

You can't do this directly in this fashion. The patterns(...) contents
are not evaluated dynamically at runtime like this. Instead you need to
write a small piece of Python code to work out the extra information to
ultimately pass to the view.

For Django's generic views, there is an example here:
http://www.pointy-stick.com/blog/2006/06/29/django-tips-extending-generic-views/

Extending this to call your own views, rather than Django's views is
straightforward.

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



Re: urls.py error

2006-09-25 Thread Don Arbow

On Sep 25, 2006, at 5:48 PM, brad wrote:
>
> Exception Type: TypeError
> Exception Value:'tuple' object is not callable
> Exception Location: E:\dp1\mysite\..\mysite\urls.py in ?, line 10
>
> And line ten of 'urls.py' is the following:
>
> (r'^select/$', 'mysite.polls.views.select')


What does the rest of your urls.py file look like? I would look for a  
Python syntax error on line 9, perhaps a missing comma.

When debugging, don't always accept what the error message says. Just  
like a wreck on the freeway, you may have to follow the skid marks  
and broken glass backward to find the real cause. Line 10 is where  
the Python interpreter realized there was a problem, not necessarily  
where the problem occurred.

Don



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



Re: Project Layout When Using Multiple Sites, Revisited

2006-09-25 Thread Waylan Limberg

On 9/25/06, Scott McCracken <[EMAIL PROTECTED]> wrote:
>
> In continuing to diagnose this problem I have re-read the
> DJANGO_SETTINGS documentation. Under the section for Default Settings
> it says:
>
> "A Django settings file doesn't have to define any settings if it
> doesn't need to. Each setting has a sensible default value. These
> defaults live in the file django/conf/global_settings.py.
>
> Here's the algorithm Django uses in compiling settings:
> * Load settings from global_settings.py.
> * Load settings from the specified settings file, overriding
> the global settings as necessary."
>
> Is it possible to adjust that algorithm to
>
> * first load settings from the global_settings.py
> * second load settings from a common project settings.py
> * third load settings from a specific project's settings.py
>
> In other words, is there a way to have another level of settings in
> between global and project-level without modifying the django_src.

Sure, the settings file is just python code so at the top of your
settings.py do something like:

from myproject.commonsettings import *

Of course, this assumes the file myproject/commonsettings.py



-- 

Waylan Limberg
[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
-~--~~~~--~~--~--~---



Django Forums

2006-09-25 Thread Cerberus

I decided to start up some forums for anyone that wants to join. I know
many like google but these forums might be of use as well.
Thanks.
http://djangoforums.org/index.php


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



Re: What I lost if run django under Python 2.3?

2006-09-25 Thread Malcolm Tredinnick

On Mon, 2006-09-25 at 14:32 -0700, mamcxyz wrote:
> What kind of bugs?
> 
> My main trouble is PIL, simply I don't can install it under CentOS 3...

You originally said you were using CentOS 4, but anyway. PIL works with
Python 2.3, so it's a matter of either finding an RPM or building from
source.

There are python-imaging (the rpm name for PIL) packages for CentOS
available from both http://rpmforge.net/ and http://centos.karan.org/ .
Both sites have a yum config file available.

If they don't work for some reason -- and I cannot imagine why they
wouldn't -- then upgrading to Python 2.4 (your original question) isn't
going to make things any easier or harder. You are going to have to
build PIL from source in both cases.

Cheers,
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
-~--~~~~--~~--~--~---



Re: Tutorial for including content across all pages

2006-09-25 Thread Malcolm Tredinnick

On Thu, 2006-09-21 at 02:43 +, keukaman wrote:
> Is there a tutorial that shows a step-by-step description of how to
> include content from one application in all pages on a site?
> 
> I'm building a site that will have 5 headlines in a "left nav" area of
> the site. Those headlines will carry through all pages. Each headline
> will link to a story in a "news" section. Some of the pages will be
> flatpages.

This is a good place to start:

http://www.b-list.org/weblog/2006/06/07/django-tips-write-better-template-tags

Since template tags can be used in any template (including the base
template for flatpages), you can put the information anywhere. As Rob
mentioned in another reply, template tags are the general solution here.

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



Re: Running Multiple Versions of Django (91 and trunk) on the same machine

2006-09-25 Thread Graham Dumpleton

[EMAIL PROTECTED] wrote:
> I'm trying to run multiple versions of Django on OS X to support
> applications written under different code. After searching ad nauseum,
> I think I'm very close, but I can't get it working. I'd like to be able
> to choose the Django version, either through the development web
> server, or through mod_python.
>
> I pulled the trunk and 91 versions of Django into these folders:
>
> /code/django_91src/
> /code/django_95src/
>
> I put this in my .bash_login:
>
> export PYTHONPATH="/code/django91_src/django"
> export PYTHONBIN="/code/django91_src/django/bin"
> export
> PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:$PYTHONBIN:$PATH"
>
> I can get it to work if I put a symlink called 'django' in my
> site-packages directory (below), but if it's not there, I can't 'import
> django' from the Python shell:
>
> /opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages
>
>
> So here's my question: can I make Django work if I don't have a symlink
> in my site-packages directory? Creating the symlink makes me have to
> choose which version (91 or 95) I want to point to, which seems to
> defeat what I'm trying to do here.
>
> Note: I didn't do a "python setup.py install" from either of the
> versions in /code. That seemed to install the egg to site-packages.
>
> I'm completely frustrated and don't know how to move forward. Any
> advice is extremely appreciated!

When using mod_python, it is possible to associate different parts of
the
URL namespace with different Python interpreter instances. Thus, you
should be able to run two different versions of Django under the one
web
server by hosting them under different URLs and then using the
directive
PythonInterpreter directive to separate them. For each instance, you
will
need to set the PythonPath directive to reference where the different
installations of Django are installed.

For example, something like:


PythonInterpreter django.mysite1
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonPath "['/path/to/project','/path/to/django1'] + sys.path"



PythonInterpreter django.mysite2
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonPath "['/path/to/project','/path/to/django2'] + sys.path"


Because they run in different Python interpreter instances, they
should not interfere with each other and doesn't matter that different
versions of same modules are used by each.

Graham


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



Re: Request member availability in model managers or models

2006-09-25 Thread Malcolm Tredinnick

On Wed, 2006-09-20 at 12:18 -0700, PoBK wrote:
> Hi,
> 
> I've just spent the last few hours looking around Django site, and
> google and the mailing lists for any hints on the following problem.
> 
> I need to implement functionality similar to that of the
> django.contrib.sites module, the difference being that value of what
> would be the SITE_ID setting, needs to be obtained from the current
> session.
> 
> The basic idea is that I would like to automatically filter model
> results based on the contents of a list of elements in the request
> variable. Lets for the purposes of this discussion, call it a
> Container.
> 
> So person browses site, gets assigned a blank list of containers.
> During login the users list of containers gets populated. In terms of
> the existing sites module, this step is the equivalent of setting
> SITE_ID to a list of IDs (yes I'm aware that it would make no sense to
> do so, but I'm saying this in terms of logic, not semantics). Any
> requests for model data then that the user needs to modify or view then
> gets filtered based on the values of this list of containers.
> 
> I'm kind of a newbie to Django. Am I right in thinking the best way to
> accomplish this if it is possible is by using a combination of model
> managers and middleware? Is it at all possible to get any data provided
> by middleware into the managers or are the managers one way elements?

You seem to have a pretty good grasp of what you want to do and how the
logic flow will work. The approach you have outlined is certainly
workable.

The main thing you have to work out is how to pass the necessary
parameters from the user's session (essentially) to the model manager
without doing lots of repetitive or error-prone work.

Models (and their managers) deliberately do not have any connection to
the concept of "current user" or "current view" or "current request
context", since they are independent data holders that can also be used
outside of views.

The suggestion you have received for using some middleware to populate
threadlocals tries to solve this problem by putting the session
information into the variable scope of the model code when you call it
(it appears as part of the thread's "global" variables -- although more
typically, and not just in Python, called thread locals, because it's
local to that particular thread -- so the model and manager code can
access it). The drawback here is that it can restrict the way you can
use that manager method outside of the normal request/view path: if you
want to call it elsewhere, you need to put some of the parameters into
the thread local and then call the manager. Leads to a "push these
parameters onto the shelf over here and then call this method over here"
sort of idiom and can look a bit strange.

The threadlocal solution will work with mod_python: after all,
mod_python is meant to give you a Python environment. If variable
scoping didn't work correctly, it would have to be called
mod_not_really_python. Some debugging I did with Ian Holsman, looking
over some code he had written that used it heavily, a couple of months
back convinced me that the threadlocal solution looked very robust. I
don't (yet) use it myself for anything, but, for what it's worth, I
would recommend it if it suited your purposes.

One alternative is to have a method on your manager that does the
initial filtering and takes a request object or user session object as a
parameter. The drawback of this approach is that you have to remember to
pass in that parameter all the time.

There are possible other ways to do this as well, although none spring
immediately to mind. You just need to decide which of the trade-offs is
more acceptable to you. You need to do some work somewhere, obviously,
and how you intend to use the model code in your application and how
many places you call that manager method from will help you decide which
trade-off will lead to less work.

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



Re: Template inclusion with UTF-8 BOM (bug?)

2006-09-25 Thread Malcolm Tredinnick

On Wed, 2006-09-20 at 02:52 +, Enrico wrote:
> Hi,
> 
> I noticed that when a call a template encoded with UTF-8 with BOM using
> an inclusion tag the BOM gets printed and sometimes can mess with the
> layout.
> 
> It took me some time to find out that the extra BOM's were resulting in
> an extra margin.

You are very unlucky (or there is a rendering bug in your browser). The
BOM should be treated as a *zero width* non breaking space when found in
the middle of a stream like that, so the only way it is going to screw
up the margins is by joining two characters together when there would
otherwise have been a line break in the middle (that is where you have
been very unlucky).

> Maybe the BOM should be kept only on the first (base) template and
> removed from the subsequent ones.

It's recommended to avoid using a BOM with UTF-8 encoded files that are
included into other files for just this reason. If you can fix it at the
source, that would be best. However, I realise there are, for example,
large companies based in the north-western United States who have long
struggled with best practices for Unicode and some of their editors
insist on including this cruft.

File an enhancement ticket request and somebody might want to play with
fixing it. It adds some extra processing to a fairly critical path, but
it's something we can look at in the process of doing the internal
unicode conversion.

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



Re: Template For Loops

2006-09-25 Thread brad

Now I am getting an error of:

Exception Type: TypeError
Exception Value:'tuple' object is not callable
Exception Location: E:\dp1\mysite\..\mysite\urls.py in ?, line 10

And line ten of 'urls.py' is the following:

(r'^select/$', 'mysite.polls.views.select')


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



Primary Key for auth_user is User.__str__() ??

2006-09-25 Thread gkelly

I have the following model and view:

http://pastebin.ca/182428

If I manually edit
/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/auth/models.py
and change User.__str__(self) to return a string like
'TEST'+self.username, then 'testuser' above will become 'TESTtestuser'.

So it appears pk_val is user.username and not user.id?? What's going on
here?


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



Re: Admin site: verbose_name not used in list_display for a foreign key

2006-09-25 Thread Malcolm Tredinnick

On Tue, 2006-09-19 at 20:54 +, gkelly wrote:
> I think this may be a bug (or feature request).
> 
> If I define a ForeignKey field 'my_field' in a class and set
> Meta.list_display = ('my_field','other_field') and Meta.verbose_name =
> 'My Verbose Field'
> 
> then in the Admin site, the heading for 'my_field' doesn't use the
> verbose_name, but rather the python variable name for the ForeignKey
> field.
> I think it should use the verbose_name. Is there a reason it can't?

There are a few reasons it can't/shouldn't behave like that:

Firstly, because it would be inconsistent. All fields take an optional
first positional argument that is the verbose name to use for that
field. This is true for ForeignKey fields just as for all other fields.
If you don't specify that name, it will use the name of the attribute in
the model, just as you are seeing.

Secondly, we can't use the model name by default because you might have
more than one ForeignKey in the model pointing to the other model, so
there would be an immediate name consufion.

Finally, you have named the attribute the way you have for a reason. If
you wanted to name it after the target class, you would have done so, so
we respect the attribute naming choice you made.

If you always want the display name to track the related model's name,
you could probably set it to OtherModel.Meta.verbose_name and it would
work, I suspect, if you want the two to always track each other.

Cheers,
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
-~--~~~~--~~--~--~---



Re: Project Layout When Using Multiple Sites, Revisited

2006-09-25 Thread Scott McCracken

In continuing to diagnose this problem I have re-read the
DJANGO_SETTINGS documentation. Under the section for Default Settings
it says:

"A Django settings file doesn't have to define any settings if it
doesn't need to. Each setting has a sensible default value. These
defaults live in the file django/conf/global_settings.py.

Here's the algorithm Django uses in compiling settings:
* Load settings from global_settings.py.
* Load settings from the specified settings file, overriding
the global settings as necessary."

Is it possible to adjust that algorithm to

* first load settings from the global_settings.py
* second load settings from a common project settings.py
* third load settings from a specific project's settings.py

In other words, is there a way to have another level of settings in
between global and project-level without modifying the django_src.
Thanks again.


Scott McCracken wrote:
> I have a few questions regarding a past topic which is now closed to
> comments after 30 days of inactivity:
> http://groups.google.com/group/django-users/browse_thread/thread/ca0485ca0ce4da56/4cb89ff5aa5dcb5d?lnk=gst=sites=1#4cb89ff5aa5dcb5d
>
> My questions revolve around trying to have multiple sites share a
> common application in a local environment running the django
> development server. Say, for example, I have a project where two sites
> are to share a common blog application. My project structure is as
> follows:
>
> project/
> common/
> settings.py
> blog/
> site1/
> settings.py
> site2/
> settings.py
>
> 1) Is this a logical file structure to ensure both site1 and site2 have
> access to the common/blog application?
>
> 2) Should my common/settings.py file be placed in the global project
> directory so the other settings.py files can inherit global settings?
>
> 3) if site1 and site2 are inheriting global settings, can their
> settings.py files simply contain the variables which are different from
> common such as SITE_ID, COOKIE_NAME, SECRET_KEY and TEMPLATE_DIRS and
> still access all the global settings from common/settings.py?
>
> 4) Should common/settings.py have a SITE_ID defined even though it is
> not a "site" - rather it is a location for common apps and settings.
>
> 5) Can anyone shed some light on how to test the two sites? If i run
> "python manage.py runserver 8081" from /project/site1/ I get an
> excpetion on the site when trying to access the blog: 'No module named
> common.blog.models'
>
> Which means I'm apparently not inheriting the global settings properly.
>
> I'm sorry for the long question and my complete novice approach to all
> of this. I feel like the "django multiple site" lightbulb is just above
> my head, and i need someone to help me reach up and turn it on. Many
> thanks in advance.


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



Re: Django HTML class

2006-09-25 Thread Malcolm Tredinnick

On Mon, 2006-09-18 at 22:08 +, gkelly wrote:
> My apologies if this is in the documentation somewhere, I have not been
> able to find it.
> 
> Is there a django HTML class that I can import in my views? Basically,
> I have a database table with columns for describing an HTML form
> element. So an entry might look like:
> label=Name, type=text, maxlength=64
> 
> and then my view would go through and decide that this should be an
> input field, type text, with max length 64.  There will be entries for
> all sorts of HTML form elements.
> 
> So I am thinking that there has got to be a django class that I can
> utilize rather than having to repeat previous efforts.

No, there isn't anything like this in Django. The places in Django core
that create forms use the default field representation for each model
field and use custom manipulators where they aren't directly tied to
models.

It should be fairly easy to write one of these for your purposes,
though, since each class in django/forms/__init__.py takes virtually
identical arguments to its constructor, so you won't have to right more
than a couple of words of code (say, a dictionary key and value) for
each new type after you get the first one right, I would suspect.

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



Re: Template For Loops

2006-09-25 Thread Alan Green

On 9/26/06, brad <[EMAIL PROTECTED]> wrote:
>
> Hello. I am having a little trouble retreiving data from my models so
> that I can use the data in my templates to create a html select. The
> template creates the html select, but the select is not populated with
> any options, like I want it to. Thanks in advanced for any and all
> ideas to get this template to work. Here's my model:
>
> class Game(models.Model):
> game_name = models.CharField(maxlength=200)
>
> class Admin:
> pass
>
> def __str__(self):
> return self.game_name

Hi Brad,

I think you may be being confused by the class/table property/column
object/relational mapping thing. To start with, the game_name property
would be better called "name", since we already know it belongs to the
Game model class:

class Game(models.Model):
name = models.CharField(maxlength=200)

class Admin:
pass

def __str__(self):
return self.name

When rendering templates, we need to pass them the data they are going
to render. In this case, we want to render a list of Game objects. The
view function must retrieve the game objects and then include that
list in the template's context variables. Cutting and pasting from
http://www.djangoproject.com/documentation/tutorial3/ with a little
renaming and rearranging, gives us:

from django.shortcuts import render_to_response
from yourproj.yourapp.models import Game

def index(request):
games = Game.objects.all().order_by('name')
return render_to_response('games/index.html', {'games': games})

This will render a template named 'games/index.html', putting a list
of games into the template's context, as a variable named 'games'. We
can then loop over this list in the template:



{% for game in games %}
{{ game.name }}
 {% endfor %}



(Notice that I substituted the game.id for the forloop.counter. This
makes it much easier to retrieve the selected game later, not to
mention making the page more resilient to changes in the backing
database)

Hope all that helps,

Alan.

-- 
Alan Green
[EMAIL PROTECTED] - http://bright-green.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
-~--~~~~--~~--~--~---



autoreload files stored on SMB share

2006-09-25 Thread Steve M

Hi,

I have my Django project source files on a SMB share (it is a Linux
file server).

I am running the development server on a different Linux computer,
which has the SMB share mounted (with smbfs).

The autoreload feature causes the server to restart every second
whether or not I have modified the files. If I use the --noreload
option it stops this, but I like autoreload!

I've had a look at the django/utils/autoreload.py and, well, honestly
it would be painful to work out why exactly it is happening and how it
might be fixed. I don't really know the details of how SMB interacts
with file stats.

Anyone know whether my setup is misguided? Or is a fix possible?

Thanks,
Steve


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



A new educational program written in django

2006-09-25 Thread [EMAIL PROTECTED]

I would like to announce a new project based on django. its a
simulation / game used as an aid in teaching a introduction to
broadcast class.


" Philonet is a Multi-player on-line role-playing simulation (MORPG)
of the tensions between art and commerce in electronic media
industries.

Named in honor of Philo T. Farnsworth, Philonet is designed for the
Introduction to Electronic Media Course in the Broadcast and
Electronic Communication Arts Department at San Francisco State
University. In the game, students take on the roles of program
producers, broadcast networks, and cable television networks in a
writing-intensive on-line competition for the audience. Philonet is a
case study of the development of an interactive gaming tool to
facilitate the Introduction to Broadcast and Electronic Communication
Arts Course. "

 - from www.philonet.tv


Some background

I wrote the first version in php as a student of the class just to
help the  teacher move the program onto the web. I was asked to do an
independent study to develop the project into a more useful complete
version. At that time I was unhappy with php as a solution for the
project so I researched alternatives and up came django.

As a part of the whole process we wanted to make the project open
source. I have setup a developers homepage at developer.philonet.tv
and currently I am hosting the repository on google code or untill I
can figure out how to get trac working on my current host.

so come check out the program if you want to help let me know.

Sites of Intrest

Homepage - www.philonet.tv
Developers Page - developer.philonet.tv
Google Code Hosting - http://code.google.com/p/philonet/

thanks

Alex Kessinger
student
Broadcast and Electronic Communication Arts
San Francisco State University

Teacher in charge of independent study

Scott J. Patterson, Ph.D.
Professor
Broadcast and Electronic Communication Arts
San Francisco State University


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



How tune fastcgi for django?

2006-09-25 Thread mamcxyz

I have a Centos 3 server with 128 MB of RAM and a limit of 30
processes... I'm using lighttpd + FastCGI

When I start the server for first time I get 18 process.

When later I need to run some change or restart or something, I get a
error with fork, because the process limit is exhausted.

How calculate the params on process limit so the server get some air?
I'm talking about the "max-procs" =>  params...


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



Looking for models or apps for tutorials

2006-09-25 Thread Milan Andric

Hello,

I'm planning to write something simliar to
http://diveintopython.org/toc/index.html that works with django and the
admin app. I figure I should try to leverage existing code since a
tutorial/documentation application seems pretty typical for
organizations.   Does something like this exist already?  Any hints or
information is appreciated.

Feel free to contact me if you're also working on a similiar django
application.  I'll be writing one, my first django endeavor, over the
next couple of weeks and hope it can be useful for others as well.

--
Milan


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



Confused about generic.create_update

2006-09-25 Thread froke

Please look at http://pastebin.ca/182266 for my code.

I'm trying to extend the User model (by using a ForeignKey) to a
UserProfile.

I have a template with a form to update some of the fields (all except:
user, updated).

When I submit the form, I get the following in errors
(update_object.errors):
'user': ['This field is required.']

 Am I missing something? How can I specify to use the currently logged
in user? If I am updating an existing record, then 'user' should
already exist (the user is logged in and the profile already has an
entry in the user_id field).


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



Re: Extending an existing model?

2006-09-25 Thread Scott McCracken

Sorry for the misunderstanding the first time around!

James Bennett wrote an amazing article about extending Django's
built-in user and authentication system which may be of some help to
you:

http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model

Hope it helps.


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



Re: What I lost if run django under Python 2.3?

2006-09-25 Thread mamcxyz

What kind of bugs?

My main trouble is PIL, simply I don't can install it under CentOS 3...


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



Re: Extending an existing model?

2006-09-25 Thread Edward A. Muller

I don't think I've explained myself well enough.

I'm working on a new app. I need to extend the django.contrib.auth.User model 
to include additional fields. What's the best way to do that? One to One 
relationships? I read http://code.djangoproject.com/wiki/ModelInheritance, 
which is in development... But I need a solution now. It references using one 
to one relationships and also using module_name and remove_fields variables in 
the model's META class 

So I was wondering what everyone else does and what's generally accepted as 
good practice?

- Original Message -
From: Scott McCracken <[EMAIL PROTECTED]>
To: Django users 
Sent: Monday, September 25, 2006 4:07:23 PM GMT-0600
Subject: Re: Extending an existing model?


Edward A. Muller wrote:
> What's the best way to extend an existing model in a new model/app?

Edward, this is a common problem that has a variable solution depending
on your needs. If you don't mind clearing your existing user data, you
can use the reset command on your model:

manage.py reset appname

If your data is important you'll need to use ALTER TABLE statements in
your database. More information can be found in the Django FAQ:

http://www.djangoproject.com/documentation/faq/#if-i-make-changes-to-a-model-how-do-i-update-the-database





-- 
Interlix, LLC
http://interlix.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
-~--~~~~--~~--~--~---



Re: I'm so confused...

2006-09-25 Thread Matt Howell

I'd qualify the above advice with a different POV:

If you're not a web developer, and you are setting up this site for a
real business, you should seriously consider hiring someone with
experience to set up your database and website.  I don't want to dampen
others' encouragement and enthusiasm, but it's easy to underestimate
how "easy" it is to set up a well-designed and functional website if
you have very little experience.

By all means, do the research and see if you can get the hang of it --
but take into consideration that web development is a lot like home
renovation.  It looks easy, but it's something that takes a lot of
education and experience to get good at.  If you have the time to
invest in tackling the learning curve, go for it, but if you have a
real business to run, it'll be cheaper for you in the long run to hire
a pro to do this stuff.


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



Re: I'm so confused...

2006-09-25 Thread charles sibbald
the book from http://www.greenteapress.com/thinkpython/ is the best introduction to python and programming around.The book is free and downloadable, and if you like it buy a copy.I have just about every python book printed by major publishers, and this is the only one that actually teaches you to program and program with pythonthe rest are just a bunch of good references for skilled programmers.iain duncan <[EMAIL PROTECTED]> wrote: On Mon, 2006-25-09 at 20:44 +, [EMAIL PROTECTED] wrote:> Well Iain perhaps I should shut up and try it first!> > I've set up a laptop to try a clean install of python without> corrupting my current webdev setup.If you're willing to try it, more power to you! I'd recommend picking upa copy of "Beginning Python" by Magnus
 Hetland ( Apress ). There arealso very good tutorials on learning python online linked frompython.org.Good luck,Iain		How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.
--~--~-~--~~~---~--~~
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  -~--~~~~--~~--~--~---


Re: show_all_rows = False returns db error message

2006-09-25 Thread Chris Long

Try updating to the latest revision, there was a bug I fixed a few days
ago that was causing this error for a lot of people. If it still
doesn't work, please pastebin your model, and let us know the database
system you are using and the steps taken.

Chris


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



Re: Extending an existing model?

2006-09-25 Thread Scott McCracken

Edward A. Muller wrote:
> What's the best way to extend an existing model in a new model/app?

Edward, this is a common problem that has a variable solution depending
on your needs. If you don't mind clearing your existing user data, you
can use the reset command on your model:

manage.py reset appname

If your data is important you'll need to use ALTER TABLE statements in
your database. More information can be found in the Django FAQ:

http://www.djangoproject.com/documentation/faq/#if-i-make-changes-to-a-model-how-do-i-update-the-database


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



Re: I'm so confused...

2006-09-25 Thread iain duncan

On Mon, 2006-25-09 at 20:44 +, [EMAIL PROTECTED] wrote:
> Well Iain perhaps I should shut up and try it first!
> 
> I've set up a laptop to try a clean install of python without
> corrupting my current webdev setup.

If you're willing to try it, more power to you! I'd recommend picking up
a copy of "Beginning Python" by Magnus Hetland ( Apress ). There are
also very good tutorials on learning python online linked from
python.org.

Good luck,
Iain




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



Re: I'm so confused...

2006-09-25 Thread Julio Nobrega

  Ok Steven :)

  First of all, Django is not a "command line language". Django is a
framework, a collection of practices and codes and data and functions
that facilitate web development.

  Python is the programming language. It's what we use to open files,
loop, add numbers, etc...

  It's a *very* good idea to learn some Python, the basics, before using Django.

  What you see in the tutorials and the examples related to "command
line", or things that look like you can type on a command prompt, it
is because Python has a "shell", an interpreter for your commands. You
got one when you installed Python on Windows XP. At this place, you
can type Python commands, for example, to "import modules". A module
is a collection of code, data, functions and classes to organize your
stuff.

  See the relation between modules and frameworks? Basically, Django
is a series of Python modules oriented for certain things (web dev).
There's a bunch of different Python modules, some came with your
Python installation, to manipulate files, urls, or math, and a lot you
can download from the net, to use graphics, DirectX, audio files,
etc... anything a programming language can do.

  To develop with Django, the minimal thing you need is just Python
installed. Search Google for the "python sqlite module" (a collection
of code to manipulate sqlite databases), and install that. Then,
follow Django's tutorial very closely, and search the net for more
Django + Windows XP tips. And use Django's development web server!

  There's a reason why you pay thousands for people like me to do this
stuff, buahahhhah! :) just kidding. It's not hard, but you need to be
committed, and learn 2 programming languages, Javascript and Python,
plus HTML.

On 9/25/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Ok,
>
> I decided that I don't want to spend $1,000s on other people coding my
> databases etc so I thought Django looked pretty good. I read some of
> the code and it seems pretty intuitive (with a lot of hard work!)
>
> Now my problem is understanding just what the hell is being said in all
> these setup tutorials.
> Am I right that Django is a command line based language?
>
> This might seem a bit silly to you all but I like environments such as
> dreamweaver with GUIs and options.
>
> I have a XAMPP based web server on my WinXP system which is nicely
> configured to serve sites via Virtual Hosts. It took me a good few
> hours to configure that!
>
> I followed several howtos on setting up django but with no success.
> Python Paths? WTF?
>
> I've been here for hours downloading python 2.4, apache2triad and other
> stuff to try and get it to work.
>
> Anyway I'd appreciate know exactly the steps needed with some decent
> examples on how to set a development server with Django in mind. It
> looks great and I want to develop for it!
>
> Perhaps someone can create a series of videos showing a WinXP setup of
> Django?
>
> Thank you all for your help and patience!
>
>
> >
>


-- 
Julio Nobrega - http://www.inerciasensorial.com.br

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



Project Layout When Using Multiple Sites, Revisited

2006-09-25 Thread Scott McCracken

I have a few questions regarding a past topic which is now closed to
comments after 30 days of inactivity:
http://groups.google.com/group/django-users/browse_thread/thread/ca0485ca0ce4da56/4cb89ff5aa5dcb5d?lnk=gst=sites=1#4cb89ff5aa5dcb5d

My questions revolve around trying to have multiple sites share a
common application in a local environment running the django
development server. Say, for example, I have a project where two sites
are to share a common blog application. My project structure is as
follows:

project/
common/
settings.py
blog/
site1/
settings.py
site2/
settings.py

1) Is this a logical file structure to ensure both site1 and site2 have
access to the common/blog application?

2) Should my common/settings.py file be placed in the global project
directory so the other settings.py files can inherit global settings?

3) if site1 and site2 are inheriting global settings, can their
settings.py files simply contain the variables which are different from
common such as SITE_ID, COOKIE_NAME, SECRET_KEY and TEMPLATE_DIRS and
still access all the global settings from common/settings.py?

4) Should common/settings.py have a SITE_ID defined even though it is
not a "site" - rather it is a location for common apps and settings.

5) Can anyone shed some light on how to test the two sites? If i run
"python manage.py runserver 8081" from /project/site1/ I get an
excpetion on the site when trying to access the blog: 'No module named
common.blog.models'

Which means I'm apparently not inheriting the global settings properly.

I'm sorry for the long question and my complete novice approach to all
of this. I feel like the "django multiple site" lightbulb is just above
my head, and i need someone to help me reach up and turn it on. Many
thanks in advance.


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



Re: I'm so confused...

2006-09-25 Thread iain duncan

On Mon, 2006-25-09 at 20:20 +, [EMAIL PROTECTED] wrote:
> Ok,
> 
> I decided that I don't want to spend $1,000s on other people coding my
> databases etc so I thought Django looked pretty good. I read some of
> the code and it seems pretty intuitive (with a lot of hard work!)
> 
> Now my problem is understanding just what the hell is being said in all
> these setup tutorials.
> Am I right that Django is a command line based language?
> 
> This might seem a bit silly to you all but I like environments such as
> dreamweaver with GUIs and options.

I don't think you're looking for Django then. You might have better luck
with something like Drupal for PHP, or buy Ellington from the Django
guys. Django is a very powerful framework *for programming in python*.
It does assume a fair bit of programming experience and is not at all a
gui tool.

Iain


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



Re: I'm so confused...

2006-09-25 Thread charles sibbald
Here is a brilliant intro to Djangohttp://www-128.ibm.com/developerworks/linux/library/l-django/?ca=dgr-btw01DjangoAndPythonand here is a brilliant intro to pythonhttp://www.greenteapress.com/thinkpython/"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Ok,I decided that I don't want to spend $1,000s on other people coding mydatabases etc so I thought Django looked pretty good. I read some ofthe code and it seems pretty intuitive (with a lot of hard work!)Now my problem is understanding just what the hell is being said in allthese setup tutorials.Am I right that Django is a command line based language?This might seem a bit silly to you all but I like environments such asdreamweaver with GUIs and options.I have a XAMPP based web server on my WinXP
 system which is nicelyconfigured to serve sites via Virtual Hosts. It took me a good fewhours to configure that!I followed several howtos on setting up django but with no success.Python Paths? WTF?I've been here for hours downloading python 2.4, apache2triad and otherstuff to try and get it to work.Anyway I'd appreciate know exactly the steps needed with some decentexamples on how to set a development server with Django in mind. Itlooks great and I want to develop for it!Perhaps someone can create a series of videos showing a WinXP setup ofDjango?Thank you all for your help and patience!	
		Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business.

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


Re: Python based syntax highlighter for HTML?

2006-09-25 Thread Rob Hudson

Hmmm...  I wonder how hard it would be to create a template filter for
Django using SilverCity.  It looks like SilverCity is the preferred
highlighter for Trac:
http://trac.edgewall.org/wiki/TracSyntaxColoring

Though you say you've heard bad things.  I'll have to do some deeper
digging.

Thanks,
Rob


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



I'm so confused...

2006-09-25 Thread [EMAIL PROTECTED]

Ok,

I decided that I don't want to spend $1,000s on other people coding my
databases etc so I thought Django looked pretty good. I read some of
the code and it seems pretty intuitive (with a lot of hard work!)

Now my problem is understanding just what the hell is being said in all
these setup tutorials.
Am I right that Django is a command line based language?

This might seem a bit silly to you all but I like environments such as
dreamweaver with GUIs and options.

I have a XAMPP based web server on my WinXP system which is nicely
configured to serve sites via Virtual Hosts. It took me a good few
hours to configure that!

I followed several howtos on setting up django but with no success.
Python Paths? WTF?

I've been here for hours downloading python 2.4, apache2triad and other
stuff to try and get it to work.

Anyway I'd appreciate know exactly the steps needed with some decent
examples on how to set a development server with Django in mind. It
looks great and I want to develop for it!

Perhaps someone can create a series of videos showing a WinXP setup of
Django?

Thank you all for your help and patience!


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



Re: Fast hosting for Django

2006-09-25 Thread ian

David Sissitka wrote:
> In case anyone is wondering, that is Remi from WebFaction, and that's 
> also why I am a WebFaction customer. :)
>
> On 9/25/06, *Remi* < [EMAIL PROTECTED] > wrote:
>
>
> Just a few comments about WebFaction.
>
> > I am a WebFaction customer, definitely not a bad company. A few
> thoughts
> > about WebFaction:
> >
> > 1) It's a one man show, at least, support is.
>
> WebFaction started with just 3 people but we're growing quite rapidly
> right now so expect to see more people soon :)
>
> > Support ticket response times
> > are anywhere from three hours to a day and a half.
>
> We aim to respond within a few minutes or hours (depending on how
> urgent the ticket is), and always within 24 hours. If a ticket took a
> day and a half to get answered it was a mistake on our part and should
> never happen.
>
> > 2) The control panel may be appealing but it is definitely
> flawed. It
> > supports Firefox and Internet Explorer, but things are pretty
> slow with
> > Opera. Their long running process monitoring (You're allowed one
> long
> > running process at $14.50 USD a month.) is pretty bad as well,
> stopping and
> > restarting your Apache instance leaves orphaned processes that you
> > cannot monitor or kill off yourself.
>
> I think you're talking about our control panel not killing the
> processes for you when you delete an application from the control
> panel, I just fixed that bug today :)
>
> A couple more things:
> I can't tell for sure but I'd say that we're probably one of the hosts
> with the most Django sites right now (we host more than 200 of them).
> By gaining some experience from all these sites we've been able to
> eliminate pretty much all problems (like the libexpat version mismatch
> that was causing Apache to crash sometimes) and fine tune our setup.
> I think that we now have one of the best setup for shared hosting: we
> give each site their own Apache2/mod_python instance proxied
> behind our
> main Apache server. This gives them maximum flexibility to start/stop
> their Apache server on their own and edit their httpd.conf file as
> they
> want.
> But we also configure our main Apache server to serve static data
> (images, stylesheets, ...) directly, for maximum speed (this frees
> each
> site's Apache2/mod_python instance from having to serve all those
> little requests).
>
> Remi.
>
>
>
>
> >
Mmm...i am thinking about parting with some hard earned too
[]'s


-- 
Ian Lawrence
Centre for Bioinformatics
INSTITUTO NACIONAL DE PESQUISAS DA AMAZÔNIA – INPA
RUA ANDRÉ ARAÚJO N º .2936 – BAIRRO DO ALEIXO
MANAUS-AMAZONAS-BRAZIL
PPBio – Research Program in Biodiversity
http://ppbio.inpa.gov.br
PHONE: 055-92-3643-3358
CEP. 69011 -970

| Please do not send me documents in a closed
| format.(*.doc,*.xls,*.ppt)
| Use the open alternatives. (*.pdf,*.html,*.txt)
http://www.gnu.org/philosophy/no-word-attachments.html

"We are all in the gutter, but some of us are looking at the stars."


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



Re: Help me see the big picture

2006-09-25 Thread Jay Parlar

On 9/19/06, trond <[EMAIL PROTECTED]> wrote:
>
> I first read about Django 3 days ago. Now I try to make myself a blog.
>
> I want to show data from different apps and sql-tables on the same
> page. My frontpage should show a blog, my friends birthdays and qoutes.
> With Generic-views I have made a simple blog, but on the same page, I
> want to show my friends birthdays. I have read tutorials on making
> different things, but how can I put the data together? In the view or
> in the template?
>
> Can I use generic views to fetch in example three different list of
> objects at the same time, sending this to the template? Or is it
> possible to put together templates containing data like this
> psaudo-code:
>
> 
> include blog/ 
> include friends/
> include qoutes/
> 
>
> Sorry for my stupid english.


Your English is fine!

What you want is template tags,
http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-tags

and template inheritance.

That way, you could do something like this in a base template:

 {% block content %}{% endblock %} 
 {% friends_birthdays %} 
 {% quotes %} 

and in some inherited template (say, specific to your blog), you could do:

{% block content %}
Blog stuff here
{% endblock %}

For some examples, you can look at the source code of awwca.ca, found
at: http://svn.jayparlar.com/website/trunk/awwca/

Here, I have a templates/base.html which defines the base template. I
also have templatetags created in articles/templatetags and
events/templatetags

Jay P.

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



Re: Template For Loops

2006-09-25 Thread Rob Hudson

In your view are you passing game_name into the template context?

For more info:
http://www.djangoproject.com/documentation/templates_python/


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



A general place for a request.POST handler across all pages?

2006-09-25 Thread Rob Hudson

I'm building an app that is going to have many types of forms for user 
data (think surveys, little questions here and there, hidden forms, etc.)

What I'd like to do is come up with a naming scheme for the field names 
so I can place a request.POST handler in one place that can parse the 
field name and know where to save the user data.

I'm thinking this might lead towards a Middleware component but I wanted 
to ask the collective intelligence on the best place/way to implement this.

Thanks,
Rob

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



Template For Loops

2006-09-25 Thread brad

Hello. I am having a little trouble retreiving data from my models so
that I can use the data in my templates to create a html select. The
template creates the html select, but the select is not populated with
any options, like I want it to. Thanks in advanced for any and all
ideas to get this template to work. Here's my model:

class Game(models.Model):
game_name = models.CharField(maxlength=200)

class Admin:
pass

def __str__(self):
return self.game_name


And here's part of my template:



{% for name in game_name %}
{{ name }}
 {% endfor %}




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



Re: Running Multiple Versions of Django (91 and trunk) on the same machine

2006-09-25 Thread Maximillian Dornseif

To test different versions of Python packages I usually use a
brute-force approach: HAving 2 complete python installations. On a  Mac
there is  one default python  2.3 installation at /usr/bin/python.
Since I prefer 2.4 I have used Darwinpoorts  to install a second Python
Instance living at /opt/local/bin/python.

When installing packages I can choose where to install them by
selecting the python interpreter.
/opt/local/bin/python setup.py install
installs packages to /opt/local/lib/python2.4/site-packages/ while
/usr/bin/python setup.py install
installs packages to
/Library/Frameworks/Python.framework/Libraries/python2.4/
site-packages/

I have used this to install Django 0.91 and Django  current and by
calling
/opt/local/bin/python manage.py runserver
or 
/usr/bin/python manage.py runserver
I can choose which one to use.


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



[OT] Python based syntax highlighter for HTML?

2006-09-25 Thread Rob Hudson

Geshi is written in PHP... Is there a Python equivalent?
http://geshi.org/


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



unique argumennt for models.BooleanField

2006-09-25 Thread david83

Hi,

"unique=True" for models.BooleanField do not return error in admin
interface.

Any idea ?

David


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



Re: Fast hosting for Django

2006-09-25 Thread David Sissitka
In case anyone is wondering, that is Remi from WebFaction, and that's also why I am a WebFaction customer. :)On 9/25/06, Remi <
[EMAIL PROTECTED]> wrote:
Just a few comments about WebFaction.> I am a WebFaction customer, definitely not a bad company. A few thoughts> about WebFaction:>> 1) It's a one man show, at least, support is.
WebFaction started with just 3 people but we're growing quite rapidlyright now so expect to see more people soon :)> Support ticket response times> are anywhere from three hours to a day and a half.
We aim to respond within a few minutes or hours (depending on howurgent the ticket is), and always within 24 hours. If a ticket took aday and a half to get answered it was a mistake on our part and shouldnever happen.
> 2) The control panel may be appealing but it is definitely flawed. It> supports Firefox and Internet Explorer, but things are pretty slow with> Opera. Their long running process monitoring (You're allowed one long
> running process at $14.50 USD a month.) is pretty bad as well, stopping and> restarting your Apache instance leaves orphaned processes that you> cannot monitor or kill off yourself.I think you're talking about our control panel not killing the
processes for you when you delete an application from the controlpanel, I just fixed that bug today :)A couple more things:I can't tell for sure but I'd say that we're probably one of the hostswith the most Django sites right now (we host more than 200 of them).
By gaining some experience from all these sites we've been able toeliminate pretty much all problems (like the libexpat version mismatchthat was causing Apache to crash sometimes) and fine tune our setup.I think that we now have one of the best setup for shared hosting: we
give each site their own Apache2/mod_python instance proxied behind ourmain Apache server. This gives them maximum flexibility to start/stoptheir Apache server on their own and edit their httpd.conf file as they
want.But we also configure our main Apache server to serve static data(images, stylesheets, ...) directly, for maximum speed (this frees eachsite's Apache2/mod_python instance from having to serve all those
little requests).Remi.

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


Re: Unknown column error when I add a field

2006-09-25 Thread Tool69

Thanks to all,
I'm sorry for the late, but I cannot see my post before.
I solved the problem with your help,
see you,
6TooL9


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



Re: show_all_rows = False returns db error message

2006-09-25 Thread Jay Parlar

On 9/20/06, schotm <[EMAIL PROTECTED]> wrote:
>
> Hi i am trying to use the RowLevelPermissions and after creating the
> table(using syncdb) i set show_all_rows = False this resulted in the
> follow message:
>
> "Database error
>
> Something's wrong with your database installation. Make sure the
> appropriate database tables have been created, and make sure the
> database is readable by the appropriate user."
>
> Does anyone know what is going on?

That's a fairly generic error. You need to give us your model
definitions if there's any chance of debugging.

Jay P.

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



Re: Tutorial for including content across all pages

2006-09-25 Thread Rob Hudson

I think what you want is this:
http://www.djangoproject.com/documentation/templates_python/#writing-custom-template-tags


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



Re: Login crazyness...

2006-09-25 Thread Karen Tracey

John M wrote:
>  I'm not passing anything into my
> templatles except ... whatever the Render_to_Response
> does.  ...

You need to pass a RequestContext as the 2nd argument to
render_to_response.  See:

http://www.djangoproject.com/documentation/templates_python/

(Search for RequestContext, it's down a little ways.)  You pass in the
request object when you create the RequestContext, and the auth
processor takes care of populating the template context with the "user"
variable.  Then your check for user.is_authenticated should work.

> >And you've got > django.core.context_processors.auth in your 
> >TEMPLATE_CONTEXT_PROCESSORS setting?
>
> Hmm, don't see that in my settings file, what would I look for?  I see
> it's supposed to be default in the file, but don't see it in mine.
>

If you have no TEMPLATE_CONTEXT_PROCESSORS setting in your settings.py,
then that's probably fine, since the auth processor is part of the
default setting.

> I'm running 0.95 build from the download, not SVN

I use SVN but the doc I'm looking at says .95 and up, so that should be
fine.

Hope this helps,
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
-~--~~~~--~~--~--~---



Re: MacPorts package

2006-09-25 Thread Jay Parlar

On 9/26/06, Jon Atkinson <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I was wondering if anyone had done any work towards packaging Django
> for Macports (http://www.macports.org/, formerly DarwinPorts). I'm
> intending to start building a package, but I don't want to duplicate
> effort if anyone else is working on it. A google search didn't yield
> anything, so I assume it's safe to start from scratch, but if I am
> jumping the gun, please let me know.
>

Most of us just install "from scratch", I think. It's just an svn
away, and the system is installed.

Although a Macports version would be nice for some of the dependencies
(MySQL and PostgreSQL bindings, etc.) There was a thread a few days
ago about peoples' issues with getting installed on OS X, and Macports
could certainly help out the people who aren't familiar with UNIX.

Jay P.

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



Re: automatically fill in some fields of a form, storing authenticated user

2006-09-25 Thread Holger Schurig

> I think ajax tech will very suit for these things. Because you

Recently there where browser exploits that utilized JavaScript. 
So it *CAN* happen that some people will turn JavaScript off. In 
this case your Ajax method doesn't work anymore.

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



Re: Errors in model validation

2006-09-25 Thread [EMAIL PROTECTED]

You can disregard this thread.

This was a problem of circular references that i fixed over the weekend
(before the message was moderated) by passing the ForeignKey the string
of the Model name instead of the object (as per Django documentation!)

Also please disregard other messages like these (same content. similar
subject) as i had a problem with the Google Groups spamfilter that was
blocking me and attempted to send the same message from other email
addresses.

I apologize for the mess.

Lorenzo


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



Re: Login crazyness...

2006-09-25 Thread John M

Thanks for the feedback...

Karen Tracey wrote:
> Shots in the dark -- you are passing a RequestContext, not a regular
> old Context, into your main template?

Karen how would I know that?  I'm not passing anything into my
templatles except the call by except whatever the Render_to_Response
does.  Now that you mention it, I was  using generic views before and
it seemed to work, and I missing something when i switched to RtR?

>And you've got > django.core.context_processors.auth in your 
>TEMPLATE_CONTEXT_PROCESSORS setting?

Hmm, don't see that in my settings file, what would I look for?  I see
it's supposed to be default in the file, but don't see it in mine.

I'm running 0.95 build from the download, not SVN


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



Re: Unknown column error when I add a field

2006-09-25 Thread Andy Dustman
On 9/20/06, Tool69 <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I'm totally new to django, I've made a little blog application and my
> original template is like this one:
>
> class News(models.Model):
> title = models.CharField(maxlength=255, verbose_name="Titre du
> billet")
> text = models.TextField(verbose_name="Contenu")
> keywords = models.CharField(maxlength=255, verbose_name="Mots
> clés")
> date = models.DateTimeField(verbose_name="Date de publication")
> etc.
>
> All is getting well but now (runnin it with MySQL on WebFaction), I
> wanted to stick an image with each post, so I added that field to my
> News class :
>
> post_image = models.ImageField(upload_to='entetes/', blank=True,
> help_text="Doit etre de 300px de large")
>
> But now, I received an error message saying :
> (1054, "Unknown column 'news_news.supplementary_image' in 'field
> list'")
>
> What's going wrong ?

You'll need to hand-update your table schema. If you run:

./manage.py sql appname

it willl print the new schema. Then you can run:

./manage.py dbshell

and then do:

alter table news.news add [new column definition goes here];

Alternatively, you can dump that table, DROP it, use manage.py syncdb
to re-create it, and then reload the dumped table (minus schema). I
usually use alter table.

I think there are plans to have Django modify existing schemas when
the models change, but it's not implemented yet.
-- 
This message has been scanned for memes and
dangerous content by MindScanner, and is
believed to be unclean.

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



Re: Unknown column error when I add a field

2006-09-25 Thread James Bennett

On 9/20/06, Tool69 <[EMAIL PROTECTED]> wrote:
> But now, I received an error message saying :
> (1054, "Unknown column 'news_news.supplementary_image' in 'field
> list'")

When you change your model, you also have to make changes to your
database to correspond. Django does not currently offer any automatic
facility for this, so you will need to manually write and execute the
appropriate ALTER TABLE statement(s).

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

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



Re: Unknown column error when I add a field

2006-09-25 Thread James Punteney

When you add a new field to a model you currently have to manually add
the field to the database as well.

With webfaction this is easiest to do by using the MysqlAdmin through
their control panel. If you aren't sure what type of field it needs to
be you can run the manage.py sql to get an output of the create table
statements from which you can determine the type of field and other
parameters.

--James


On 9/20/06, Tool69 <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I'm totally new to django, I've made a little blog application and my
> original template is like this one:
>
> class News(models.Model):
> title = models.CharField(maxlength=255, verbose_name="Titre du
> billet")
> text = models.TextField(verbose_name="Contenu")
> keywords = models.CharField(maxlength=255, verbose_name="Mots
> clés")
> date = models.DateTimeField(verbose_name="Date de publication")
> etc.
>
> All is getting well but now (runnin it with MySQL on WebFaction), I
> wanted to stick an image with each post, so I added that field to my
> News class :
>
> post_image = models.ImageField(upload_to='entetes/', blank=True,
> help_text="Doit etre de 300px de large")
>
> But now, I received an error message saying :
> (1054, "Unknown column 'news_news.supplementary_image' in 'field
> list'")
>
> What's going wrong ?
> Thanks a lot :
> 6TooL9
>
>
> >
>

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



Running Multiple Versions of Django (91 and trunk) on the same machine

2006-09-25 Thread [EMAIL PROTECTED]

I'm trying to run multiple versions of Django on OS X to support
applications written under different code. After searching ad nauseum,
I think I'm very close, but I can't get it working. I'd like to be able
to choose the Django version, either through the development web
server, or through mod_python.

I pulled the trunk and 91 versions of Django into these folders:

/code/django_91src/
/code/django_95src/

I put this in my .bash_login:

export PYTHONPATH="/code/django91_src/django"
export PYTHONBIN="/code/django91_src/django/bin"
export
PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:$PYTHONBIN:$PATH"

I can get it to work if I put a symlink called 'django' in my
site-packages directory (below), but if it's not there, I can't 'import
django' from the Python shell:

/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages


So here's my question: can I make Django work if I don't have a symlink
in my site-packages directory? Creating the symlink makes me have to
choose which version (91 or 95) I want to point to, which seems to
defeat what I'm trying to do here.

Note: I didn't do a "python setup.py install" from either of the
versions in /code. That seemed to install the egg to site-packages.

I'm completely frustrated and don't know how to move forward. Any
advice is extremely appreciated!


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



Error always when deleting objects with ManyToMany (self) relationships

2006-09-25 Thread zenx

Hi,
I get always the following error when deleting objects with
ManyToMany(self) relationships in the admin. Have tried with different
models and always getting the same error. Doesn't the admin interface
support ManyToMany relationships with the same table?

TypeError at /admin/person/person/2/delete/
getattr(): attribute name must be string

This is the model:
=

class Person(models.Model):
name = models.CharField(maxlength=20)
friends = models.ManyToManyField('self',blank=True)
idols = models.ManyToManyField('self', symmetrical=False,
related_name='stalkers',blank=True)

def __str__(self):
return self.name

class Admin:
pass


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



validator_list with checkboxes

2006-09-25 Thread simon101

My first post, so hi everybody.

I have a model that has a checkbox field called storage_Required.  The
field has a custom generator defined  in the validator_list parameter.
The validator needs to be  run whenever the form is submitted, whether
the checkbox is ticked or not.   Unfortunately the validator is  only
run when the checkbox is ticked.   I have tried defining the
always_test parameter to true, but this doesn't seem to work for
checkboxes, although it works fine for other types of field.  Relevant
code is posted below:


class Order(models.Model):

def stor_valid(field_data, new_data):
..  code here
stor_valid.always_test = True

storage_Required = models.BooleanField(null='true', validator_list
= [stor_valid])

Has anyone else encountered this problem?  If so is there a ticket
outstanding with a patch available, or am I just missing something
really stupid here?

Thx in advance for any help.

Simon


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



Interesting experiment with fcgi, apache2 and django-0.95

2006-09-25 Thread Art Vodolazsky

Hi to all!

Experiment is to create online realtime game with flash+ajax on the
client side and something like web service based on django (django is
used for example because of its good python ORM) on the server side.
Now its just experiment and is on the tech testing stage =)
So, we start small app with one viewer that increments one param and
have no models. Django has session and auth apps installed. Everything
works in the single fcgi process with apache2 redirecting:
./manage.py runfcgi method=threaded socket=/home/user/mysite.sock
pidfile=django.pid
So we make one client and 1000 async requests
Timing is good (about 15 msec)
Then we start 10 threads with one client in each thread. Then 5.
Request timing grows linear. And it is rather strange. So, questions:
How many threads are started with "manage.py runfcgi method=threaded"
by default?
Any other thoughts how to increase performance of this system?

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



Validation models error

2006-09-25 Thread [EMAIL PROTECTED]

Hi there,

I have a problem with a project (svn repo below) and i tried everything
to fix it. Probably u guys can help. It seems to me some problem with
namespace import, particularly the *order* in which the names are
imported.

The code in the repo is already broken but u can "fix it" by commenting
the parts that import or use the Department model (though that's not
what i want).

And this is just the minimum to repro the problem... it actually gets
worse when i try to add more models (probably i'm just repeating the
same mistake). Could it be that it's a problem of circular references?

What looks especially funny to me is that "liger.people: cannot import
name Person" since the Person model is defined inside liger.people.

Source code here:
http://lorenzo.textdriven.com/svn/svn.djangoliger

C:\www\liger>python manage.py validate
liger.courses: cannot import name Major
liger.people: cannot import name Person
liger.time: cannot import name Person
liger.departments: cannot import name Department
4 errors found.

Thanks!

--
P.S To the moderators: sorry i had to change the name and email and the
post a little bit because i tried posting 3 times and i always get
caught in the Google Groups spamfilter for some reason. I tried with
all my emails but probably since they contain my name/surname they are
flagged. I can't even sign this msg with my name because i'm afraid it
will fall in Google's trap again.


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



Admin site: verbose_name not used in list_display for a foreign key

2006-09-25 Thread gkelly

I think this may be a bug (or feature request).

If I define a ForeignKey field 'my_field' in a class and set
Meta.list_display = ('my_field','other_field') and Meta.verbose_name =
'My Verbose Field'

then in the Admin site, the heading for 'my_field' doesn't use the
verbose_name, but rather the python variable name for the ForeignKey
field.
I think it should use the verbose_name. Is there a reason it can't?

Thanks,
Grant


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



error when deleting model with ManyToManyField

2006-09-25 Thread zenx

TypeError at /admin/artistas/artista/asdf/delete/
getattr(): attribute name must be string

this is the many to many field. when I delete it from the model
everything works well but when that field is in the model i get the
type error.

artistas_relacionados =
models.ManyToManyField('self',blank=True,related_name='artistas_rel')

Any ideas why this can be?

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



Login form on every page, and dealing with test cookie

2006-09-25 Thread Cashman Andrus

I'm building a site with a username/password login form on ever page.
(You know, up in the top right corner, and the form gets replaced with
"Welcome username, options, logout" links when logged in.)  Pretty
straightforward, except for an issue with test cookies.

When using this embedded form, instead of logging right in, the user
gets bounced to the regular login page, with a "username/password
didn't match" message.  However, hitting the login button there works
fine, even without reentering any info.  Confusing and annoying.

So, based on my reading of the contrib.auth code, here's how auth login
is supposed to work:

1. User requests the login form URL, which triggers the view
django.contrib.auth.views.login
2. Since there are no REQUEST variables, this view calls
set_test_cookie() and renders the blank form
3. User fills in the form with username and password, and submits it
back to django.contrib.auth.views.login
4. Since there are now REQUEST variables, it runs the
AuthenticationForm manipulator, which checks two things:
 a) that username/password match and denote an active user
 b) that cookies are turned on, via test_cookie_worked()
5. If _both_ of these tests are passed, then the user is logged in and
the test cookie is deleted.  If either test fails, it redirects to the
login form, which again sets the test cookie and asks for
username/password

So, the problem with my login form on every page is that it doesn't
work if the user hasn't visited the regular login URL, because the test
cookie won't have been set.  It seems like the easy way to resolve this
is to set the test cookie on every page.  (Or at least every page where
not is_authenticated. )

What's the best way to do that?  I would guess a middleware, but is
there a better way to call set_test_cookie for every request?

Alternatively, a cleaner but more involved way to handle this case
would be to patch the auth.login process to do a double redirect after
checking the username/password.  That way, anonymous users wouldn't get
cookies set unnecessarily, and one could log in from a saved page even
after clearing cookies.

Anyone else confronted this problem?  I've found several docs, posts
and messages talking about login forms on every site, but none that
point to test cookies as a problem...

Thanks!

   -cashman


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



Errors in model validation

2006-09-25 Thread Lorenzo Bolognini

Hi all,

I have a problem with the app below (SVN repo with read access) and i
tried everything to fix it. Probably u guys can help. It seems to me
some problem with namespace import, particularly the *order* in which
the names are imported.

The code in the repo is already broken but u can "fix it" by commenting
the parts that import or use the Department model (though that's not
what i want).

And this is just the minimum to repro the problem... it actually gets
worse when i try to add more models (probably i'm just repeating the
same mistake).

What looks especially funny to me is that "liger.people: cannot import
name Person" since the Person model is defined inside liger.people.

Source code here:
http://lorenzo.textdriven.com/svn/svn.djangoliger

C:\www\liger>python manage.py validate
liger.courses: cannot import name Major
liger.people: cannot import name Person
liger.time: cannot import name Person
liger.departments: cannot import name Department
4 errors found.

Thanks,
Lorenzo


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



show_all_rows = False returns db error message

2006-09-25 Thread schotm

Hi i am trying to use the RowLevelPermissions and after creating the
table(using syncdb) i set show_all_rows = False this resulted in the
follow message:

"Database error

Something's wrong with your database installation. Make sure the
appropriate database tables have been created, and make sure the
database is readable by the appropriate user."

Does anyone know what is going on?
thanks,
schotm


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



Request member availability in model managers or models

2006-09-25 Thread PoBK

Hi,

I've just spent the last few hours looking around Django site, and
google and the mailing lists for any hints on the following problem.

I need to implement functionality similar to that of the
django.contrib.sites module, the difference being that value of what
would be the SITE_ID setting, needs to be obtained from the current
session.

The basic idea is that I would like to automatically filter model
results based on the contents of a list of elements in the request
variable. Lets for the purposes of this discussion, call it a
Container.

So person browses site, gets assigned a blank list of containers.
During login the users list of containers gets populated. In terms of
the existing sites module, this step is the equivalent of setting
SITE_ID to a list of IDs (yes I'm aware that it would make no sense to
do so, but I'm saying this in terms of logic, not semantics). Any
requests for model data then that the user needs to modify or view then
gets filtered based on the values of this list of containers.

I'm kind of a newbie to Django. Am I right in thinking the best way to
accomplish this if it is possible is by using a combination of model
managers and middleware? Is it at all possible to get any data provided
by middleware into the managers or are the managers one way elements?

I've found some hints on this usergroup which involve middleware that
writes to threadlocal elements that looked promising, but I don't know
if this will work with mod_python or not. Will this work, or does this
sound like a Django Faux Pax?

Any advice would be appreciated and may carry beertokens redeemable on
an Island in the Mediterranean.


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



QuerySet filters & AJAX

2006-09-25 Thread Robert

Hi,

I've managed to implement the Changelist class from the Admin in my own
view.
I needed to get the list_filter in my own view. Changed filters display
from lists to selects. Now I have my model listed in a table, and can
sort/filter by some
records.

I also implemented a jumpTo() javascript, so when selecting from the
list above
my table I get results sorted without any submit buttton need.


The problem is that one of my fields is a ForeignKey to another model,
and there are few thousands of records which means my  field
is huge...

For adding new record I've used a great
http://code.djangoproject.com/wiki/AJAXWidgetComboBox tutorial.. but I
have no idea how / if this widget
can be used for objects filtering when representing more results from
my model. Simply how to merge it with: Changelist()  class from Admin.


I'm fairly new to ajax/python technology.

My filters.html:

{% filter cl cl.filter_specs.0 %}
{% filter cl cl.filter_specs.2 %}
{% filter cl cl.filter_specs.3 %}
{% comment %}Below need to be AJAX'ed{% endcomment %}
{% filter cl cl.filter_specs.4 %}
{% filter cl cl.filter_specs.5 %}



filter.html:
{% for choice in choices %}
{{
choice.display|escape}}

{% endfor %}

Please help,

Thanks,
Robert


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



Help me see the big picture

2006-09-25 Thread trond

I first read about Django 3 days ago. Now I try to make myself a blog.

I want to show data from different apps and sql-tables on the same
page. My frontpage should show a blog, my friends birthdays and qoutes.
With Generic-views I have made a simple blog, but on the same page, I
want to show my friends birthdays. I have read tutorials on making
different things, but how can I put the data together? In the view or
in the template?

Can I use generic views to fetch in example three different list of
objects at the same time, sending this to the template? Or is it
possible to put together templates containing data like this
psaudo-code:


include blog/ 
include friends/
include qoutes/


Sorry for my stupid english.


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



Django HTML class

2006-09-25 Thread gkelly

My apologies if this is in the documentation somewhere, I have not been
able to find it.

Is there a django HTML class that I can import in my views? Basically,
I have a database table with columns for describing an HTML form
element. So an entry might look like:
label=Name, type=text, maxlength=64

and then my view would go through and decide that this should be an
input field, type text, with max length 64.  There will be entries for
all sorts of HTML form elements.

So I am thinking that there has got to be a django class that I can
utilize rather than having to repeat previous efforts.

Any suggestions?

Thanks,
Grant


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



booleanField as Core=True for deleting inline edited objects

2006-09-25 Thread littleswo

Hi everyone,

i would like to have foreignkey related objects to be deletable in the
admin via a simple checkbox. Can i do so via setting a boolean field to
core=True in the related object or is that not supported as a boolean
field is never empty?

Greetings,

vb


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



Tutorial for including content across all pages

2006-09-25 Thread keukaman

Is there a tutorial that shows a step-by-step description of how to
include content from one application in all pages on a site?

I'm building a site that will have 5 headlines in a "left nav" area of
the site. Those headlines will carry through all pages. Each headline
will link to a story in a "news" section. Some of the pages will be
flatpages.


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



Unknown column error when I add a field

2006-09-25 Thread Tool69

Hi,
I'm totally new to django, I've made a little blog application and my
original template is like this one:

class News(models.Model):
title = models.CharField(maxlength=255, verbose_name="Titre du
billet")
text = models.TextField(verbose_name="Contenu")
keywords = models.CharField(maxlength=255, verbose_name="Mots
clés")
date = models.DateTimeField(verbose_name="Date de publication")
etc.

All is getting well but now (runnin it with MySQL on WebFaction), I
wanted to stick an image with each post, so I added that field to my
News class :

post_image = models.ImageField(upload_to='entetes/', blank=True,
help_text="Doit etre de 300px de large")

But now, I received an error message saying :
(1054, "Unknown column 'news_news.supplementary_image' in 'field
list'")

What's going wrong ?
Thanks a lot :
6TooL9


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



Template inclusion with UTF-8 BOM (bug?)

2006-09-25 Thread Enrico

Hi,

I noticed that when a call a template encoded with UTF-8 with BOM using
an inclusion tag the BOM gets printed and sometimes can mess with the
layout.

It took me some time to find out that the extra BOM's were resulting in
an extra margin.

Maybe the BOM should be kept only on the first (base) template and
removed from the subsequent ones.

That's it.

Regards.
Enrico


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



Re: Fast hosting for Django

2006-09-25 Thread Remi

Just a few comments about WebFaction.

> I am a WebFaction customer, definitely not a bad company. A few thoughts
> about WebFaction:
>
> 1) It's a one man show, at least, support is.

WebFaction started with just 3 people but we're growing quite rapidly
right now so expect to see more people soon :)

> Support ticket response times
> are anywhere from three hours to a day and a half.

We aim to respond within a few minutes or hours (depending on how
urgent the ticket is), and always within 24 hours. If a ticket took a
day and a half to get answered it was a mistake on our part and should
never happen.

> 2) The control panel may be appealing but it is definitely flawed. It
> supports Firefox and Internet Explorer, but things are pretty slow with
> Opera. Their long running process monitoring (You're allowed one long
> running process at $14.50 USD a month.) is pretty bad as well, stopping and
> restarting your Apache instance leaves orphaned processes that you
> cannot monitor or kill off yourself.

I think you're talking about our control panel not killing the
processes for you when you delete an application from the control
panel, I just fixed that bug today :)

A couple more things:
I can't tell for sure but I'd say that we're probably one of the hosts
with the most Django sites right now (we host more than 200 of them).
By gaining some experience from all these sites we've been able to
eliminate pretty much all problems (like the libexpat version mismatch
that was causing Apache to crash sometimes) and fine tune our setup.
I think that we now have one of the best setup for shared hosting: we
give each site their own Apache2/mod_python instance proxied behind our
main Apache server. This gives them maximum flexibility to start/stop
their Apache server on their own and edit their httpd.conf file as they
want.
But we also configure our main Apache server to serve static data
(images, stylesheets, ...) directly, for maximum speed (this frees each
site's Apache2/mod_python instance from having to serve all those
little requests).

Remi.


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



MacPorts package

2006-09-25 Thread Jon Atkinson

Hi all,

I was wondering if anyone had done any work towards packaging Django
for Macports (http://www.macports.org/, formerly DarwinPorts). I'm
intending to start building a package, but I don't want to duplicate
effort if anyone else is working on it. A google search didn't yield
anything, so I assume it's safe to start from scratch, but if I am
jumping the gun, please let me know.

--Jon

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



generic views : how i'd like to have it

2006-09-25 Thread xaranduu

I want to build a generic view for all of my objects and according to
the documentation
(http://www.djangoproject.com/documentation/url_dispatch/#captured-parameters)
it is possible to capture a parameter and forward it to the view .

Target is to get completely automated generic views, without having to
edit any template
(maybe have a set of templates designed once, but valid for all
objects)

So I dont want to pass the parameter to the template but to the second
urls.py


My approach would be more a kind of

# In urls.py
urlpatterns = patterns('',
(r'^(?P\w+)/', include('foo.urls.mygenericurls')),
)

# In foo/urls/mygenericurls.py

infodict = {}

info_dict["myobject"] = {'queryset': Myobject.objects.all(),}
info_dict["myotherobject"] = {'queryset':
Myotherobject.objects.all(),}


urlpatterns = patterns('foo.genericviews',
(r'^list/$', 'blog.index', info_dict[objecttype]),
(r'^detail/$', 'blog.archive',info_dict[objecttype]),
...
)

but the objecttype is not visible in the foo/urls/mygeneric.py but only
in the genericviews!

Can anybody 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
-~--~~~~--~~--~--~---



Re: Re: Re: One-To-Many doesn't return a list.

2006-09-25 Thread Russell Keith-Magee

On 9/25/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> For when somebody gets to have a look at this (I might get time in the
> next couple of days), some other related tickets are #1816 and #2262.

#1816 and #2243 are this bug; #2751 is already marked as a duplicate;
#2262 is slightly different (but close enough that I'll probably have
a poke at it in the next few days).

I've just committed r3830 which fixes this bug. In the process, I
think I've found a separate problem with the handling of raw_id_admin
fields (they seem to return a list containing a list of ids, rather
than just a list of ids). I'll try to look at this in the next few
days, too.

Thanks to all involved in helping to track this one down.

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



Re: Simple Template Syntax Question: ljust

2006-09-25 Thread Martin Glueck

> I've tried...
>
> {{product.title |  ljust 40}}
>
> and other formats but can't get it to work...
You can use the slice filter:

{{product.title |  slice:":40" }}

or if you what the to truncate only at workbrakes, you can use the
truncatewaords filter:

{{product.title |  truncate:"5" }}

Martin

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



Re: Simple Template Syntax Question: ljust

2006-09-25 Thread Tim Shaffer

It should be

{{ product.title|ljust:"40" }}


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



Simple Template Syntax Question: ljust

2006-09-25 Thread Tom Smith

Can someone show me how to get x number of chars from a variable in a  
template please...

I've tried...

{{product.title |  ljust 40}}

and other formats but can't get it to work...

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



Re: automatically fill in some fields of a form, storing authenticated user

2006-09-25 Thread Andres Luga

Hi, the following are the suggestions of a Python and Django newbie,
so take with a load of salt. Also the examples are not direct
copy-paste and therefore might not work directly.

On 9/22/06, Benedict Verheyen <[EMAIL PROTECTED]> wrote:
> then data is looked up in another database and some of these values
> are then filled in the form so that when the user creates an object,
> part of the data is prefilled by fetching from another database.
> How can i fill in some fields of a form with data?
> I think i'll need to make my own Manipulator, defining the fields and
> passing default values, right?
> Is there an example around somewhere for this?

AFAIK, unfortunately no, the CreateManipulator has no knowledge about
values :(. What I ended up doing in similar situation is a bit kludge.
My model has the field Person (in database personid), which is a
foreign key to Persons table. I'm providing a default value for this
field. I use generic views and the relevant lines from my views.py
are:
def passage_create(*args, **kwargs):
   request = args[0]
   if request.GET:
  kwargs[ 'manipulator'] = MyAddManipulator( request['person'])



As you can see, I'm passing the desired value to the custom
manipulator. The manipulator itself looks like this:
class MyAddManipulator(MyModel.AddManipulator):
   def __init__(self, person_id):
  MyModel.AddManipulator.__init__(self)
  self.person_id=person_id


i.e I'm saving the value passed during the initialization. I'm using
the value in the manipulator's overridden method named flatten_data
that gets called by generic view:
class MyAddManipulator(MyModel.AddManipulator):

   def flatten_data(self):
  new_data=MyModel.AddManipulator.flatten_data(self)
  new_data['personid']=self.person_id
  return new_data


So there it is - the only way I know to provide default values if you
can't describe these in model definition. As limodou suggests, there
is another way. Maybe there is a third way, as the default value in
model can be method call. For example I have a field that gets default
value 2 years from now:
default=datetime(datetime.now().year+2, datetime.now().month,
datetime.now().day)
But I haven't experimented with this approach.


> 2. A closely related question in regards to user authentication.
> I have a model that also stores the user that is logged.
> That user field shouldn't be visible on the form and should be automatically
> filled in before the form is saved.

I have the similar situation: I have a model that has two fields:
lastupdatedon = models.DateTimeField( auto_now=True )
lastupdatedby = models.CharField( maxlength=50)

The procedure that sets the value for these looks like this
def update_logchanges(*args, **kwargs):
   kwargs = set_follow( dict( lastupdatedon=False), kwargs)
   request = args[0]
   if request.POST:
  new_data = request.POST.copy()
  new_data[ 'lastupdatedby'] = request.user
  request._post = new_data
   return create_object(*args, **kwargs)

The procedure set_follow is just a helper
def set_follow( follow, kwargs ):
   if kwargs.has_key( 'follow' ):
  new_follow = kwargs['follow']
   else:
  new_follow = {}
   for k in dict(follow).keys():
  new_follow[ str(k) ] = False
   kwargs[ 'follow' ] = new_follow
   return kwargs


I'm really hoping that this topic has a small chapter in upcoming
Django book... ;)

Regards,
Andres

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



Re: Does raising 404 makes use django's auth system?

2006-09-25 Thread Michael Radziej

Malcolm Tredinnick schrieb:

> OK, this is the problem line: RequestContext tries to access "user". The
> reason we are using RequestContext is because of ticket #688 (which is
> quite a reasonable change). However, we have to conditionally avoid this
> user requirement.

Well, as a work around, if you don't use a database, you should 
remove
 "django.core.context_processors.auth",
from TEMPLATE_CONTEXT_PROCESSORS in settings.py

This setting makes some of the default views trigger a context 
processor that requires the session middleware. Since this 
middleware needs a database, you've probably switched it off.

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



Re: Fast hosting for Django

2006-09-25 Thread Guest007

÷ ÓÏÏÂÝÅÎÉÉ ÏÔ 25 ÓÅÎÔÑÂÒÑ 2006 02:20 iain duncan ÎÁÐÉÓÁÌ(a):
> I know this has been asked many times, but as new hosting solutions pop
> up continually, just wanted to check on recommendations for good fast
> shared hosting that is Django friendly and reliable for business
> clients.
How about djangodomain.com ?

-- 
WBR Guest007
JID: [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
-~--~~~~--~~--~--~---



Re: Re: One-To-Many doesn't return a list.

2006-09-25 Thread Malcolm Tredinnick

On Sun, 2006-09-24 at 13:40 -0300, Ramiro Morales wrote:
> Hi guys,
> 
> On 9/24/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
[...]
> > That said, looking a the code over which Jay has thrown a spotlight,
> > it looks suspiciously like some pre-magic-removal code has been left
> > behind - set_foo(foo_list) is old-style m2m syntax.
> 
> Could all this be related to tickets 2751 and 2243 the last one actually
> contains a patch that weeds out the pre M-R set_%s method call of
> db/models/manipulators.py:218

For when somebody gets to have a look at this (I might get time in the
next couple of days), some other related tickets are #1816 and #2262.

Cheers,
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
-~--~~~~--~~--~--~---



Re: problem with custom validator and booleanfields

2006-09-25 Thread Malcolm Tredinnick

On Sun, 2006-09-24 at 15:13 +, simon101 wrote:
> Hi
> 
> I have a model with a boolean field which has a custom validator
> defined in the validator_list parameter.  The validator has to run
> whenever the form is submitted, whether the checkbox is ticked or not.
> I have set the 'always_test' parameter to true for the validator, but
> the validator still only gets called when the box is ticked.  I have
> found that the 'always_test' parameter works fine for other types of
> field, it just appears to be a problem with booleanfields.   Relevant
> sections of the model are pasted below:
> 
> class Order(models.Model):
> 
>   def stor_all(field_data, new_data):
>..validator code goes here
> stor_all.always_test = True
> 
>storage_all = models.BooleanField('All to be delivered to
> storage?', null='true', validator_list = [stor_all])
> 
> Has anyone else encountered this problem and is there a fix for it?

Can you file a ticket for this, please. I don't remember there being an
existing ticket for it.

It will get lost if we just leave it sitting in the mailing list
archives, but it sounds like a real bug.

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



Re: Does raising 404 makes use django's auth system?

2006-09-25 Thread Malcolm Tredinnick

On Mon, 2006-09-25 at 10:28 +, Filipe wrote:
> I'm running django on linux, and using the latest trunk.
> When I got this particular traceback I was using mod_python, but the
> same happens using the built-in webserver (only, "ModPythonRequest" is
> replaced with "WSGIRequest" in that case).
> 
> 
> The full traceback follows:
> 
> 
> Mod_python error: "PythonHandler django.core.handlers.modpython"
> 
> Traceback (most recent call last):
> 
>   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
> 299, in HandlerDispatch
> result = object(req)
> 
>   File
> "/usr/lib/python2.4/site-packages/django/core/handlers/modpython.py",
> line 183, in handler
> return ModPythonHandler()(req)
> 
>   File
> "/usr/lib/python2.4/site-packages/django/core/handlers/modpython.py",
> line 153, in __call__
> response = self.get_response(req.uri, request)
> 
>   File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py",
> line 95, in get_response
> return callback(request, **param_dict)
> 
>   File "/usr/lib/python2.4/site-packages/django/views/defaults.py",
> line 79, in page_not_found
> return http.HttpResponseNotFound(t.render(RequestContext(request,
> {'request_path': request.path})))

OK, this is the problem line: RequestContext tries to access "user". The
reason we are using RequestContext is because of ticket #688 (which is
quite a reasonable change). However, we have to conditionally avoid this
user requirement.

> 
>   File "/usr/lib/python2.4/site-packages/django/template/context.py",
> line 97, in __init__
> self.update(processor(request))
> 
>   File
> "/usr/lib/python2.4/site-packages/django/core/context_processors.py",
> line 17, in auth
> return {
> 
> AttributeError: 'ModPythonRequest' object has no attribute 'user'


I'm a bit tired right now, so I'm stopping for the evening, but I'll
have a look at this tomorrow.

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



Re: Does raising 404 makes use django's auth system?

2006-09-25 Thread Filipe

I'm running django on linux, and using the latest trunk.
When I got this particular traceback I was using mod_python, but the
same happens using the built-in webserver (only, "ModPythonRequest" is
replaced with "WSGIRequest" in that case).


The full traceback follows:


Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

  File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
result = object(req)

  File
"/usr/lib/python2.4/site-packages/django/core/handlers/modpython.py",
line 183, in handler
return ModPythonHandler()(req)

  File
"/usr/lib/python2.4/site-packages/django/core/handlers/modpython.py",
line 153, in __call__
response = self.get_response(req.uri, request)

  File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py",
line 95, in get_response
return callback(request, **param_dict)

  File "/usr/lib/python2.4/site-packages/django/views/defaults.py",
line 79, in page_not_found
return http.HttpResponseNotFound(t.render(RequestContext(request,
{'request_path': request.path})))

  File "/usr/lib/python2.4/site-packages/django/template/context.py",
line 97, in __init__
self.update(processor(request))

  File
"/usr/lib/python2.4/site-packages/django/core/context_processors.py",
line 17, in auth
return {

AttributeError: 'ModPythonRequest' object has no attribute 'user'


thanks!
Filipe


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



Re: Does raising 404 makes use django's auth system?

2006-09-25 Thread Malcolm Tredinnick

On Mon, 2006-09-25 at 09:14 +, Filipe wrote:
> Raising an HTTP 404 while having DEBUG = False in settings.py makes a
> webpage show up with nothing but a traceback with the following error:
> 
> [...]
>   File
> "/usr/lib/python2.4/site-packages/django/core/context_processors.py",
> line 17, in auth
> return {
> 
> AttributeError: 'ModPythonRequest' object has no attribute 'user'

Can you paste the full traceback for this, please? A few people have
reported this on and off; time to track down what's going on.

Thanks,
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
-~--~~~~--~~--~--~---



Re: The Holy Grail of Web Development

2006-09-25 Thread Holger Schurig

> knock-on errors)... and lastly... ScrIDE doesn't let me run
> manage.py with arguments.

It let's you. You can modify manage.py, and then you can change 
the values in sys.argv to your pleasure. I, for example, do 
this:

if __name__ == "__main__":
# Shut up the initial syncdb
import sys
if len(sys.argv)>1 and sys.argv[1]=="syncdb":
sys.argv.append("--noinput")
execute_manager(settings)

... and similarly you can do

  sys.argv.append("runserver")
  sys.argv.append("127.0.0.1:1234")

before calling execute_manager()

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



  1   2   >