Re: Generic views in magic removal

2006-03-22 Thread Arthur

> I think I figured it out, your RegEx should be:
> (?P\d+)/$

Ah, much better. I've looked at the completely wrong places. I still
wonder a bit about the error message.

Now it only complains about missing templates which I should be able to fix.

Thanks so much

Arthur

--~--~-~--~~~---~--~~
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: How to join two variables in a template

2006-03-22 Thread limodou

On 3/23/06, PythonistL <[EMAIL PROTECTED]> wrote:
>
> Limodou,
> Thank you for your reply.But I meant something different.
> I need to have  several input fields in s form -  for example PIECES -
> and I need each input field to be different in my template
>
> So I thought that I can join "PIECES" and "1"
> "PIECES" and "2"
> ...
> ...
> "PIECES" and "N"
>
> But {{PIECES}}{{"N}} will not work in a form
>
> Any idea?
> Thanks
>
So PIECES + n = what? Can you give me a example?

I'v developed a custom tags it is used to execute a python expression
you can think about:

http://groups.google.com/group/django-users/browse_thread/thread/6c1c162e7dd5d0d8/ce3aa7e2e3d48ae1?lnk=st=an+expression+tag=3#ce3aa7e2e3d48ae1
--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

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

2006-03-22 Thread limodou

On 3/23/06, Arthur <[EMAIL PROTECTED]> wrote:
>
> > I got it . You should pass the info_dict as **info_dict, but not
> > info_dict directly.
>
> Thanks for your answer. I don't think you can do that inside tuples.
> It throws a syntax error.
>
> Arthur

Oh, I made a mistake. I'm sorry.

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

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

2006-03-22 Thread limodou

On 3/23/06, Arthur <[EMAIL PROTECTED]> wrote:
>
> > The info_dict never gets implicitly passed -- it's always explicitly
> > passed. We're removing the magic, not adding to it! :)
> >
> > But as for your question, it seems like you're getting that error
> > because you're passing in 'queryset' twice.
>
> I've minimized the app to the bare minimum, but the error is still showing up:
>
> urls.py:
>
> from django.conf.urls.defaults import *
> from models import TodoItem
>
> # todolist URLs
> #
> info_dict = {
> 'queryset': TodoItem.objects.all() #,
> #'slug_field': 'detail'
> }
>
> urlpatterns = patterns(
>  'django.views.generic.list_detail',
> (r'(\d+)/$', 'object_detail', info_dict),
>  )
>
> models.py:
>
> from django.db import models
>
> class TodoItem(models.Model):
> text = models.CharField(maxlength=1000)
> dueDate = models.DateField(blank=True, null=True)
> class Admin:
> list_display = ('dueDate', 'text')
>
>
> The strange thing is that when I don't pass the info_dict there's
> still a variable queryset with the string value '1' and with passing
> it I get the
> "object_detail() got multiple values for keyword argument 'queryset'"
> error. Strange
>
> Thanks, Arthur

I got it . You should pass the info_dict as **info_dict, but not
info_dict directly.
--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

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

2006-03-22 Thread Arthur

> The info_dict never gets implicitly passed -- it's always explicitly
> passed. We're removing the magic, not adding to it! :)
>
> But as for your question, it seems like you're getting that error
> because you're passing in 'queryset' twice.

I've minimized the app to the bare minimum, but the error is still showing up:

urls.py:

from django.conf.urls.defaults import *
from models import TodoItem

# todolist URLs
#
info_dict = {
'queryset': TodoItem.objects.all() #,
#'slug_field': 'detail'
}

urlpatterns = patterns(
 'django.views.generic.list_detail',
(r'(\d+)/$', 'object_detail', info_dict),
 )

models.py:

from django.db import models

class TodoItem(models.Model):
text = models.CharField(maxlength=1000)
dueDate = models.DateField(blank=True, null=True)
class Admin:
list_display = ('dueDate', 'text')


The strange thing is that when I don't pass the info_dict there's
still a variable queryset with the string value '1' and with passing
it I get the
"object_detail() got multiple values for keyword argument 'queryset'"
error. Strange

Thanks, Arthur

--~--~-~--~~~---~--~~
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: How to join two variables in a template

2006-03-22 Thread limodou

On 3/23/06, PythonistL <[EMAIL PROTECTED]> wrote:
>
> Is there a way to join two( or more) variables in templates?
> Thanks for reply
> L.
>

What do you want to do?

{{ varA }}{{ varB }}

Can this helps?

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

--~--~-~--~~~---~--~~
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 to join two variables in a template

2006-03-22 Thread PythonistL

Is there a way to join two( or more) variables in templates?
Thanks for reply
L.


--~--~-~--~~~---~--~~
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 getting admin and non-admin app running in Apache

2006-03-22 Thread Ivan Sagalaev

DavidA wrote:

>NameVirtualHost *
>
>ServerName data
>DocumentRoot "C:/Dev/Source/Web/data"
>SetHandler mod_python
>PythonHandler django.core.handlers.modpython
>SetEnv DJANGO_SETTINGS_MODULE data.settings
>PythonPath sys.path+['C:/Dev/Source/Web']
>PythonDebug On
>PythonAutoReload On
>Alias /admin-media/
>"C:/Python24/Lib/site-packages/Django-0.91-py2.4.egg/django/contrib/admin/media/"
>
>SetHandler none
>
>
>  
>
I suppose uou should include all mod_python related things in a Location 
for "/":

NameVirtualHost *

ServerName data
DocumentRoot "C:/Dev/Source/Web/data"


SetHandler mod_python
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE data.settings
PythonPath sys.path+['C:/Dev/Source/Web']
PythonDebug On
PythonAutoReload On

SetHandler none



Then Apache would feed everything it receives on http://data/ (except 
admin-media) to Django. And then urlconf will handle applications' dispatch.

--~--~-~--~~~---~--~~
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: Advice on using model to bulk/batch load database

2006-03-22 Thread Ivan Sagalaev

DavidA wrote:

>I am prepopulating my database with data from a number of flat files.
>  
>
BTW, if you do this repeatedly and format of those flat files is not a 
requirement it is possible to have all initial data in a form of SQL 
script. If you place it in /sql/.sql then Django will 
include it in 'sqlall' command right after DB creation.

>Second, I'm using a manipulator to convert string values from the file
>to python values but the do_html2python method expects a POST which
>isn't quite the same as a dict. I had to write a little wrapper dict to
>make it compatible:
>  
>
You can use the very class that is used for POSTs - MultiValueDict. It's 
in django.utils.datastructures:

from django.utils.datastructures import MultiValueDict
d = MultiValueDict(your_dict)

--~--~-~--~~~---~--~~
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: Advice on using model to bulk/batch load database

2006-03-22 Thread Max Battcher

DavidA wrote:
> First, to use the model from a script I had to set the
> DJANGO_SETTINGS_MODULE environment variable and add the base directory
> to sys.path. I've seen this before so I guess this is just the way it
> is but it would be nice not to have dependencies on environment
> variables. Is there a different way to do this?

You can set the environment variable at the top of your scripts by 
importing the Python os module, just like you can import sys and set 
sys.path.

> Finally, for dates I had to manually convert them because they weren't
> in the -mm-dd format required by DateField.html2python. It seems a
> bit limited to only support one date format in DateField but I guess
> that avoids the ambiguities with date formats. Since my model's fields
> are the same names as the column headings in the flat files, now I can
> map all the conversions automatically without doing anything
> field-specific, *except* for date fields. Any suggestions?

The Python datetime and time modules are huge resources.  In this case 
you want time.strptime() to parse an arbitrary time format into a tuple 
and then you can use that tuple to create a datetime.date object which 
you can directly assign to the DateField.

-- 
--Max Battcher--
http://www.worldmaker.net/
"I'm gonna win, trust in me / I have come to save this world / and in 
the end I'll get the grrrl!" --Machinae Supremacy, Hero (Promo Track)

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



multiple ManyToMany mess

2006-03-22 Thread arthur debert

Hi there. I am having trouble with two many to many fields on the same
model.

I've looked around and found this very similar to ticket 327 (
http://code.djangoproject.com/ticket/327 )

my models follow:

class Project(meta.Model):
name = name = meta.CharField(maxlength=100)
...

class Account(meta.Model):
authuser = meta.OneToOneField(users.User, edit_inline=meta.STACKED,
core=True)

owner =  meta.ManyToManyField(Project, null=True, singular = "owned",
related_name="owns")
member = meta.ManyToManyField(Project, null=True, singular =
"memberof", related_name="belongs" )

OK. I can fecht what projects are owned by an accout, then I can add an
newly created Project instance (and properly saved with an id # -
checked!).
But when I fetch the get_owner_list() later... it's not there.

after the second run the code runs on the same account I get an
IntegrityError, with duplicates key.
Looking at my mql database... the table that's relating accounts and
projects (accounts_owned) is storing a project id of 0, but checking
both at my python code and at the db the project id is right (it's
aklready saved).

Am I missing something obvious? Does the fact the the same model has an
OneToOneField makes a difference?

If it matters... I am running svn with mysqsl 4.1 on os x, python 2.4

Thanks a lot.
Arthur


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



Advice on using model to bulk/batch load database

2006-03-22 Thread DavidA

I am prepopulating my database with data from a number of flat files.
I've written a small script to do this using my model class. While this
works, there are a couple of kludges I made to get it to work and I was
hoping someone could advise my on a better way to do this.

First, to use the model from a script I had to set the
DJANGO_SETTINGS_MODULE environment variable and add the base directory
to sys.path. I've seen this before so I guess this is just the way it
is but it would be nice not to have dependencies on environment
variables. Is there a different way to do this?

Second, I'm using a manipulator to convert string values from the file
to python values but the do_html2python method expects a POST which
isn't quite the same as a dict. I had to write a little wrapper dict to
make it compatible:

class MyDict(dict):
def getlist(self, key):
return (self[key],)

def setlist(self, key, value):
self[key] = value[0]

Again, not a big deal but it seems kludgy and I thought there might be
a better way. Any ideas?

Finally, for dates I had to manually convert them because they weren't
in the -mm-dd format required by DateField.html2python. It seems a
bit limited to only support one date format in DateField but I guess
that avoids the ambiguities with date formats. Since my model's fields
are the same names as the column headings in the flat files, now I can
map all the conversions automatically without doing anything
field-specific, *except* for date fields. Any suggestions?

Thanks,
-Dave


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



apache threading - 'QueryDict' object has no attribute '_mutable'

2006-03-22 Thread Alex Brown

I am running django on a Windows server (apache 2.0.54/mod_python
3.1.3/postgres 8.0.3)

Django would crash apache when running multiple automated scripts
POSTing data at a high rate through a generic create_object view.

After scanning the net I found various threading fix patches, and I
ended up finding that the thread-local-storage patch seemed to stop the
server from crashing. The problem I have now is that occasionally (1 in
20 POSTs), I get an AttributeError exception 'QueryDict' object has no
attribute '_mutable' django\http\__init__.py in _assert_mutable, line
79. It's asserting during the request.POST.copy() in create_object
(generic view)

This output was from the magic removal branch, however I think the
behaviour is the same when using the trunk with the
thread-local-storage patch.

I understand that prefork is the way to go to stop these issues, but I
can't see an easy way to do that in Windows (which I can't move from).

Has anyone else solved the threading issue on Windows ? Is the
thread-local-storage patch not the way to go ?


--~--~-~--~~~---~--~~
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 languages, "preview comments" translation

2006-03-22 Thread coulix

New facts, which may help, i i put onmy detail page
{% load i18n %}
a part from the admin template
{% if not user.is_anonymous %}
{% trans 'Welcome,' %} {% if
user.first_name %}{{ user.first_name }}{% else %}{{ user.username }}{%
endif %}. {% block userlinks %}{% trans
'Documentation' %} / {% trans 'Change
password' %} / {% trans 'Log out' %}{%
endblock %}
  {% endif %}

it get translated in french.

However,
{% if form.has_errors %}
{% if  form.error_dict|pluralize  %}
Veuillez corriger les {{ form.error_dict.items|length
}} erreurs suivantes :
{% else %}
Veuillez corriger l'erreur suivante :
{% endif %}


{% for e in form.error_dict.items %}
Champ {{ e.0 }} : {{  e.1.0 }} 
{% endfor %}

{% endif %}


 e.1.0  is still in english, (e,g : this field is recquired ).
and the preview_comment is still in english too.
i check the django/contribs/comments/templatetags.py
it includes, {% load i18n %}.

im confused, whats wrong with the internationalisation ?


--~--~-~--~~~---~--~~
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: Caching partial templates

2006-03-22 Thread Ian Maurer

On 12/14/05, Adrian Holovaty <[EMAIL PROTECTED]> wrote:
>
> On 12/13/05, oron <[EMAIL PROTECTED]> wrote:
> > coming from ROR where it's easy to cache partials (parts of templates)
> > I couldn't find a way to cache just parts of my template easily without
> > going back to the cache low level API.
> >
> > What's the suggested strategy for caching for example the home page
> > which will be hit lots of times, in case where I use sessions and need
> > to display the "hello {{ user.name }}" somewhere etc.
>
> You could write a custom {% cache %} template tag that would cache
> everything between it and {% endcache %} for a certain number of
> seconds:
>
> {% cache '500' %}
> This will be cached for 500 seconds.
> {% endcache %}
>
> If you write it and submit a patch, we'd definitely consider adding
> this to the Django distribution.

I created a custom cache template tag for partial/fragment caches. Its
probably a little to specific for my project for use in the framework,
but I think its a good starting point for others who find this thread.

For my purposes, I not only have an expiration time, but also a name
along with an unlimited number of "ids" that get resolved. Below is
the format of the tag:

{% load fragment_caching %}
{% cache   [id args..] %}

For instance...

{% load fragment_caching %}
{% cache 500 sidebar object.id %}

.. sidebar for object ..

{% endcache %}

Here is the code for the module fragment_caching.py under my
templatetags module:

from django.core.template import Library, Node, TemplateSyntaxError,
resolve_variable
register = Library()

@register.tag(name="cache")
def do_cache(parser, token):
nodelist = parser.parse(('endcache',))

parser.delete_first_token()

args = token.contents.split()
if len(args) >= 3:
tag_name, expire_time, fragment_name = args[:3]
id_names = args[3:]
else:
raise TemplateSyntaxError("Invalid arguments to cache: %s" % args)

return CacheNode(nodelist, expire_time, fragment_name, id_names)

class CacheNode(Node):
def __init__(self, nodelist, expire_time, fragment_name, id_names):
self.nodelist = nodelist
self.expire_time = expire_time
self.fragment_name = fragment_name
self.id_names = id_names

def render(self, context):
cache_id = self.fragment_name
for id_name in self.id_names:
cache_id += ":%s" % resolve_variable(id_name, context)

from django.core.cache import cache
value = cache.get(cache_id)

if not value:
value = self.nodelist.render(context)
cache.set(cache_id, value, float(self.expire_time))

return value

Obviously you need to have cache enabled for this to work:

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

--
Ian Maurer

--~--~-~--~~~---~--~~
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 languages, "preview comments" translation

2006-03-22 Thread coulix

Strange, apperently the admin is in the LANGUAGE_CODE language but nor
my website. Do i have to import anything special ?


--~--~-~--~~~---~--~~
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 languages, "preview comments" translation

2006-03-22 Thread coulix

Anyone using non english setting in their app ?
same problem with form validation error messages in 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
-~--~~~~--~~--~--~---



Re: custom SQL within object model?

2006-03-22 Thread Adrian Holovaty

On 3/22/06, Alan Bailey <[EMAIL PROTECTED]> wrote:
> Thanks!  Silly me.  But maybe a mention in the custom SQL section pointing
> to the where / tables stuff would be good.

Good idea! I've updated the docs to put in that pointer. Should be
live on the site within 15 minutes.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.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: How to view/run first app?

2006-03-22 Thread Francisco Reyes

Joseph Heck writes:

> I've had very good luck with the tickets when they're explicit - most got 
> added very quickly, and the ones that didn't had a quick note to let me 
> know why.


Thanks for the pointer.
I get to do most of my learning/hacking on weekends.. so look forward to 
going over the docs again.. and read them first before trying to follow 
along.

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

2006-03-22 Thread [EMAIL PROTECTED]

This is excellent. You should file a bug in trac to integrate it at
http://api.djangoproject.com. I like how you have edited the css to fit
in with the djangoproject site.


--~--~-~--~~~---~--~~
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: custom SQL within object model?

2006-03-22 Thread Alan Bailey

Thanks!  Silly me.  But maybe a mention in the custom SQL section pointing
to the where / tables stuff would be good.

Alan

On Wed, 22 Mar 2006, [EMAIL PROTECTED] wrote:

>
> Alan Bailey wrote:
> > I know I can write custom SQL with the db cursor and it returns raw
> > rows... but I would like (and it'd be easy to implement) a way to use
> > custom SQL (specifically only WHERE clauses) when doing a get_list or
> > get_object.
> >
> > For example:
> >
> > foo = users.get_list(status__exact='active', custom_sql='SUM(something) > 
> > 5')
>
> the "where" option might be what you need.  see "Other lookup options"
> on this page:
>
> http://www.djangoproject.com/documentation/db_api/
>
> for details.
>
> 
>
>
>
>

--~--~-~--~~~---~--~~
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 getting admin and non-admin app running in Apache

2006-03-22 Thread DavidA

I've read this documentation:
http://www.djangoproject.com/documentation/modpython/
but I can't figure out how to configure the VirtualHost section to get
the URLs I want.

Here's what I'm trying to do:
I have one Django project (data) with two apps under it (trades,
marks). I also have the admin app installed. I have setup a CNAME alias
for 'data' to point to my server (Win 2003 Srv) running Apache2 and
Django 0.91.

I want
- http://data/trades to go to my trade app
- http://data/marks to go to my marks app
- http://data/admin to go to the admin app for this project

It kind of works but I frequently get the TemplateSyntaxError message
that the above document is supposed to fix when I go to the admin site.
The problem is that I can't figure out how to map the advice in that
document to my Apache config. Here it is:
--
NameVirtualHost *

ServerName data
DocumentRoot "C:/Dev/Source/Web/data"
SetHandler mod_python
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE data.settings
PythonPath sys.path+['C:/Dev/Source/Web']
PythonDebug On
PythonAutoReload On
Alias /admin-media/
"C:/Python24/Lib/site-packages/Django-0.91-py2.4.egg/django/contrib/admin/media/"

SetHandler none


--

And my urls.py is:
--
from django.conf.urls.defaults import *

urlpatterns = patterns('',
(r'^trades/', include('data.trades.urls')),
(r'^marks/', include('data.marks.urls')),
(r'^admin/', include('django.contrib.admin.urls.admin')),
)
--

It seems like I'd have to create three additional Location sections
(marks, trades, admin) but that kinds of defeats the purpose of the
urls.py file.

BTW, I've never gotten the PythonAutoReload to work either.

Thanks,
-Dave (Apache noob)


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

2006-03-22 Thread Adrian Holovaty

On 3/22/06, Arthur <[EMAIL PROTECTED]> wrote:
> > Your example you aren't passing in that info_dict you created.
>
> Thanks Max. That's what I tried first. But from the partially updated
> tutorial in the mr branch docs and the error message
> "object_detail() got multiple values for keyword argument 'queryset'"
> when I try that I surmised that the info_dict somehow gets implicitly
> passed. Where could those multiple values for 'queryset' come from?

The info_dict never gets implicitly passed -- it's always explicitly
passed. We're removing the magic, not adding to it! :)

But as for your question, it seems like you're getting that error
because you're passing in 'queryset' twice.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.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
-~--~~~~--~~--~--~---



Django API doc

2006-03-22 Thread Daniel Poelzleithner

Hi,

i created a css to build a django styled API doc with epydoc.

http://djangoapi.quamquam.org/ Beta Version :)

I hope we can integrate it as http://api.djangoproject.com someday.

kindly regards
  daniel



--~--~-~--~~~---~--~~
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/mod_python/apache import problem

2006-03-22 Thread abe

hi,

I'm having trouble getting django to work together with apache an
mod_python



if I try to access the admin page through my browser it displas the
following message


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

Traceback (most recent call last):

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

  File

"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/handlers/modpython.py",
line 165, in handler return ModPythonHandler()(req)

  File

"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/handlers/modpython.py",
line 130, in __call__ from django.conf import settings

  File

"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/conf/settings.py",
line 34, in ? raise EnvironmentError, "Could not import %s '%s' (is
it on
sys.path?): %s %s" % (ENVIRONMENT_VARIABLE, me.SETTINGS_MODULE,
e,sys.path)

EnvironmentError: Could not import DJANGO_SETTINGS_MODULE
'myproject.settings' (is it on sys.path?):  No module named
myproject.settings ['/data1/zbdb', '/usr/lib/python23.zip',
'/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2',
'/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload',
'/usr/lib/python2.3/site-packages',
'/usr/lib/python2.3/site-packages/PIL',
'/usr/lib/python2.3/site-packages/setuptools-0.6a9-py2.3.egg',
'/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg',
'/usr/lib/python2.3/site-packages/gtk-2.0']


I added the printing of sys.path to
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/conf/settings.py"
to see if the path is correct

myproject.setting can't be imported  but it should be on the sys.path
because /data1/zbdb is in sys.path and
/data1/zbdb/myproject/settings.py
exists

ls  -lst /data1/zbdb/myproject/settings.py
8 -rw-r--r--  1 root root 2601 Mar 22 20:32
/data1/zbdb/myproject/settings.py

this is in my httpd.conf

SetHandler python-program
PythonPath "['/data1/zbdb'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE myproject.settings
PythonDebug On
PythonAutoReload On





Any idea what am I doing wrong? 

thanks, E


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

2006-03-22 Thread Arthur

> > I'm trying to use generics on the magic removal trunc and I'm a bit at
> > a loss because the queryset variable seems to get autoconverted to a
> > string. The following urls.py always results in a "AttributeError:
> > 'str' object has no attribute 'model'":
> >
> > from django.conf.urls.defaults import *
> > from models import TodoItem
> >
> > info_dict = {
> > 'queryset': TodoItem.objects.all()
> > }
> >
> > urlpatterns = patterns(
> > 'django.views.generic.list_detail',
> >  (r'(\d+)/$', 'object_detail'),
> >  )
> >
>
> Shouldn't that be:
>
> urlpatterns = patterns(
>  'django.views.generic.list_detail',
>   (r'(\d+)/$', 'object_detail', info_dict),
>   )
>
> Your example you aren't passing in that info_dict you created.

Thanks Max. That's what I tried first. But from the partially updated
tutorial in the mr branch docs and the error message
"object_detail() got multiple values for keyword argument 'queryset'"
when I try that I surmised that the info_dict somehow gets implicitly
passed. Where could those multiple values for 'queryset' come from?

Arthur

--~--~-~--~~~---~--~~
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: custom SQL within object model?

2006-03-22 Thread [EMAIL PROTECTED]

Alan Bailey wrote:
> I know I can write custom SQL with the db cursor and it returns raw
> rows... but I would like (and it'd be easy to implement) a way to use
> custom SQL (specifically only WHERE clauses) when doing a get_list or
> get_object.
>
> For example:
>
> foo = users.get_list(status__exact='active', custom_sql='SUM(something) > 5')

the "where" option might be what you need.  see "Other lookup options"
on this page:

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

for details.




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



custom SQL within object model?

2006-03-22 Thread Alan Bailey

Hello,

I know I can write custom SQL with the db cursor and it returns raw
rows... but I would like (and it'd be easy to implement) a way to use
custom SQL (specifically only WHERE clauses) when doing a get_list or
get_object.

For example:

foo = users.get_list(status__exact='active', custom_sql='SUM(something) > 5')

So there's a regular variable check status='active' but then if I use an
aggregate operator or something else wacky, I can do it with a custom_sql
thing.  Kind of like the complex operator.

Or is this maybe possible in the new magic_removal?

Ideas?

Alan

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

2006-03-22 Thread Max Battcher

Arthur wrote:
> Hi all
> 
> I'm trying to use generics on the magic removal trunc and I'm a bit at
> a loss because the queryset variable seems to get autoconverted to a
> string. The following urls.py always results in a "AttributeError:
> 'str' object has no attribute 'model'":
> 
> from django.conf.urls.defaults import *
> from models import TodoItem
> 
> info_dict = {
> 'queryset': TodoItem.objects.all()
> }
> 
> urlpatterns = patterns(
> 'django.views.generic.list_detail',
>  (r'(\d+)/$', 'object_detail'),
>  )
> 

Shouldn't that be:

urlpatterns = patterns(
 'django.views.generic.list_detail',
  (r'(\d+)/$', 'object_detail', info_dict),
  )

Your example you aren't passing in that info_dict you created.

-- 
--Max Battcher--
http://www.worldmaker.net/
"I'm gonna win, trust in me / I have come to save this world / and in 
the end I'll get the grrrl!" --Machinae Supremacy, Hero (Promo Track)

--~--~-~--~~~---~--~~
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: hi, Plz tell what we use in place of scanf like in C, what is in the case of Python

2006-03-22 Thread Eric Walstad

Kartikeya Sinha wrote:
> hi, Django Users
> i am Kartik from INDIA
> i want to know that what i can use the statment of scanf like in C we
> use it to get input from the user. so which statment we can use to take
> values from the user in Python...
> plz do help me out 
> 
> \by

$ python
Python 2.3.5 (#2, Aug 30 2005, 15:50:26)
[GCC 4.0.2 20050821 (prerelease) (Debian 4.0.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> help(raw_input)

--~--~-~--~~~---~--~~
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: Advice on developing with django for a team of 10+

2006-03-22 Thread Joseph Heck
I just finished up a very crude Ant "wrapper" script so that I could drive builds and tests (mostly tests, as ther isn't much to compile) from CruiseControl. It's a pretty simple setup, but I recommend it for really any sized team.
I snagged the 2.4.1 release of Cruisecontrol, which pretty much "works right out of the box". For the curious and benefit of others:I'm not satisfied with the PYTHONPATH and DJANGO_PROJECT_SETTINGS environment variable setups, but it's functioning and running all the tests as we build them and add to our codebase.
---build.xml---

which uses two scripts: 
baselineBuild.bash and envBuild.bashbaselineBuild.bash--#!/bin/bashPROJECTPATH=/Users/heckj/Desktop/cruisecontrol-bin-2.4.1/projectsPROJECT=webcodeexport DJANGO_SETTINGS_MODULE="$PROJECT".settings
export PYTHONPATH=$PROJECTPATH:$PYTHONPATH:cd $PROJECTPATH/$PROJECTrm /tmp/"$PROJECT"DBdjango-admin.py initdjango-admin.py install edmondsdjango-admin.py install admindjango-admin.py createsuperuser root my_email_address my_sekret_password
python manage.py sqlindexes edmonds > index_createscat index_creates | sqlite3 /tmp/"$PROJECT"DB rm index_creates # clean up after myself...# intial data loading... python initial_data_load.py
python example_data_load.py

--~--~-~--~~~---~--~~
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: How to view/run first app?

2006-03-22 Thread Joseph Heck
I've had very good luck with the tickets when they're explicit - most got added very quickly, and the ones that didn't had a quick note to let me know why.-joeOn 3/21/06, 
Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
On 3/22/06, Francisco Reyes <
[EMAIL PROTECTED]> wrote:

Russell Keith-Magee writes:I will gladly try and give feedback about the docs.. just wanted to knowwhat is the best place to send the feedback to. This list or the developerslist?

The user list would be preferable to the developer list, but if you want to make sure your comments don't get lost and forgotten, I would open an enhancement ticket at 
code.djangoproject.com/newticket
. Put your comments in with the ticket. Try to keep the tickets atomic - if you have lots of suggestionts, open a ticket for each specific enhancement you would like to see.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: OneToOneField

2006-03-22 Thread Joseph Heck
The error "no such column" suggests that your schema is out of whack with your model.Use the 'python manage.py sqlall [APPLICATIONNAME]' to determine what Django thinks your schema should be, and compare that to what is there.
While doing heavily development, I use a script to rebuild the whole kit, including loading some sample data - it makes it MUCH easier to track down issues when you're tweaking the model quite often.
On 3/21/06, layik <[EMAIL PROTECTED]> wrote:


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


hi, Plz tell what we use in place of scanf like in C, what is in the case of Python

2006-03-22 Thread Kartikeya Sinha

hi, Django Users
i am Kartik from INDIA
i want to know that what i can use the statment of scanf like in C we
use it to get input from the user. so which statment we can use to take
values from the user in Python...
plz do help me out 

\by


--~--~-~--~~~---~--~~
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: Content-length header

2006-03-22 Thread Kartikeya Sinha

plz can u tell me how can i use a scanf statment like in c to get the
inputs from user as in Python.
i question is that by what statment we can give user an option of
asking the values for the variables by what statment. my mail id is
"[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
-~--~~~~--~~--~--~---



Content-length header

2006-03-22 Thread Martin Ostrovsky

Hi,

Does the HttpResponse object set its own content-length header ? (e.g.
the size of the template after it has been loaded). If not, how come?

- 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: flatpages

2006-03-22 Thread Adrian Holovaty

On 3/22/06, Mary Adel <[EMAIL PROTECTED]> wrote:
> I am working with flatpages and they are amazing for me and i customized
> them for my first needs then i am developing another site now that has
> another needs and i need to customize flatpages but in different way so
> how this could be done

Hi Mary,

This should be as simple as using your custom code in one place, and
other custom code in another place. If the two usages are different
enough, there's no point in sharing code -- just make them separate
applications.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.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
-~--~~~~--~~--~--~---



Generic views in magic removal

2006-03-22 Thread Arthur

Hi all

I'm trying to use generics on the magic removal trunc and I'm a bit at
a loss because the queryset variable seems to get autoconverted to a
string. The following urls.py always results in a "AttributeError:
'str' object has no attribute 'model'":

from django.conf.urls.defaults import *
from models import TodoItem

info_dict = {
'queryset': TodoItem.objects.all()
}

urlpatterns = patterns(
'django.views.generic.list_detail',
 (r'(\d+)/$', 'object_detail'),
 )

Any help appreciated. Thanks

Arthur

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

2006-03-22 Thread Adrian Holovaty

On 3/22/06, Mary Adel <[EMAIL PROTECTED]> wrote:
> I am working with flatpages and they are amazing for me and i customized
> them for my first needs then i am developing another site now that has
> another needs and i need to customize flatpages but in different way so
> how this could be done

Hi Mary,

This should be as simple as using your custom code in one place, and
other custom code in another place. If the two usages are different
enough, there's no point in sharing code -- just make them separate
applications.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.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: maxlength in the Admin site

2006-03-22 Thread Adrian Holovaty

On 3/21/06, ChaosKCW <[EMAIL PROTECTED]> wrote:
> I am wondering what I need to do in order to get the admin site to
> enforce the maxlength property. I am using the MR Branch.
>
> I have a model with a CharField where maxlength=3. I goto in admin. It
> shows a huge box ie way more than 3 charcaaters, allows you to enter
> more than 3 characters and doesnt error when you save more than 3
> characters.
>
> This seems strange to me. Any suggestions ?

Hi Chaos,

CharFields are represented in the admin with a fixed length. The
"maxlength" property on those boxes is set correctly, but the size of
the actual form element is hard-coded.

This is probably worth changing, because you're right to note that
it's silly for a two-character field to have a long input element. But
we can't just blindly set the length of the field to the maxlength,
because maxlength=200 would result in a horribly long field. There
would have to be some sort of upper limit.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.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: flatpages

2006-03-22 Thread lawgon

>
> Dear All ,
> I am working with flatpages and they are amazing for me and i customized
> them for my first needs then i am developing another site now that has
> another needs and i need to customize flatpages but in different way so
> how this could be done

may we ask what the other needs are and what is different?



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



flatpages

2006-03-22 Thread Mary Adel

Dear All ,
I am working with flatpages and they are amazing for me and i customized
them for my first needs then i am developing another site now that has
another needs and i need to customize flatpages but in different way so
how this could be done

Thanks,
Mary


--~--~-~--~~~---~--~~
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: still having problems running the tutorial..

2006-03-22 Thread [EMAIL PROTECTED]

okay, i finally got this fixed..

what i had to do was..

create the database using utf-8 collation from the very beginning.. and
not try to convert it.. for some reason, when i try to convert it, it
would not convert all the tables..

thanks for your help!


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



problem with languages, "preview comments" translation

2006-03-22 Thread coulix

i putted LANGUAGE_CODE = 'fr' in my settings.py

{% free_comment_form for recettes.recipes recipe.id %}
display a comments form in my template, but the button is still in
english.
"preview comments"

have a look
http://ozserver.no-ip.com:345/cefinban/recettes/guest-recipe/
why ?
i want to use either the french one or make my own.


--~--~-~--~~~---~--~~
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: SQL Debugging and limit_choices_to in MR Branch

2006-03-22 Thread ChaosKCW

This patch works:
http://groups.google.com/group/django-developers/browse_thread/thread/e784f1e5fde630ed/b7920dba4b69e455#b7920dba4b69e455


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