Re: Zip code lookup field

2007-06-26 Thread Jeremy Dunck

On 6/26/07, leif <[EMAIL PROTECTED]> wrote:
> My main problem, though, is figuring out how to create a text input
> lookup field for the ZIP code foreign key.


> Do I need to code a new
> widget? A new form field class? A function to hook into newforms'
> validation?

> And if I create a widget or form field class, how to I coax Django
> into using it for the admin change and add pages?

Django's existing admin uses oldforms.  The newforms-admin branch is
working to rewrite admin to be more flexible and use newforms.  If you
need it on trunk now, you'll need to use oldforms.

You'll need to inherit from django.db.models.fields.Field and override
Field.get_manipulator_field_objs.

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



Django

2007-06-26 Thread Brandon

Check it out: www.BrandonsMansion.com


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



Re: Tests fail on redirects when admin urls enabled

2007-06-26 Thread Russell Keith-Magee

On 6/26/07, Rand Bradley <[EMAIL PROTECTED]> wrote:
> This is occurring wherever I test a redirect. If I comment out the admin
> line in urls.py , the errors disappear. I am on the latest development
> version to date (5541).
>
> Any insight or help would be greatly appreciated! Thanks.

Looking at the traceback, it looks like you are having some difficulty
in working up the reverse URL mapping - specifically, something to do
with the documentation view in the admin. This could be caused if
there is some metadata on a class that is causing the automatically
generated admin views some difficulty, but it is difficult to say
exactly what is causing the problem.

I would try manually walking through the admin pages (especially the
documentation pages) in the admin view to see if you can manually trip
the error. This will at least help you narrow down the problem.

Yours,
Russ Magee %-)

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



Re: Developing a flexible CMS

2007-06-26 Thread sime

Hi Kyle, I've run into the same problems before. I think you'll find
Django admin is great for simple operations involving single records
and the most basic relations. But for anything beyond that, you'll
probably need to roll your own admin page.

On Jun 25, 1:15 am, Kyle Fox <[EMAIL PROTECTED]> wrote:
> I hope I can explain this well, because I've been wracking my poor
> little brain trying to figure out how to do this :)
>
> I'm trying to create a flexible CMS.  I want it to be easy for users
> to create a Page, and attach all kinds of content ("components") to
> that page.  These components would all be Model classes.  Here are two
> simple examples of the components I had in mind:
>
> class TextSnippet(models.Model):
> body = models.TextField()
>
> class Photo(models.Model):
> image = models.ImageField(upload_to="photos")
>
> The idea is that a user add an arbitrary number of these components to
> a Page model.  A Page model is nothing more than a container to hold
> components, and a URL associated with the Page, something like:
>
> class Page(models.Model):
> url = models.CharField( maxlength=100, unique=True,
> validator_list=[validators.isAlphaNumericURL])
>
> The problem is that I can't figure out a good way to associate
> instances of TextSnippet and Photo with a page.  It's obviously a many-
> to-many between the components and pages (a component like a photo can
> be on many pages, and a page can have many components), but I also
> need to store more information about that particular page-component
> relationship, for example a IntegerField that specifies the
> component's position on that page.  Here's what I've come up with so
> far:
>
> class PageComponent(models.Model):
> page = models.ForeignKey(Page, related_name="components",
> edit_inline=models.TABULAR)
> content_type = models.ForeignKey(ContentType)
> object_id = models.IntegerField(core=True)
> position = models.IntegerField(default=0, blank=True)
>
> It "works" not too bad.  Conceptually (from the shell), I think it
> does what I want.  However, I'm having a HECK of a time getting the
> Page form in the admin to work in an intuitive way.  When adding
> components to a page, the user sees a drop-down list of content_types,
> and has to enter an object_id.  It works for me because I know what to
> put for the object_id, but a regular user wouldn't
>
> I think this would require me to write a custom form class for adding
> and editing a page, but with these relationships I really don't even
> know where to begin :S
>
> If anyone can provide advice (or just flat out tell me if I'm thinking
> about this wrong), it would be much appreciated!
>
> Thanks,
> Kyle


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



Re: Newforms Attribute Errors

2007-06-26 Thread Malcolm Tredinnick

On Tue, 2007-06-26 at 11:22 -0700, robo wrote:
> Hopefully you guys can spot an error I've not been able to. This is
> the error I get:
> 
> AttributeError at /vendor/Chef/1/
> 'Order_DetailForm' object has no attribute 'save'
> Request Method: POST
> Request URL: http://192.168.1.104:8000/vendor/Chef/1/
> Exception Type: AttributeError
> Exception Value: 'Order_DetailForm' object has no attribute 'save'
> 

[..]
> Also, the error "'Order_DetailForm' object has no attribute 'save'"
> doesn't look right. Isn't it supposed to be "'OrderDetailForm' object
> has no attribute 'save'" because I defined OrderDetailForm, not
> Order_DetailForm?

Yes, that is unexpected.

This problem will be a lot easier to debug if you can post the full
traceback, rather than just the final line that is at the top of the
debug page.

Look on the error page. There is a link called "cut-and-paste view".
Click on that and then cut-and-paste the traceback it shows. That might
provide some more clues.

Thanks,
Malcolm

-- 
The hardness of butter is directly proportional to the softness of the
bread. 
http://www.pointy-stick.com/blog/


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



Re: Unittests and coverage

2007-06-26 Thread Russell Keith-Magee

On 6/26/07, Michal <[EMAIL PROTECTED]> wrote:
>
> Hello,
> I try to write test together with coverage [1]. This tool could tell me,
> which lines of code was or wasn't executed and therefore tell, how my
> tests are (or aren't) "superior".
>
> I put initial code for coverage into setUp, and cleanup to tearDown
> method of Testcase class. Problem is, that setUp and tearDown method are
> called before/after each particular test in TestCase.
>
> I need to find technique, which enable me initiate coverage before any
> test begin, and cleanup after *all* test was executed. Do you have some
> advice please?

Hi Michal

The approach here will be to write your own test runner method. When
you call 'manage.py test', Django is effectively calling a method
called django.test.simple.run_tests(); this method sets up the test
environment, finds the tests, runs the tests, and cleans up the test
environment.

However, you can direct django to point at a different method of your
own choosing. Define a method like:

from django.tests.simple import run_tests

def coverage_run_tests(module_list, verbosity=1, extra_tests=[]):
   setup_coverage()
   retval = run_tests(module_list, verbosity, extra_tests)
   cleanup_coverage()
   return retval

then, in your settings file, define
TEST_RUNNER='myapp.coverage_run_tests', and Django will  use your
instrumented run_tests implementation.

Yours,
Russ Magee %-)

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



Re: Using reverse() in your urlpatterns

2007-06-26 Thread Malcolm Tredinnick

On Tue, 2007-06-26 at 18:12 +, Justin wrote:
> I've just been screwing around with my urlpatterns, trying to clean
> them up. Mostly, I've been trying to remove all hard coded urls
> wherever they are, in templates and whatnot, by adding a name="foo" to
> my urlpatterns and then accessing them with {% url %} and reverse().
> 
> I'm wondering though, is it possible to use reverse() and pass it some
> args, to use it as the post_save_redirect in generic views? I've been
> trying to get it to work, but no luck so far... maybe I'm not passing
> the args properly? Or maybe it's not even possible?

I don't really understand the question you are asking. However, here's
the skinny: you give reverse any parameters -- named or positional --
that can appear in the URL and it returns a string. The only arguments
you can give are ones that appear in the URL pattern (the reg-exp).

If that's all you are trying to do, then perhaps give an example of how
you're trying to use reverse() and we can help you. If you're somehow
trying to influence the extra_dict (third) parameter in the url() line,
then you are trying to do something that reverse() is not designed for,
and which doesn't really make sense for URL creation.

Hope that might clear up some of your confusion, although, as I said,
I'm not quite sure what you were asking.

Regards,
Malcolm

-- 
The cost of feathers has risen; even down is up! 
http://www.pointy-stick.com/blog/


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



Re: multiple OneToOne fields pointing to the same table

2007-06-26 Thread Malcolm Tredinnick

On Tue, 2007-06-26 at 16:34 +, Charles Wesley wrote:
> I want a model where a single table has two OneToOne fields pointing
> back to another table. Here's the trivial example:
> 
> 
> class Trivial(models.Model):
> pass
> 
> class Multiple(models.Model):
> one_trivial = models.OneToOneField(Trivial,
> related_name="one_trivial")
> two_trivial = models.OneToOneField(Trivial,
> related_name="two_trivial")
> 
> This breaks at syncdb using MySQL (error: 1068, 'Multiple primary key
> defined'). So is this a problem with MySQL or Django? Is my best bet
> to just turn those OneToOneFields into ForeignKeys with
> max_num_in_admin = 1?

At the moment, OneToOneFields in Django are implicitly made into primary
keys, so the constraint is on the Django side. At some point prior to
1.0, this will have to relax a little bit as part of implementing model
inheritance, however, right now that's the state of play. So, yes, if
you want a structure like this, you will have to fake one of the links
with a ForeignKey.

Regards,
Malcolm

-- 
If at first you don't succeed, destroy all evidence that you tried. 
http://www.pointy-stick.com/blog/


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



Re: How can I rename uploaded files to a random filename?

2007-06-26 Thread Russell Keith-Magee

On 6/25/07, rob <[EMAIL PROTECTED]> wrote:
>
> We upload all of our images via the Admin app and would like all
> uploaded images to be renamed to a set of numbers. We can generate the
> random numbers fine, but is there an easy way to rename the file once
> it's uploaded in the Admin app?

Not at present. You would need to write a customized FileField to
implement this sort of behaviour.

Yours,
Russ Magee %-)

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



Re: XML serializer

2007-06-26 Thread Russell Keith-Magee

On 6/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
>  Since serializer has query set as parameter. If data is not query
> from database, How to construct data structure (query set) and pass to
> serializer ?

The Django serializers accept any iterable, not just query sets. You
can pass in any list or set of Django object instances, and they will
serialize fine.

Yours,
Russ Magee %-)

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



Re: newforms and File (image) upload

2007-06-26 Thread Russell Keith-Magee

On 6/21/07, Dirk van Oosterbosch, IR labs <[EMAIL PROTECTED]> wrote:
>
> On 20-jun-2007, at 22:19, SanPy wrote:
>
>
> File and image uploading for newforms, AFAIK, is not implemented in
>
> 0.96. There is a ticket for this (#3297). If you look in the django-
>
> developers newsgroup and search for #3297, you will find more
>
> information. It is possible to have it working with the latest trunk
>
> from SVN and a patch from #3297. It works fine on my machine with the
>
> latest trunk and patch.
>
> Hi Sander,
>
> Thanks for the pointers on this one,
>
> There seems to be an incompatibility between the latest trunk (rev 5505) and
> the last (06/13/07) patch for #3297. More on this below.

I was looking at this a few weeks ago before I got sent to the ends of
the earth by my employer; I'm back now, so I'm hoping to get back into
this problem.

> Question: can I mix and match oldforms and newforms together? (in the same
> application that is, not in the same view or form obviously).

Sure. One view uses newforms, another view uses oldforms; as long as
you import both as required, there is no potential for crossover
between the two.

In fact, if you're deploying the admin app, you're already using both.
The current trunk admin uses oldforms (though not for long).

Yours,
Russ Magee %-)

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



Re: test client login problems

2007-06-26 Thread Russell Keith-Magee

On 6/20/07, Chris Brand <[EMAIL PROTECTED]> wrote:
>
> I'm running into problems with the test client's login method.
> Specifically, within a single test method, the first login succeeds but the
> second one fails.
> Is this something that should work ? Am I doing something wrong ?

Apologies for the delay responding - I've been in terra incognita for
a while :-)

The 'bool object has no attribute status_code' message is generated
because the login() method visits the named url, and tries to fill in
the form it finds. If you are already logged in, and you visit a
login-decorated view, the login form won't be shown - the underlying
content will be shown. The login() test method returns true because a
user is already logged in.

You should also be warned that revision [5152] (post 0.96 release)
modified the login method to use the internal authentication plumbing,
rather than using a login view. This will affect the way you write
your tests using the login method, although you will probably still
experience difficulties if you try to 'double login' like your test
view is trying to do.

Yours,
Russ Magee %-)

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



Re: Zip code lookup field

2007-06-26 Thread leif

Very good point, Tim. I'll consider that issue as I move forward with
my application.

My main problem, though, is figuring out how to create a text input
lookup field for the ZIP code foreign key. Do I need to code a new
widget? A new form field class? A function to hook into newforms'
validation?

And if I create a widget or form field class, how to I coax Django
into using it for the admin change and add pages?



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



Re: Zip code lookup field

2007-06-26 Thread Tim Chase

> My question, then, is this: What's the most elegant way to
> pull off this hack? By the way, I am using newforms and the
> newforms-admin branch. (I want my customizations to work with
> 1.0 and beyond.)

Generally, zip-codes and cities have a one-to-one correspondence.
 However, this isn't 100% the case.

You could offer a zip-entry and then, if ambiguity arose, allow
the user to choose the intended town to clarify, much like other
error/validation processes where you'd repopulate the screen with
the existing data but flag the ambiguity as an error condition.

It would also be helpful to given the user a preview anyways in
case they mis-typed their zip-code.

-tim



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



Zip code lookup field

2007-06-26 Thread leif

Hi there. I'm new to Django and Python, so I appreciate any help you
guys can provide.

I am working on an app that allows a user to create extended profiles
with text and photos. In addition, each profile is associated with a
single ZIP code via a ForeignKey.

As it stands now, the admin add-profile page generates a select
pulldown menu with all available ZIP codes. That, of course, cannot
work on a production site. Instead, I would like to have a text field
that accepts a user's ZIP code and then performs a lookup on the
foreign key during validation. If the given ZIP is found, the
associated foreign key would be saved; if not, an error would be
returned.

I know I theoretically could create a ZIP code table in which the
codes themselves were the primary keys, and then use raw_admin_id. But
I will be working with a legacy with previously-assigned keys, and ZIP
codes aren't really well suited for primary keys, anyway.

My question, then, is this: What's the most elegant way to pull off
this hack? By the way, I am using newforms and the newforms-admin
branch. (I want my customizations to work with 1.0 and beyond.)

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?hl=en
-~--~~~~--~~--~--~---



Re: Several django site in one fastcgi process?

2007-06-26 Thread Graham Dumpleton

On Jun 27, 12:59 am, "Vladimir Pouzanov" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm running several django sites on lighttpd server. Sites are simple
> and I don't like the idea of spawning so much python processes that
> eat my precious memory. Is it possible somehow to run several sites in
> one fcgi server?

AFAIK the answer is no.

This is because all fcgi server side infrastructure packages I have
seen all use standard Python executable. As a consequence this means
that the process can only hold one Django application instance. Only
one Django instance is possible because Django relies on getting
information from os.environ for location of settings file and there is
only one os.environ per process. There would also possibly be other
problems as well if Django or your applications hold information in
global data. A further problem is where people set the Python path to
include the site directory as well as the parent, as then modules may
clash due to a lack of site specific prefix in package name.

That all said. My understanding of mod_fastcgi is that you can attach
fcgi scripts against different URLs in same host or different virtual
hosts. The result would be multiple fcgi process with one Django
instance in each. Thus, there probably isn't a need to run two Django
instances in the same process with fcgi, just run multiple fcgi
process.

The only solution which would allow you to run multiple Django
instances in a single process, but not where that is in the Apache
child processes, is mod_wsgi. In mod_wsgi it can be used in 'embedded'
mode whereby it runs like mod_python with application running in child
processes. Or it can be used in 'daemon' mode whereby the application
is delegated to run in a distinct daemon process like with fcgi
solutions. With mod_wsgi however, it gives you the choice of running
one or more Django instances in a single daemon process, each in a
separate sub interpreter.

The Django documentation for mod_wsgi doesn't yet show an example of
daemon processes being used, but Trac documentation does, although in
that case only one Trac instance is put in each daemon process,
something which would be preferred with Django as well for reasons
described in the Trac integration documentation.

For further details see:

  http://code.google.com/p/modwsgi/wiki/IntegrationWithTrac
  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango

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?hl=en
-~--~~~~--~~--~--~---



Re: Custom admin field widgets in the newforms-admin branch

2007-06-26 Thread leif

By the way, I did find the hook in django/branches/newforms-admin/
django/contrib/admin/options.py for specifying the form field for a
given database field. But that's different than allowing a developer
to specify the widget for a given field in the model itself.



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



Re: 500 Errors when uploading files (with FastCGI)

2007-06-26 Thread Dirk van Oosterbosch, IR labs
Replying myself to add some information and ask some extra questions.

I just had contact with the maintainer of my shared host. He warned  
that memory exceeding the (shared usage) limit could cause strange  
errors. And that memory usage should be dealt with carefully.
He adviced me to save the uploaded files directly to disk instead of  
storing them in memory first. Can I do this at all with Django?

I am now using (in the view)
if request.method == 'POST':
if 'uploadedfile' in request.FILES:
new_data = request.POST.copy()
new_data.update(request.FILES)
form = UploadForm(new_data)
if form.is_valid():
success = form.save(request.user)

in the UploadForm class
def clean_uploadedfile(self):
file_data = self.clean_data['uploadedfile']

return file_data

in save()
if self.clean_data['uploadedfile']:
uploadedfile_data = self.clean_data['uploadedfile']
file_path = "path/to/saved/file/%s" % 
(uploadedfile_data['filename'])
save_content_to_file(file_path, 
uploadedfile_data['content'])

and only finally in save_content_to_file()
def save_content_to_file(filename, content):
try:
fileObj = open(filename, "wb")
try:
fileObj.write(content)
finally:
fileObj.close()


So I am guessing I'm consuming quite some memory to deal with this  
incoming request data.
How could I improve my code, so it will use its memory a bit more  
economically?

And is there a way to have the files in the requested post data  
streamed into files on disk directly?

Thanks,
dirk






On 26-jun-2007, at 17:36, Dirk van Oosterbosch, IR labs wrote:

> Hi All,
>
> I deployed an app with uploading functionality to a server running  
> FastCGI.
> When I had it tested by my users, the site became completely  
> unresponsive, returning nothing but Error 500's.
>
> In the log I find a lot of these:
> Unhandled exception in thread started by  ThreadPool._worker of  0x825e10>>
> Traceback (most recent call last):
> File "/usr/local/lib/python2.5/site-packages/flup-0.5-py2.5.egg/ 
> flup/server/threadpool.py", line 103, in _worker
> job.run()
> File "/usr/local/lib/python2.5/site-packages/flup-0.5-py2.5.egg/ 
> flup/server/fcgi_base.py", line 645, in run
> except (select.error, socket.error), e:
> AttributeError: 'NoneType' object has no attribute 'error'
>
> Does anybody know, what could cause this or (better yet) how to fix  
> it?
> best
> dirk



-
Dirk van Oosterbosch
de Wittenstraat 225
1052 AT Amsterdam
the Netherlands

http://labs.ixopusada.com
-



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



Re: all on one server release, ballpark?

2007-06-26 Thread Graham Dumpleton

On Jun 26, 11:00 pm, "Nimrod A. Abing" <[EMAIL PROTECTED]> wrote:
> On 6/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> > I don't want to sound discouraging, but if the answer is at all critical
> > to your operation, you can't trust any numbers you get here. They will
> > not have the same usage patterns as yours. Benchmark, benchmark,
> > benchmark is the only way.
>
> FWIW, I use this:
>
> http://www.joedog.org/JoeDog/Siege
>
> to do stress and load testing as well as benchmarking.
>
> In most of my cases, even a modest machine (1GB memory, dual-core
> Intel [EMAIL PROTECTED]) can handle up to 1,000 hits per minute. By hits I 
> mean
> hits to the Apache server runningmod_pythonwith the Django app. The
> first choking point you're likely to come up with is bandwidth limits.
> But as Malcolm said above, your use case may not be the same as
> everyone else's and you should benchmark your own app to determine
> what your server can handle.

As soon as you add in any degree of database access I would expect
that request rate to drop off somewhat. It is usually the database
which is the bottleneck, not bandwidth limitations. This is part of
the reason for using memcached as that can alleviate database access
issues to a degree.

One other factor to consider is whether prefork or worker MPM is being
used. If you can validate that your application is working okay if run
under worker MPM, then the fact that less Apache child processes are
used with this MPM means that you can reduce your overall memory
consumption. This may be a factor if your application is quite fat and
thus your box is becoming memory constrained even with moderate levels
of traffic. If prefork is used and a large burst in traffic arrives
which causes Apache to start creating additional child processes, in a
system which is already memory constrained, it could result in
physical memory all being used up with processes then having to be
swapped out, thus bogging things down.

PS. Yes Malcolm, I know I have not yet created a ticket about the
documentation and worker vs prefork. Been so busy of late, have a few
dozen things to catch up on my in box. :-)

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?hl=en
-~--~~~~--~~--~--~---



Re: multiple databases

2007-06-26 Thread Jacob Kaplan-Moss

On 6/25/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Ben Ford is working on merging in changes from the trunk in with the
> branch... at this time neither he or myself ( I had planned on doing
> this but found he was farther ahead of me ) have commit permissions to
> the project... but hopefully if he gets finished with it..and we can
> test it out... someone will give him permissions to commit.

Email me and I'll give you guys commit privs.

Jacob

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



Re: Beginner: (db) help with assigning unique names to multiple ForeignKeys

2007-06-26 Thread Tim Chase

> However, because the theme names aren't unique and there can
> be multiple themes with the same name associated with
> different categories, it makes it impossible to choose the 
> correct theme when adding an image.
> 
> For example, if I have the following categories and themes:
> 
> Contact Tables
> - Baseball (theme)
> Glitter Graphics
> - Baseball (theme)


You can use the __str__ method to change the presentation of a theme:

class Theme(Model):
  # rest of definition
  def __str__(self):
return "%s: %s" % (self.category, self.name)

-tim




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



Re: Beginner: (db) help with assigning unique names to multiple ForeignKeys

2007-06-26 Thread rob

Thanks for the help - I actually read abount unique_together shortly
after creating this post. I did have one more question, however.

Each theme has a number of images associated with it (with an Image
model and a theme ForeignKey), so naturally when you go to add an
image via the Admin app, there are the choices of themes to choose
from in the dropdown list. However, because the theme names aren't
unique and there can be multiple themes with the same name associated
with different categories, it makes it impossible to choose the
correct theme when adding an image.

For example, if I have the following categories and themes:

Contact Tables
- Baseball (theme)
Glitter Graphics
- Baseball (theme)

It shows up like this: http://rawb.net/before.png

Would it be possible to have the  HTML show each theme's
parent Category (via the category ForeignKey) so it looks like this:
http://rawb.net/after.png?

Thanks for the help,
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?hl=en
-~--~~~~--~~--~--~---



porting zion SimpleXMLRPCView to current django

2007-06-26 Thread Carl Karsten

I am trying to get  http://svn.zyons.python-hosting.com/trunk/
working under the current django svn.  I'll send .patch to zion's way when I am 
done.

I need a recommendation from someone who has an understanding of what this code 
does.  (I could probably hack it into submission, but that's not good.)

error: __init__() takes 3 arguments (1 given)

# zyons/zilbo/common/forum/views.py
xmlrpc = SimpleXMLRPCView()

# zyons/zilbo/common/utils/xmlrpc.py
from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
class SimpleXMLRPCView(SimpleXMLRPCDispatcher):
  (no init)

# /usr/lib/python2.5/SimpleXMLRPCServer.py
class SimpleXMLRPCDispatcher:
 """Mix-in class that dispatches XML-RPC requests.
 This class is used to register XML-RPC method handlers
 and then to dispatch them. There should never be any
 reason to instantiate this class directly.
 """
 def __init__(self, allow_none, encoding):


further reading:
http://docs.python.org/lib/module-SimpleXMLRPCServer.html
http://code.djangoproject.com/ticket/547
http://code.djangoproject.com/ticket/115
http://zyons.com

Thanks for listening,
Carl K

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



Re: Using reverse() in your urlpatterns

2007-06-26 Thread Todd O'Bryan

On Tue, 2007-06-26 at 19:58 +, Justin wrote:
> On Jun 26, 12:12 pm, Justin <[EMAIL PROTECTED]> wrote:
> > I'm wondering though, is it possible to use reverse() and pass it some
> > args, to use it as the post_save_redirect in generic views?
> 
> On second thought, this is kind of a stupid thing to do in the first
> place... why would I want to avoid hard coding urls in the very same
> file where they are defined? That's a silly thing to do. I think I was
> getting a little too anal there. :)

It's actually not that stupid. If you have urls hard-coded in the
template, you have to make sure that you change them if you change the
url patterns of your app. If you use the {% url %} tag, you can change
the url patterns willy-nilly and only have to make changes if you rename
the patterns or the view functions.

Following this pattern would seem to make it easier to make apps
portable.

Todd


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



RE: Beginner: (db) help with assigning unique names to multiple ForeignKeys

2007-06-26 Thread Chris Brand

> I have a "Category" and "Theme" table. Each category can have a number
> of themes, and while a theme with the same name can belong to
> different categories, more than one theme with the same name shouldn't
> belong to the same category. I'm having a hard time figuring out how
> to set this up with Django

Sounds like you want unique_together :
http://www.djangoproject.com/documentation/model-api/#unique-together

I haven't used it myself.

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?hl=en
-~--~~~~--~~--~--~---



Re: Beginner: (db) help with assigning unique names to multiple ForeignKeys

2007-06-26 Thread Tim Chase

> class Category(models.Model):
> name = models.CharField(maxlength=50, unique=True)
> 
> class Theme(models.Model):
> category = models.ForeignKey(Category)
> name = models.CharField(maxlength=50, unique=True)
> 
> And an example of what I'd like:
> 
> This obviously doesn't work because if I try to create two themes with
> the same name but in a different category (using the Admin app), it'll
> complain that a theme with the same name already exists.
> 
> Can anyone help me with solving this problem?

http://www.djangoproject.com/documentation/model-api/#unique-together

class Theme(models.Model):
category = models...
name = models... # without unique constraint
class Meta:
unique_together = (
("category", "name"),
)

-tim




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



Beginner: (db) help with assigning unique names to multiple ForeignKeys

2007-06-26 Thread rob

I have a "Category" and "Theme" table. Each category can have a number
of themes, and while a theme with the same name can belong to
different categories, more than one theme with the same name shouldn't
belong to the same category. I'm having a hard time figuring out how
to set this up with Django. Right now, my models.py looks like this
(simplified):

class Category(models.Model):
name = models.CharField(maxlength=50, unique=True)

class Theme(models.Model):
category = models.ForeignKey(Category)
name = models.CharField(maxlength=50, unique=True)

And an example of what I'd like:

This obviously doesn't work because if I try to create two themes with
the same name but in a different category (using the Admin app), it'll
complain that a theme with the same name already exists.

Can anyone help me with solving this problem?

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?hl=en
-~--~~~~--~~--~--~---



Re: Using reverse() in your urlpatterns

2007-06-26 Thread Justin

On Jun 26, 12:12 pm, Justin <[EMAIL PROTECTED]> wrote:
> I'm wondering though, is it possible to use reverse() and pass it some
> args, to use it as the post_save_redirect in generic views?

On second thought, this is kind of a stupid thing to do in the first
place... why would I want to avoid hard coding urls in the very same
file where they are defined? That's a silly thing to do. I think I was
getting a little too anal there. :)


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



Re: database error instead of 400

2007-06-26 Thread Brian St. Pierre

On Jun 25, 7:30 pm, Francis Lavoie <[EMAIL PROTECTED]> wrote:
> OperationalError: unable to open database file

An addition to the page that Ramiro pointed to: the webserver user
needs (at least) execute permission (d--x--x--x) on every directory
below the one that holds the database file. Otherwise apache can't
even see the file or the parent directory.


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



Newforms Attribute Errors

2007-06-26 Thread robo

Hopefully you guys can spot an error I've not been able to. This is
the error I get:

AttributeError at /vendor/Chef/1/
'Order_DetailForm' object has no attribute 'save'
Request Method: POST
Request URL: http://192.168.1.104:8000/vendor/Chef/1/
Exception Type: AttributeError
Exception Value: 'Order_DetailForm' object has no attribute 'save'

My view:
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.newforms import form_for_model

def vendor(request, vendor_name, vendor_id):
  OrderForm = form_for_model(Order)
  OrderDetailForm = form_for_model(Order_Detail)
  cart_id = find_order(manager_id)

  if request.method == 'POST':
form = OrderDetailForm(request.POST)
if cart_id != 0:
  if form.is_valid():.
new_detail = form.save(commit=False)
return HttpResponseRedirect(".")
  else:
form = OrderDetailForm(detail_form_data)

  return render_to_response("vendor/" + vendor_name + ".html",
locals())

I tried .is_bound and a similar problem came up. Basically I can't
access some functions and fields that're available from
form_for_model. I also tried commenting out the save, creating valid =
form.is_valid() and printing it out. It printed out "True", therefore
my form is valid, but the thing is I cannot save.

Also, the error "'Order_DetailForm' object has no attribute 'save'"
doesn't look right. Isn't it supposed to be "'OrderDetailForm' object
has no attribute 'save'" because I defined OrderDetailForm, not
Order_DetailForm?

Thanks for the help


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



Re: python manage.py startapp freepostcards

2007-06-26 Thread John M

Good Luck and have fun.

Make sure you post all your pictures on www.tabblo.com (a django site
of course).

J

On Jun 25, 9:20 pm, Kelvin Nicholson <[EMAIL PROTECTED]> wrote:
> Dear Djangoers:
>
> I have thoroughly enjoyed the last few months on this list, yet I must
> take a temporary leave.  Starting on the 30th I'm heading for a tour
> around SE Asia -- Hong Kong, China, Tibet, Laos, Cambodia and Vietnam.
> Eventually I will end up in Sydney.
>
> So why am I making this public?  I wanted to make an offer to the
> community: if you want a postcard, shoot me a private email with a
> mailing address or PO box.  There are going to be some long bus/train
> rides, and I need something to kill the time with.
>
> If you receive a postcard and feel like dropping a dollar into my paypal
> account to cover postage, that would be nice, but certainly not
> necessary.
>
> Cheers to Django,
>
> Kelvin
>
> --
> Kelvin Nicholson
> Voice: +886 9 52152 336
> Voice: +1 503 715 5535
> GPG Keyid: 289090AC
> Data: [EMAIL PROTECTED]
> Skype: yj_kelvin
> Site:http://www.kelvinism.com


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



Resolved: CachedDnsName - very slow under apache/mod_python ...

2007-06-26 Thread ZebZiggle

Upgraded mod_python to latest version and upgraded python 2.4.x ...
problem gone away.

Go figure.

Thanks 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?hl=en
-~--~~~~--~~--~--~---



Using reverse() in your urlpatterns

2007-06-26 Thread Justin

I've just been screwing around with my urlpatterns, trying to clean
them up. Mostly, I've been trying to remove all hard coded urls
wherever they are, in templates and whatnot, by adding a name="foo" to
my urlpatterns and then accessing them with {% url %} and reverse().

I'm wondering though, is it possible to use reverse() and pass it some
args, to use it as the post_save_redirect in generic views? I've been
trying to get it to work, but no luck so far... maybe I'm not passing
the args properly? Or maybe it's not even possible?

from django.conf.urls.defaults import *
from django.views.generic.list_detail import object_detail
from django.views.generic.create_update import create_object
from django.core.urlresolvers import reverse
from apps.myapp.models import MyThing
urlpatterns = patterns('',
(r'^view/(?P\d+)/$', object_detail,
{'queryset' : MyThing.objects.all() },
'mything-view'),
(r'^create/$', create_object,
{'model' : MyThing,
'post_save_redirect' : reverse('mything-view', args=(id,)) },
'mything-create'),
)


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



Re: Django admin saving image file - 500 error

2007-06-26 Thread john-f

Thanks again guys - you guys are awesome!

On Jun 26, 1:49 pm, Christian Markwart Hoeppner <[EMAIL PROTECTED]>
wrote:
> > Apparently the mysite.fcgi file was not being automatically created
> > when I used the fcgi startup script to start the site. So I went into
> > the directory and did a `touch mysite.fcgi`  then a good old chown
> > lighttd:lightd mysite.fcgi  and it a magical thing happened - it
> > started working.
>
> I was just about to tell you to have a look at the fcgi file. Glad you
> solved it.
>
> Sincerely,
> Chris Hoeppnerwww.pixware.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?hl=en
-~--~~~~--~~--~--~---



Template "taglib" library?

2007-06-26 Thread Rob Hudson

Hello,

While looking at the Lost Theories source code (thanks Jeff Croft!) I
saw he's using what looks like a real handy library called "taglib".
I can't find taglib and it may well be a personal library.

But one use case caught my eye:

In theories/theory_list.html he's defining a "paginator" block at the
top with prev/next links and calls that block above and below the
resulting list, so in effect, defining a block to use twice.

That seems handy.

I haven't tried it yet but I suppose you could create a paginator.html
file and include it twice in your template, but defining it in-
template saves a couple file system calls and seems useful if that's
the only place you'll be using that.

-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?hl=en
-~--~~~~--~~--~--~---



Re: Django admin saving image file - 500 error

2007-06-26 Thread Christian Markwart Hoeppner


> Apparently the mysite.fcgi file was not being automatically created
> when I used the fcgi startup script to start the site. So I went into
> the directory and did a `touch mysite.fcgi`  then a good old chown
> lighttd:lightd mysite.fcgi  and it a magical thing happened - it
> started working.

I was just about to tell you to have a look at the fcgi file. Glad you
solved it.

Sincerely,
Chris Hoeppner
www.pixware.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?hl=en
-~--~~~~--~~--~--~---



Re: Django admin saving image file - 500 error

2007-06-26 Thread akonsu

hello,

i remember i got this error when i tried to save a file because my
database's auto field sequences were not set up correctly. i am using
postgresql and i use fixtures to populate the database. so there were
a bug in fixtures that did not set sequences in postgresql correctly
(i think it might be fixed now), so i was getting this error.

hope this helps
konstantin

On Jun 26, 12:50 pm, john-f <[EMAIL PROTECTED]> wrote:
> HI Thanks for the reply - I really appreciate it. The problem however
> still occurs:
>
> Here's whats happening:
> 1. user "apache" is added to group "lighttpd"
> 2. when I chmod 777 it seems to work
> 3. when I change the file permissions back and save using the django
> admin the 500 errror occurs. but i think the image IS saved there.
>
> Here is what i see in the apache logs:
> 
> [Mon Jun 25 18:17:31 2007] [error] [client 206.191.88.168]
> (111)Connection refused: FastCGI: failed to connect to server "/var/
> www/www.canadianfamily.ca/mysite.fcgi": connect() failed
> [Mon Jun 25 18:17:31 2007] [error] [client 206.191.88.168] FastCGI:
> incomplete headers (0 bytes) received from server 
> "/var/www/www.canadianfamily.ca/mysite.fcgi"
> [Mon Jun 25 18:17:31 2007] [error] [client 206.191.88.168]
> (111)Connection refused: FastCGI: failed to connect to server "/var/
> www/www.canadianfamily.ca/mysite.fcgi": connect() failed
> [Mon Jun 25 18:17:31 2007] [error] [client 206.191.88.168] FastCGI:
> incomplete headers (0 bytes) received from server 
> "/var/www/www.canadianfamily.ca/mysite.fcgi"
> [Mon Jun 25 18:17:32 2007] [error] [client 206.191.88.168]
> (111)Connection refused: FastCGI: failed to connect to server "/var/
> www/www.canadianfamily.ca/mysite.fcgi": connect() failed
> [Mon Jun 25 18:17:32 2007] [error] [client 206.191.88.168] FastCGI:
> incomplete headers (0 bytes) received from server 
> "/var/www/www.canadianfamily.ca/mysite.fcgi"
> [Mon Jun 25 18:17:32 2007] [error] [client 206.191.88.168]
> (111)Connection refused: FastCGI: failed to connect to server "/var/
> www/www.canadianfamily.ca/mysite.fcgi": connect() failed
> [Mon Jun 25 18:17:32 2007] [error] [client 206.191.88.168] FastCGI:
> incomplete headers (0 bytes) received from server 
> "/var/www/www.canadianfamily.ca/mysite.fcgi"
> [Mon Jun 25 18:31:18 2007] [error] [client 142.167.136.101]
> (104)Connection reset by peer: FastCGI: comm with server 
> "/var/www/www.canadianfamily.ca/mysite.fcgi" aborted: read failed, 
> referer:http://www.canadianfamily.ca/contests/18/entered/
> [Mon Jun 25 18:31:18 2007] [error] [client 142.167.136.101] FastCGI:
> incomplete headers (0 bytes) received from server 
> "/var/www/www.canadianfamily.ca/mysite.fcgi", 
> referer:http://www.canadianfamily.ca/contests/18/entered/
> 


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



Re: Django admin saving image file - 500 error

2007-06-26 Thread john-f

Hey Just and update:

Apparently the mysite.fcgi file was not being automatically created
when I used the fcgi startup script to start the site. So I went into
the directory and did a `touch mysite.fcgi`  then a good old chown
lighttd:lightd mysite.fcgi  and it a magical thing happened - it
started working.

Thanks for all you help.

John


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



Re: zyons GenericForeignKey

2007-06-26 Thread Jay Parlar

On 6/26/07, Carl Karsten <[EMAIL PROTECTED]> wrote:
> didn't grep enough:
>
> django/contrib/contenttypes/generic.py:
> class GenericForeignKey()
>
> How do I 'use' generic.py ?


Just change the import. There was a backwards incompatible change made
to Generic keys recently, and I guess Ian Holsman hasn't yet updated
Zyons to match.

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Genericrelationshavemoved

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?hl=en
-~--~~~~--~~--~--~---



Re: Django admin saving image file - 500 error

2007-06-26 Thread john-f

HI Thanks for the reply - I really appreciate it. The problem however
still occurs:


Here's whats happening:
1. user "apache" is added to group "lighttpd"
2. when I chmod 777 it seems to work
3. when I change the file permissions back and save using the django
admin the 500 errror occurs. but i think the image IS saved there.

Here is what i see in the apache logs:

[Mon Jun 25 18:17:31 2007] [error] [client 206.191.88.168]
(111)Connection refused: FastCGI: failed to connect to server "/var/
www/www.canadianfamily.ca/mysite.fcgi": connect() failed
[Mon Jun 25 18:17:31 2007] [error] [client 206.191.88.168] FastCGI:
incomplete headers (0 bytes) received from server "/var/www/
www.canadianfamily.ca/mysite.fcgi"
[Mon Jun 25 18:17:31 2007] [error] [client 206.191.88.168]
(111)Connection refused: FastCGI: failed to connect to server "/var/
www/www.canadianfamily.ca/mysite.fcgi": connect() failed
[Mon Jun 25 18:17:31 2007] [error] [client 206.191.88.168] FastCGI:
incomplete headers (0 bytes) received from server "/var/www/
www.canadianfamily.ca/mysite.fcgi"
[Mon Jun 25 18:17:32 2007] [error] [client 206.191.88.168]
(111)Connection refused: FastCGI: failed to connect to server "/var/
www/www.canadianfamily.ca/mysite.fcgi": connect() failed
[Mon Jun 25 18:17:32 2007] [error] [client 206.191.88.168] FastCGI:
incomplete headers (0 bytes) received from server "/var/www/
www.canadianfamily.ca/mysite.fcgi"
[Mon Jun 25 18:17:32 2007] [error] [client 206.191.88.168]
(111)Connection refused: FastCGI: failed to connect to server "/var/
www/www.canadianfamily.ca/mysite.fcgi": connect() failed
[Mon Jun 25 18:17:32 2007] [error] [client 206.191.88.168] FastCGI:
incomplete headers (0 bytes) received from server "/var/www/
www.canadianfamily.ca/mysite.fcgi"
[Mon Jun 25 18:31:18 2007] [error] [client 142.167.136.101]
(104)Connection reset by peer: FastCGI: comm with server "/var/www/
www.canadianfamily.ca/mysite.fcgi" aborted: read failed, referer:
http://www.canadianfamily.ca/contests/18/entered/
[Mon Jun 25 18:31:18 2007] [error] [client 142.167.136.101] FastCGI:
incomplete headers (0 bytes) received from server "/var/www/
www.canadianfamily.ca/mysite.fcgi", referer: 
http://www.canadianfamily.ca/contests/18/entered/




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



multiple OneToOne fields pointing to the same table

2007-06-26 Thread Charles Wesley

I want a model where a single table has two OneToOne fields pointing
back to another table. Here's the trivial example:


class Trivial(models.Model):
pass

class Multiple(models.Model):
one_trivial = models.OneToOneField(Trivial,
related_name="one_trivial")
two_trivial = models.OneToOneField(Trivial,
related_name="two_trivial")

This breaks at syncdb using MySQL (error: 1068, 'Multiple primary key
defined'). So is this a problem with MySQL or Django? Is my best bet
to just turn those OneToOneFields into ForeignKeys with
max_num_in_admin = 1?

Thanks,
charles


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



Re: Forms and formating error messages

2007-06-26 Thread AnaReis

I managed to solve this:

from Manager.utils.newforms import TemplatedForm


Thanks for the help!

Ana


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



Re: Django admin saving image file - 500 error

2007-06-26 Thread Christian Markwart Hoeppner

El mar, 26-06-2007 a las 08:14 -0700, john-f escribió:
> Hi all,
> 
> I'm getting 500 errors when trying to upload a image file with the
> django admin.
> I think this has to do with user/group permissions on the media
> directory (currently they are owned by lighttpd:lighttd)
> Does anyone know what 'user' is being run to actually do the saves? I
> think it's the apache user but I could be wrong.
> Anyways in my group file I added apache to the lighttd group.
> 
> Does anyone have any ideas? I'd appreciate the help. Thanks.
> 
> My setup:
> Apache and fast_cgi serves the django pages
> Lighttpd serves media
> Db run off another server

Of course, the media you're saving is being processed by python, and
that's apache, if that config is right. Lighttpd is *serving* static
files, but upload is being done by apache.

Make sure the directory (and, just in case, it's parent) is writable by
the appropiate user or group. If unsure, set to 777 to see if it's a
permission problem, and don't forget to set it back to something more
secure once your test is done.

Have a look at apache logs (error logs specially) and make sure django
has DEBUG = True. If with DEBUG on you're still getting 500 pages (and
not a django error page), the problem will be reported in apache's error
log, scattered through a few lines, so remember to look further upwards
than the last line.

Be sure to write back with your results, even if they're good. We like
to know if we're helping or just dropping dumb lines :)

Good Luck,
Chris Hoeppner
www.pixware.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?hl=en
-~--~~~~--~~--~--~---



Re: Meta class preventing table add

2007-06-26 Thread Charles Wesley

I am using MySQL. Thanks for clearing that up!

charles

On Jun 25, 3:02 pm, Brian Rosner <[EMAIL PROTECTED]> wrote:
> On 2007-06-25 14:10:30 -0600, Charles Wesley <[EMAIL PROTECTED]> said:
>
>
>
>
>
> > Hello,
>
> > I'm a Django newbie, and I'm trying to set up a model that includes
> > the following table:
>
> > class Team(models.Model):
> > school = models.ForeignKey(School,
> > unique_for_year="season_start_date")
> > season_start_date = models.DateField()
> > division = models.ForeignKey(Division)
> > coach_first = models.CharField("coach's first name", maxlength=50,
> > blank=True)
> > coach_last = models.CharField("coach's last name", maxlength=50,
> > blank=True)
> > coach_email = models.EmailField("coach's email address",
> > blank=True)
> > coach_phone = models.PhoneNumberField("coach's phone", blank=True)
> > team_picture = models.ImageField(upload_to="team", blank=True)
> > players = models.ManyToManyField(Player, blank=True)
>
> > class Admin:
> > pass
>
> > class Meta:
> > order_with_respect_to = 'school'
>
> > When trying to add a team in the Django admin interface, I get this
> > error:
>
> > Traceback (most recent call last):
> > File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in
> > get_response
> >   77. response = callback(request, *callback_args, **callback_kwargs)
> > File "C:\Python25\lib\site-packages\django\contrib\admin\views
> > \decorators.py" in _checklogin
> >   55. return view_func(request, *args, **kwargs)
> > File "C:\Python25\lib\site-packages\django\views\decorators\cache.py"
> > in _wrapped_view_func
> >   39. response = view_func(request, *args, **kwargs)
> > File "C:\Python25\lib\site-packages\django\contrib\admin\views
> > \main.py" in add_stage
> >   254. new_object = manipulator.save(new_data)
> > File "C:\Python25\lib\site-packages\django\db\models\manipulators.py"
> > in save
> >   108. new_object.save()
> > File "C:\Python25\lib\site-packages\django\db\models\base.py" in save
> >   238. ','.join(placeholders)), db_values)
> > File "C:\Python25\lib\site-packages\django\db\backends\util.py" in
> > execute
> >   12. return self.cursor.execute(sql, params)
> > File "C:\Python25\lib\site-packages\MySQLdb\cursors.py" in execute
> >   166. self.errorhandler(self, exc, value)
> > File "C:\Python25\lib\site-packages\MySQLdb\connections.py" in
> > defaulterrorhandler
> >   35. raise errorclass, errorvalue
>
> >   OperationalError at /admin/football/team/add/
> >   (1093, "You can't specify target table 'football_team' for update in
> > FROM clause")
>
> > which appears to stem from this SELECT statement:
>
> > "INSERT INTO `football_team`
> > (`school_id`,`season_start_date`,`division_id`,`coach_first`,`coach_last`,`coach_email`,`coach_phone`,`team_picture`,`_order`)
> VALUES
>
> > ('2','2005-09-10','2','','','','','',(SELECT COUNT(*) FROM
> > `football_team` WHERE `school_id` = '2'))"
>
> > This error disappears if I remove the Meta class. So what am I doing
> > wrong when I include it?
>
> > Thanks,
> > charles
>
> You are probably using MySQL.  It is a known problem and even if that
> did work, there currently isn't any admin interface to work it yet.
> That will be a fix of the newforms-admin branch.
>
> Tickets:
>
> http://code.djangoproject.com/ticket/1760
> andhttp://code.djangoproject.com/ticket/2137
>
> --
> Brian Rosnerhttp://www.brosner.com/blog


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



Strange Errors with FastCGI when uploading files

2007-06-26 Thread Dirk van Oosterbosch, IR labs
Hi All,

I deployed an app with uploading functionality to a server running  
FastCGI.
When I had it tested by my users, the site became completely  
unresponsive, returning nothing but Error 500's.

In the log I find a lot of these:
Unhandled exception in thread started by >
Traceback (most recent call last):
   File "/usr/local/lib/python2.5/site-packages/flup-0.5-py2.5.egg/ 
flup/server/threadpool.py", line 103, in _worker
 job.run()
   File "/usr/local/lib/python2.5/site-packages/flup-0.5-py2.5.egg/ 
flup/server/fcgi_base.py", line 645, in run
 except (select.error, socket.error), e:
AttributeError: 'NoneType' object has no attribute 'error'

Does anybody know, what could cause this or (better yet) how to fix it?
best
dirk



-
Dirk van Oosterbosch
de Wittenstraat 225
1052 AT Amsterdam
the Netherlands

http://labs.ixopusada.com
-



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



Re: admin forms lose javascript with mod_python

2007-06-26 Thread waylan

First check your browser settings. Is javascript enabled? Clear your
cache and then see if you can still load the js files directly. When
faced with situations like this I like to use the "Live HTTP Headers"
extension for Firefox to see whats really going on. Of course, you
could always avoid the browser and use wget (or curl) from the command
line to see if you can access the js files directly. If it is, in
fact, not a browser issue, report back and we'll see what we can do.

Hmm, before sending I reread your message and it occurs to me that as
is works with the dev server but not through apache/mod_python that
you may have some apache setting (cache related??) that's confusing
the browser. Although that doesn't make much sense if the css is
working. Either way, do the checks I suggest above and look closely at
the response headers from both servers.

On Jun 26, 7:56 am, Eric St-Jean <[EMAIL PROTECTED]> wrote:
> I have a weird problem where if i run django standalone, i see the
> calendar widget by a DateField entry in the admin form, but when run
> from mod_python, i lose it. (i lose the calendar date picking widget,
> and the "today" shortcut)
> /media *is* working - the css gets loaded properly. I'm using the same
> browser in both instances. If i load firebug, it sees the javascript
> files - i do think they are being served by apache along with the css (
> i can look at them from the browser as well). But the widget doesn't
> appear, and i have to enter the date by hand. I was using the debian
> testing django (some form of 0.96), but then also tried trunk, with the
> same results (i even removed the deb package to be absolutely sure it
> wasn't used).
> This is django trunk (as of yesterday), with apache 2.2.3-4 and
> mod_python 3.2.10-4, python 2.4.4-2 on debian 4.0.
>
> Any quick ideas???
> Thanks


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



Re: Forms and formating error messages

2007-06-26 Thread AnaReis

Hum... I tried to test the imports on IDLE but I couldn't import the
file in anyway I tried..
I went to the  Path Browser on IDLE and I couldn't find the
newforms.py file that I created. I then noticed that in all the other
folders there was a file named __init__.py, so I copied one of those
init files to the utils folder. Now my IDLE shows this file on the
Path.
I tried to import the TemplatedForm, but I still get this error:
from Manager.utils import TemplatedForm

Traceback (most recent call last):
  File "", line 1, in 
from Manager.utils import TemplatedForm
ImportError: cannot import name TemplatedForm

Why can't it import the thing?


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



Re: list_filter in newforms-admin doesn't worj

2007-06-26 Thread abe

ok, I'll do that. thanks

-E

On Jun 26, 5:13 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2007-06-25 at 16:10 +, abe wrote:
>
> > I'm using the newforms-admin branch, and have specified
> > some admin options for a Experiment model like this
>
> > class ExperimentalDataOptions(admin.ModelAdmin):
> > list_display =
> > ('project_name','experiment_nr','experiment_date','short_title')
> > search_fields =
> > ('experiment_nr','project_name','experiment_date','title')
> > list_filter =   ('project_name',) #
> > 'experiment_date','project_name',)
>
> > if I leaveout the list_filter line it works ok.
> > with list_filter I get the following message
>
> > AttributeError at /yyy/admin/zb/experimentaldata/
> > type object 'ModelAdmin' has no attribute 'manager'
> > Request Method:GET
> > Request URL:  https://xxx.xxx.xxx.xxx/yyy/admin/zb/experimentaldata/
> > Exception Type:AttributeError
> > Exception Value:   type object 'ModelAdmin' has no attribute 'manager'
> > Exception Location:/usr/lib/python2.3/site-packages/django/contrib/
> > admin/filterspecs.py in __init__, line 161
> > Python Executable: /usr/bin/python
> > Python Version:2.3.4
>
> > Any idea how to get this working?
>
> I can't immediately see what is wrong. You'll either have to dive into
> the code and work out what should be happening, or file a ticket in
> Trac. Bugs reported to this list are not too likely to be remembered by
> the newforms-admin developers when they next come to work on the code.
> It's just too high-volume here to be an effective bug reporting forum.
>
> If you do file a ticket, include the smallest example possible that
> fails. That might be a single field model with an admin class that only
> has list_filter or something. That will make it easier for somebody to
> repeat the problem.
>
> Regards,
> Malcolm


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



Re: ForeignKey

2007-06-26 Thread Jens Diemer

Christopher schrieb:
> class Menu(models.Model):
>   display_text = models.CharField(maxlength=50)
>   url = models.URLField(verify_exists=False)
>   parent_menu_item = models.ForeignKey(Menu)
> 
> totalimpact.menu: name 'Menu' is not defined

"""
If you need to create a relationship on a model that has not yet been defined, 
you can use the name of the model, rather than the model object itself:
"""

change:
parent_menu_item = models.ForeignKey(Menu)
to this:
parent_menu_item = models.ForeignKey("Menu")

-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.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?hl=en
-~--~~~~--~~--~--~---



Re: CachedDnsName - very slow under apache/mod_python ...

2007-06-26 Thread ZebZiggle

This gets even more weird.

I copied the send_mass_mail() code from django.core.mail into my
module so I could orchestrate it.

I changed the DNS_NAME lookup to a hardcoded string and then got the
15s delay on the smtplib.SMTP(settings.EMAIL_HOST,
settings.EMAIL_PORT) line?!

So, perhaps the cache hit is working on subsequent tries, but only
slow the first time through. There still seems to be a problem on with
any of the bind operations, including SMTP().

Yet, it works fine from the command line or dev. I tried it on another
site I run and it's fine also. Just something weird about this one
configuration.

I'm sure this is not a django problem anymore ... any apache/mod-
python/network experts in the house?

-S


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



Several django site in one fastcgi process?

2007-06-26 Thread Vladimir Pouzanov

Hi all,

I'm running several django sites on lighttpd server. Sites are simple
and I don't like the idea of spawning so much python processes that
eat my precious memory. Is it possible somehow to run several sites in
one fcgi server?

-- 
Sincerely,
Vladimir "Farcaller" Pouzanov
http://hackndev.com

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



zyons GenericForeignKey

2007-06-26 Thread Carl Karsten

This is probably a zyons problem, but maybe someone here can help this nifty 
project.

[EMAIL PROTECTED]:~/django/zyons/zilbo$ ./manage.py syncdb
Error: Couldn't install apps, because there were errors in one or more models:
zilbo.common.comment: 'module' object has no attribute 'GenericForeignKey'
zilbo.common.event: 'module' object has no attribute 'GenericForeignKey'
zilbo.common.counter: 'module' object has no attribute 'GenericForeignKey'
zilbo.common.forum: 'module' object has no attribute 'GenericForeignKey'
zilbo.common.tag: 'module' object has no attribute 'GenericForeignKey'


[EMAIL PROTECTED]:~/django/zyons/zilbo$ grep -r --include "*.py" GenericF *
common/comment/models.py:content_object = models.GenericForeignKey()

The server was running, so I hit it with a browser, below is the dump.

Carl K

Traceback (most recent call last):

   File "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", 
line 
272, in run
 self.result = application(self.environ, self.start_response)

   File "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", 
line 
614, in __call__
 return self.application(environ, start_response)

   File "/usr/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 
193, in __call__
 response = middleware_method(request, response)

   File 
"/usr/lib/python2.5/site-packages/django/contrib/sessions/middleware.py", line 
92, in process_response
 obj = Session.objects.get_new_session_object()

   File "/usr/lib/python2.5/site-packages/django/contrib/sessions/models.py", 
line 37, in get_new_session_object
 obj, created = self.get_or_create(session_key=self.get_new_session_key(),

   File "/usr/lib/python2.5/site-packages/django/contrib/sessions/models.py", 
line 21, in get_new_session_key
 self.get(session_key=session_key)

   File "/usr/lib/python2.5/site-packages/django/db/models/manager.py", line 
73, 
in get
 return self.get_query_set().get(*args, **kwargs)

   File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line 257, 
in get
 obj_list = list(clone)

   File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line 110, 
in __iter__
 return iter(self._get_data())

   File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line 477, 
in _get_data
 self._result_cache = list(self.iterator())

   File "/usr/lib/python2.5/site-packages/django/db/models/query.py", line 185, 
in iterator
 cursor.execute("SELECT " + (self._distinct and "DISTINCT " or "") + 
",".join(select) + sql, params)

   File "/usr/lib/python2.5/site-packages/django/db/backends/util.py", line 18, 
in execute
 return self.cursor.execute(sql, params)

   File "/usr/lib/python2.5/site-packages/MySQLdb/cursors.py", line 164, in 
execute
 self.errorhandler(self, exc, value)

   File "/usr/lib/python2.5/site-packages/MySQLdb/connections.py", line 35, in 
defaulterrorhandler
 raise errorclass, errorvalue

ProgrammingError: (1146, "Table 'dj.django_session' doesn't exist")

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



Re: Calling System Commands

2007-06-26 Thread skam

On 26 Giu, 16:24, "va:patrick.kranzlmueller"
<[EMAIL PROTECTED]> wrote:
> see:http://code.djangoproject.com/wiki/PyCallTag
>
> patrick
>

Really really bad (and OT). Please don't encourage the use of this
tag, it breaks MVC. Never mix html with programming logic.


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



Re: Calling System Commands

2007-06-26 Thread Jay Parlar

On 6/26/07, Moses Ting <[EMAIL PROTECTED]> wrote:
>
> That's what I thought, but running the following command via a web
> request returns lines of length 0.
>
> command = 'c:\path\plink -ssh [EMAIL PROTECTED] -pw password dir'
> lines = os.popen(command).readlines()
>
> The exact command works just fine when ran from either a regular
> python prompt or within the Django shell.

Are you running this with the dev server, or Apache? Because with
Apache, the permissions might not be there to allow it to run ssh. Or
there might be some weird relation between how an Apache
process/thread interacts with popen. I don't use Windows, so I'm not
sure about that.

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?hl=en
-~--~~~~--~~--~--~---



Re: Calling System Commands

2007-06-26 Thread Tim Chase

> That's what I thought, but running the following command via a web
> request returns lines of length 0.
> 
> command = 'c:\path\plink -ssh [EMAIL PROTECTED] -pw password dir'
> lines = os.popen(command).readlines()

A couple things I'd check:

1) use raw strings when subjecting yourself to DOS path seperators:

   command = r'c:\path\plink...'

2) make sure that plink/putty/whatever has already attached to 
the server so there's no attempt by it to confirm the server 
fingerprint.

> The exact command works just fine when ran from either a regular
> python prompt or within the Django shell.

As Jay mentioned, it's only python code.  If it works in both the 
python prompt and the django shell, it should also work in the 
code, presuming you've gotten it verbatim.

As a simple test, just create a test line program:

   import os
   command = r'c:\path\to\plink ...'
   results = os.popen(command).readlines()
   print repr(results)

This eliminates Django from the picture entirely.  Once you get 
this working, it should be a drop-in to your Django code.

-tim



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



Plat_Forms web development survey

2007-06-26 Thread willhardy

Dear Django web developers,

I'm currently part of a research team at the Free University of
Berlin, looking into the ways in which the major web development
platforms differ. In addition to our work with the Plat_Forms contest,
we're now looking for some actual professional opinions.

If you have practical experience in the development of non-trivial web
applications with two or more web development languages then we would
like you to participate in a short survey. Given that we were unable
to attract 3 sufficiently expert Django teams for the contest, we
would like to have as many Django developers as possible complete the
survey to get some insight into how it compares to other platforms.
The survey itself runs on Django.

The questionnaire asks you about your experiences and opinions on two
of the web development languages you have used, and should take about
10-15 minutes to complete. To thank you for your participation, you
will be able to provide an email address and we will send you our
final report when we are finished compiling it.

http://www.plat-forms.org/survey/

We look forward to your answers and experiences, let me know via email
if you have any questions: [EMAIL PROTECTED]

Will Hardy
Plat_Forms survey team


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



Re: Calling System Commands

2007-06-26 Thread va:patrick.kranzlmueller

sorry, didn´t read carefully enough.
the cookbook example refers to a template (not a view).

patrick

Am 26.06.2007 um 16:24 schrieb va:patrick.kranzlmueller:

>
> see:
> http://code.djangoproject.com/wiki/PyCallTag
>
> patrick
>
> Am 26.06.2007 um 16:22 schrieb Moses Ting:
>
>>
>> Does anyone know if it's possible to make a system command call  
>> from a
>> Django view?  For example, I'd like to make the following call
>> straight from Django.
>>
>> import os
>> os.system('echo Hello World')
>>
>> Thanks
>>
>>
>>>
>
>
> >


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



Re: Calling System Commands

2007-06-26 Thread Moses Ting

That's what I thought, but running the following command via a web
request returns lines of length 0.

command = 'c:\path\plink -ssh [EMAIL PROTECTED] -pw password dir'
lines = os.popen(command).readlines()

The exact command works just fine when ran from either a regular
python prompt or within the Django shell.

Moses

On Jun 26, 10:28 am, "Jay Parlar" <[EMAIL PROTECTED]> wrote:
> On 6/26/07, Moses Ting <[EMAIL PROTECTED]> wrote:
>
>
>
> > Does anyone know if it's possible to make a system command call from a
> > Django view?  For example, I'd like to make the following call
> > straight from Django.
>
> > import os
> > os.system('echo Hello World')
>
> A view is just a regular Python function, you can do whatever you want.
>
> 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?hl=en
-~--~~~~--~~--~--~---



Re: Problem: locale.getdefaultlocale() returns (None, None) under apache2...

2007-06-26 Thread Jens Diemer

Malcolm Tredinnick schrieb:
> On Tue, 2007-06-26 at 23:28 +1000, Malcolm Tredinnick wrote:
> [...]
>> The code itself is not catching all the right exceptions that can be
>> raised: the idea was that if getdefaultlocale() returns something we
>> can't use, it should just return no timezone. I'll give it another look
>> and put in some more fallbacks.
> 
> This should be fixed in [5546].

Yes, now it fallback to "ascii"

-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.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?hl=en
-~--~~~~--~~--~--~---



Re: Calling System Commands

2007-06-26 Thread va:patrick.kranzlmueller

see:
http://code.djangoproject.com/wiki/PyCallTag

patrick

Am 26.06.2007 um 16:22 schrieb Moses Ting:

>
> Does anyone know if it's possible to make a system command call from a
> Django view?  For example, I'd like to make the following call
> straight from Django.
>
> import os
> os.system('echo Hello World')
>
> Thanks
>
>
> >


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



Re: Send a filter-pipline output to a template tag

2007-06-26 Thread Manuel Meyer

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

THANKS!

I will try that!

Manuel

Am 26.06.2007 um 15:36 schrieb Aidas Bendoraitis:

>
> Use the {% with %} template tag for that:
>
> {% with variable|some_filter as some_list %}
>{% for el in some_list %}
>{% do_something el %}
>{% endfor %}
> {% endwith %}
>
> Regards,
> Aidas Bendoraitis aka Archatas
>
>
> On 6/25/07, Manuel Meyer <[EMAIL PROTECTED]> wrote:
>>
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA256
>>
>> Hey,
>>
>> is it possible, to send a output, generated by a filter pipeline
>> chain to a template tag?
>> I want to split a page's tag, that is already processed by the
>> reStructuredText filter and a link generation filter, in several
>> subtexts to mix it with the page's images.
>>
>> Thanks!
>> Manuel
>> -BEGIN PGP SIGNATURE-
>> Version: GnuPG v1.4.6 (Darwin)
>>
>> iQEVAwUBRoACqzOKNHIOcnYMAQj9PAgAsXDuV+ggJ0yPh8+l8D2enRW/LrMxK+wB
>> fvN1RjCDlO06htexWJcRIttfgjq3yPhXOGbNOnu2GFZ/gRdstofKICOGMPGai0A5
>> 8j8dzhgaK+684A5heTsUlcvgeRacEIYFmqWaLIWi0dKV8JxibbFbARt0YCbQUJF6
>> znGyfHiNcOR2EGMfmyyNZGzDJz5xX3z68OaaApjbTzDVU7zuubkZYvV6af/AOanO
>> q0hEJ5BmdwjYNTxsT3hEbablu+tWtkHA/RjI93AV1augoIzHFvuEzp6Jx3DtrSf9
>> 9MmMHoYafkERrcqo0q13P07IPdz1QMs4KYPIr0xMCt4XlSBlXXkSiA==
>> =V10Y
>> -END PGP SIGNATURE-
>>
>>>
>>
>
> >

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (Darwin)

iQEVAwUBRoEhezOKNHIOcnYMAQggpAgAl53OccdVrzlGYBmnrj68oHRCVaQ52eV+
azm4tDd74Y8w4eJSoGoKtkGa4CGGLhmE49KNY19YEQE4kA5F+LZo1F8+QVImTvgN
iTxMxrfF9xz0ff/LzwW9ESBM8ZZilCCvg5FHgEjk9QHRyPgf3fm+R7/OeldWobqi
VdaltUBW1KVYzqpsQAa+e0l34FRpXDKKNba4pYTFSpc3/dGdqDd7bOXMEZuWV4Yd
8VdI4KIcqn6iSvWdd3sa3YwSRoejR89DU65gcyoCCIG5t7WfJMY2YSq1+SOFsPCn
Rs6sm7wPcMg+21r3RWwuRjbNsFXIsonqy2WddLxoFCCylz2kL8Cp6g==
=TrrD
-END PGP SIGNATURE-

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



Calling System Commands

2007-06-26 Thread Moses Ting

Does anyone know if it's possible to make a system command call from a
Django view?  For example, I'd like to make the following call
straight from Django.

import os
os.system('echo Hello World')

Thanks


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



Re: ForeignKey

2007-06-26 Thread Christopher

That was it :)

Thanks a lot


On Jun 26, 4:15 pm, Horst Gutmann <[EMAIL PROTECTED]> wrote:
> Christopher wrote:
> > Hi,
>
> > I am pretty new to both Python and Django and have a quick and
> > hopefully easy question.  Is it possible to create a Model with a link
> > back onto itself?
>
> > Check the code below which does not seem to work.
>
> > class Menu(models.Model):
> >   display_text = models.CharField(maxlength=50)
> >   url = models.URLField(verify_exists=False)
> >   parent_menu_item = models.ForeignKey(Menu)
>
> > I get the following error when I try to manage.py syncdb
>
> > Error: Couldn't install apps, because there were errors in one or more
> > models:
> > totalimpact.menu: name 'Menu' is not defined
>
> Try something like this: models.ForeignKey("self") :-)
>
> There are some examples for this available with many-to-one
> relationships [1]
>
> [1]http://www.djangoproject.com/documentation/models/m2o_recursive/
>
> - Horst


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



Re: Comparing two passwords

2007-06-26 Thread AnaReis

Hum... ok, thanks a lot! :)

Ana


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



Re: ForeignKey

2007-06-26 Thread Horst Gutmann

Christopher wrote:
> Hi,
> 
> I am pretty new to both Python and Django and have a quick and
> hopefully easy question.  Is it possible to create a Model with a link
> back onto itself?
> 
> Check the code below which does not seem to work.
> 
> class Menu(models.Model):
>   display_text = models.CharField(maxlength=50)
>   url = models.URLField(verify_exists=False)
>   parent_menu_item = models.ForeignKey(Menu)
> 
> I get the following error when I try to manage.py syncdb
> 
> Error: Couldn't install apps, because there were errors in one or more
> models:
> totalimpact.menu: name 'Menu' is not defined
> 

Try something like this: models.ForeignKey("self") :-)

There are some examples for this available with many-to-one
relationships [1]

[1] http://www.djangoproject.com/documentation/models/m2o_recursive/

- Horst


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



ForeignKey

2007-06-26 Thread Christopher

Hi,

I am pretty new to both Python and Django and have a quick and
hopefully easy question.  Is it possible to create a Model with a link
back onto itself?

Check the code below which does not seem to work.

class Menu(models.Model):
  display_text = models.CharField(maxlength=50)
  url = models.URLField(verify_exists=False)
  parent_menu_item = models.ForeignKey(Menu)

I get the following error when I try to manage.py syncdb

Error: Couldn't install apps, because there were errors in one or more
models:
totalimpact.menu: name 'Menu' is not defined


Thanks

Christopher


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



Re: Comparing two passwords

2007-06-26 Thread Malcolm Tredinnick

On Tue, 2007-06-26 at 07:03 -0700, AnaReis wrote:
[...]
> I have a question, do you think I should get the newer version? I
> would if I knew it was easy to update... Because I'm working on linux
> and I'm not very used to work with this os and sometimes those path
> things make me crazy, so what I mean is, is it worth all the trouble I
> would have on installing django and fixing the path things and stuff
> or is it ok if I continue using this version? (The version of Django
> is 0.96)

Staying with 0.96 should be fine. You miss out on a few bug fixes now
and again, but, for the most part, it was a very stable release. Just
remember to refer to the 0.96 documentation
(http://www.djangoproject.com/documentation/0.96/ ) so that you don't
accidentally rely on any features added since then. We usually remember
to add "new in development version" or something similar when new
features are added, but it's sometimes not possible to put it in every
location. For example, we can't point out that cleaned_data used to be
called clean_data everywhere we use it. So using the documentation for
your particular release is recommended.

Regards,
Malcolm

-- 
Borrow from a pessimist - they don't expect it back. 
http://www.pointy-stick.com/blog/


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



Re: Comparing two passwords

2007-06-26 Thread AnaReis



On Jun 26, 12:30 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2007-06-26 at 04:57 -0700, AnaReis wrote:
> > Hi,
> > I've been trying to compare two passwords, but I always get the same
> > error. This was taken from the django test web page and I tried to run
> > it on my idle shell:
>
> > class UserRegistration(Form):
> >username = CharField(max_length=10)
> >password1 = CharField(widget=PasswordInput)
> >password2 = CharField(widget=PasswordInput)
> >def clean_password2(self):
> >if self.cleaned_data.get('password1') and
> > self.cleaned_data.get('password2') and self.cleaned_data['password1'] !
> > = self.cleaned_data['password2']:
> >raise ValidationError(u'Please make sure your passwords 
> > match.')
> >return self.cleaned_data['password2']
>
> > data={'username':'ana',
> >   'password1':'123',
> >   'password2':'4232'}
> > f=UserRegistration(data)
> > f.clean()
>
> > Traceback (most recent call last):
> >   File "", line 1, in 
> > f.clean()
> >   File "/nobackup/reis/Python/lib/python2.5/site-packages/django/
> > newforms/forms.py", line 199, in clean
> > return self.clean_data
> > AttributeError: 'UserRegistration' object has no attribute
> > 'clean_data'
>
> Your example is using "cleaned_data", but this traceback is using older
> Django code that is using "clean_data" as the attribute on the Form. So
> there's a mismatch in the versions of the code you are using somewhere.
>
> Regards,
> Malcolm
>
> --
> For every action there is an equal and opposite 
> criticism.http://www.pointy-stick.com/blog/

Hi,

I have the previous version, so I had to change it to clean_data:

def clean_retype_Password(self):
if self.clean_data.get('password') and
self.clean_data.get('retype_Password') and
self.clean_data['password'] != self.clean_data['retype_Password']:
raise ValidationError(u'Please make sure your passwords
match.')
return self.clean_data['retype_Password']

Now it works perfectly...

I have a question, do you think I should get the newer version? I
would if I knew it was easy to update... Because I'm working on linux
and I'm not very used to work with this os and sometimes those path
things make me crazy, so what I mean is, is it worth all the trouble I
would have on installing django and fixing the path things and stuff
or is it ok if I continue using this version? (The version of Django
is 0.96)


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



Re: Problem: locale.getdefaultlocale() returns (None, None) under apache2...

2007-06-26 Thread Malcolm Tredinnick

Hi Jens,

On Tue, 2007-06-26 at 23:28 +1000, Malcolm Tredinnick wrote:
[...]
> 
> The code itself is not catching all the right exceptions that can be
> raised: the idea was that if getdefaultlocale() returns something we
> can't use, it should just return no timezone. I'll give it another look
> and put in some more fallbacks.

This should be fixed in [5546].

Regards,
Malcolm

-- 
What if there were no hypothetical questions? 
http://www.pointy-stick.com/blog/


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



Re: Send a filter-pipline output to a template tag

2007-06-26 Thread Aidas Bendoraitis

Use the {% with %} template tag for that:

{% with variable|some_filter as some_list %}
   {% for el in some_list %}
   {% do_something el %}
   {% endfor %}
{% endwith %}

Regards,
Aidas Bendoraitis aka Archatas


On 6/25/07, Manuel Meyer <[EMAIL PROTECTED]> wrote:
>
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Hey,
>
> is it possible, to send a output, generated by a filter pipeline
> chain to a template tag?
> I want to split a page's tag, that is already processed by the
> reStructuredText filter and a link generation filter, in several
> subtexts to mix it with the page's images.
>
> Thanks!
> Manuel
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.6 (Darwin)
>
> iQEVAwUBRoACqzOKNHIOcnYMAQj9PAgAsXDuV+ggJ0yPh8+l8D2enRW/LrMxK+wB
> fvN1RjCDlO06htexWJcRIttfgjq3yPhXOGbNOnu2GFZ/gRdstofKICOGMPGai0A5
> 8j8dzhgaK+684A5heTsUlcvgeRacEIYFmqWaLIWi0dKV8JxibbFbARt0YCbQUJF6
> znGyfHiNcOR2EGMfmyyNZGzDJz5xX3z68OaaApjbTzDVU7zuubkZYvV6af/AOanO
> q0hEJ5BmdwjYNTxsT3hEbablu+tWtkHA/RjI93AV1augoIzHFvuEzp6Jx3DtrSf9
> 9MmMHoYafkERrcqo0q13P07IPdz1QMs4KYPIr0xMCt4XlSBlXXkSiA==
> =V10Y
> -END PGP SIGNATURE-
>
> >
>

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



Re: Problem: locale.getdefaultlocale() returns (None, None) under apache2...

2007-06-26 Thread Malcolm Tredinnick

On Tue, 2007-06-26 at 15:09 +0200, Jens Diemer wrote:
> 
> Woops... I used apache2 and django via cgi...
> 
> This works fine so far. Until now.
> locale.getdefaultlocale() returns (None, None)
> Don't know why. A restart of apache doesn't change anything.

That's a recent change to the code (within the last 24 hours). That is
something you *really* need to check as one of the first steps when
behaviour changes -- if your tests fail today, go back to yesterday's
version and try that. If it works there, file a ticket so that it
doesn't get overlooked. Unless we announce a backwards-incompatible
change, all changes are meant to not break things.

The code itself is not catching all the right exceptions that can be
raised: the idea was that if getdefaultlocale() returns something we
can't use, it should just return no timezone. I'll give it another look
and put in some more fallbacks.

Regards,
Malcolm

-- 
Experience is something you don't get until just after you need it. 
http://www.pointy-stick.com/blog/


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



Problem: locale.getdefaultlocale() returns (None, None) under apache2...

2007-06-26 Thread Jens Diemer


Woops... I used apache2 and django via cgi...

This works fine so far. Until now.
locale.getdefaultlocale() returns (None, None)
Don't know why. A restart of apache doesn't change anything.

So i get a django traceback:
-
Traceback (most recent call last):
File "./django/template/__init__.py" in render_node
   754. result = node.render(context)
File "./django/template/__init__.py" in render
   899. dict = func(*args)
File "./django/contrib/admin/templatetags/admin_list.py" in result_list
   206. 'results': list(results(cl))}
File "./django/contrib/admin/templatetags/admin_list.py" in results
   201. yield list(items_for_result(cl,res))
File "./django/contrib/admin/templatetags/admin_list.py" in items_for_result
   163. result_repr = capfirst(dateformat.format(field_val, datetime_format))
File "./django/utils/dateformat.py" in format
   258. df = DateFormat(value)
File "./django/utils/dateformat.py" in __init__
   114. self.timezone = LocalTimezone(dt)
File "./django/utils/tzinfo.py" in __init__
   34. self._tzname = self.tzname(dt)
File "./django/utils/tzinfo.py" in tzname
   53. return smart_unicode(time.tzname[self._isdst(dt)], DEFAULT_ENCODING)
File "./django/utils/encoding.py" in smart_unicode
   25. return force_unicode(s, encoding, strings_only, errors)
File "./django/utils/encoding.py" in force_unicode
   42. s = unicode(s, encoding, errors)

   TypeError at /_admin/PyLucid/page/
   unicode() argument 2 must be string, not None
-


This is "normal" because of this line in ./django/utils/tzinfo.py :

-
DEFAULT_ENCODING = locale.getdefaultlocale()[1]
-

So, DEFAULT_ENCODING is None...


In the Python shell, everything is ok:
-
 >>> import locale
 >>> print locale.getdefaultlocale()
('de_DE', 'UTF8')
-



Somebody a idea?


-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.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?hl=en
-~--~~~~--~~--~--~---



Re: all on one server release, ballpark?

2007-06-26 Thread Nimrod A. Abing

On 6/26/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> I don't want to sound discouraging, but if the answer is at all critical
> to your operation, you can't trust any numbers you get here. They will
> not have the same usage patterns as yours. Benchmark, benchmark,
> benchmark is the only way.

FWIW, I use this:

http://www.joedog.org/JoeDog/Siege

to do stress and load testing as well as benchmarking.

In most of my cases, even a modest machine (1GB memory, dual-core
Intel [EMAIL PROTECTED]) can handle up to 1,000 hits per minute. By hits I mean
hits to the Apache server running mod_python with the Django app. The
first choking point you're likely to come up with is bandwidth limits.
But as Malcolm said above, your use case may not be the same as
everyone else's and you should benchmark your own app to determine
what your server can handle.

HTH.
-- 
_nimrod_a_abing_

http://abing.gotdns.com/
http://www.preownedcar.com/

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



Re: Comparing two passwords

2007-06-26 Thread Malcolm Tredinnick

On Tue, 2007-06-26 at 04:57 -0700, AnaReis wrote:
> Hi,
> I've been trying to compare two passwords, but I always get the same
> error. This was taken from the django test web page and I tried to run
> it on my idle shell:
> 
> class UserRegistration(Form):
>   username = CharField(max_length=10)
>   password1 = CharField(widget=PasswordInput)
>   password2 = CharField(widget=PasswordInput)
>   def clean_password2(self):
>   if self.cleaned_data.get('password1') and
> self.cleaned_data.get('password2') and self.cleaned_data['password1'] !
> = self.cleaned_data['password2']:
>   raise ValidationError(u'Please make sure your passwords 
> match.')
>   return self.cleaned_data['password2']
> 
> 
> data={'username':'ana',
>   'password1':'123',
>   'password2':'4232'}
> f=UserRegistration(data)
> f.clean()
> 
> Traceback (most recent call last):
>   File "", line 1, in 
> f.clean()
>   File "/nobackup/reis/Python/lib/python2.5/site-packages/django/
> newforms/forms.py", line 199, in clean
> return self.clean_data
> AttributeError: 'UserRegistration' object has no attribute
> 'clean_data'

Your example is using "cleaned_data", but this traceback is using older
Django code that is using "clean_data" as the attribute on the Form. So
there's a mismatch in the versions of the code you are using somewhere.

Regards,
Malcolm

-- 
For every action there is an equal and opposite criticism. 
http://www.pointy-stick.com/blog/


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



quote django template tags for a html textarea...

2007-06-26 Thread Jens Diemer


I would like to edit templates online. So i used newforms and 
.form_for_instance() to build a html form.
The Problem: If there are django template tags in the content, the tag rendered 
by the template engine. But i don't want that. I want to edit the tag in a html 
textarea.

Here a small cut out from my source:

---
from django import newforms as forms
from PyLucid.models import Page

page_instance = Page(
 content="Test {{ YYY }} foo bar...",
)
page_instance.save()

Form = forms.models.form_for_instance(page_instance)
html_form = Form()

# in the real code: render to response and not print it out ;)
print html_form.as_p()
---

One solution i found: Replace "{" and "}". after render the form with .as_p()

Like this:
form = form.replace("{", "").replace("}", "")

This works fine. But now i doesn't wand directly render the html code. I used 
the "complex template output" described here:
http://www.djangoproject.com/documentation/newforms/#complex-template-output

So i have no change to replace "{" and "}"... If i replace it before i make 
.form_for_instance() the escaped sequence "" would be escaped a second 
time to this: "#x7B;".


How can i handle this???




-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.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?hl=en
-~--~~~~--~~--~--~---



Re: all on one server release, ballpark?

2007-06-26 Thread Malcolm Tredinnick

On Tue, 2007-06-26 at 13:40 +0200, Bram - Smartelectronix wrote:
> hey guys,
> 
> 
> due to some unfortunate events we will have to release our current 
> django-based site on one server instead of two. We were planning to put 
> postgres on another machine, but that's not possible for now.
> 
> The machine is a dual opteron 1.8GHz (dualcore) with 4GB of RAM. Running 
> postgres, django in mod_python + Apache2, lighttpd for media (on a 
> different IP, but on the same machine) *and* memcached for anonymous users!
> 
> Can anyone give me some kind of ballpark of what we will be able to 
> handle with this? As in request/second or whatever you might think of. I 
> don't errors of 80%, it's just to have some idea ;-)

Seriously, these questions are almost impossible to answer. Things that
will cause variance in the answer: How much computation is done in your
views? How much data is retrieved in each request? How big is the
database (will it all fit into buffer cache? how long do typical queries
take?) How much data will be memcached in typical use (depends on number
of different pages and caching time)? What happens if you don't use
memcache or vastly change what is cahced? What's the typical number of
requests to the media server? What sort of HTTP caching benefits are you
going to get for your media (lots of repeat requests for the same data)?

I don't want to sound discouraging, but if the answer is at all critical
to your operation, you can't trust any numbers you get here. They will
not have the same usage patterns as yours. Benchmark, benchmark,
benchmark is the only way.

Regards,
Malcolm


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



Re: Comparing two passwords

2007-06-26 Thread Kelvin Nicholson


> AttributeError: 'UserRegistration' object has no attribute
> 'clean_data'

My first guess: are you using a recent version (the last two months)
from SVN?   clean_data was renamed to cleaned_date.

Take a look here:

http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges

Kelvin
-- 
Kelvin Nicholson
Voice: +886 9 52152 336
Voice: +1 503 715 5535
GPG Keyid: 289090AC
Data: [EMAIL PROTECTED]
Skype: yj_kelvin
Site: http://www.kelvinism.com



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



Re: Use of django.db.models.signals.class_prepared in the wild?

2007-06-26 Thread Jeremy Dunck

On 6/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I use class_prepared in django-multilingual

Thanks. :)

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



Comparing two passwords

2007-06-26 Thread AnaReis

Hi,
I've been trying to compare two passwords, but I always get the same
error. This was taken from the django test web page and I tried to run
it on my idle shell:

class UserRegistration(Form):
username = CharField(max_length=10)
password1 = CharField(widget=PasswordInput)
password2 = CharField(widget=PasswordInput)
def clean_password2(self):
if self.cleaned_data.get('password1') and
self.cleaned_data.get('password2') and self.cleaned_data['password1'] !
= self.cleaned_data['password2']:
raise ValidationError(u'Please make sure your passwords 
match.')
return self.cleaned_data['password2']


data={'username':'ana',
  'password1':'123',
  'password2':'4232'}
f=UserRegistration(data)
f.clean()

Traceback (most recent call last):
  File "", line 1, in 
f.clean()
  File "/nobackup/reis/Python/lib/python2.5/site-packages/django/
newforms/forms.py", line 199, in clean
return self.clean_data
AttributeError: 'UserRegistration' object has no attribute
'clean_data'

This code was taken from the
http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L2447
so it should work... I get exactly the same error when I try to do
this on my web page... why is this happening?
Regards.
Ana


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



admin forms lose javascript with mod_python

2007-06-26 Thread Eric St-Jean

I have a weird problem where if i run django standalone, i see the 
calendar widget by a DateField entry in the admin form, but when run 
from mod_python, i lose it. (i lose the calendar date picking widget, 
and the "today" shortcut)
/media *is* working - the css gets loaded properly. I'm using the same 
browser in both instances. If i load firebug, it sees the javascript 
files - i do think they are being served by apache along with the css ( 
i can look at them from the browser as well). But the widget doesn't 
appear, and i have to enter the date by hand. I was using the debian 
testing django (some form of 0.96), but then also tried trunk, with the 
same results (i even removed the deb package to be absolutely sure it 
wasn't used).
This is django trunk (as of yesterday), with apache 2.2.3-4 and 
mod_python 3.2.10-4, python 2.4.4-2 on debian 4.0.

Any quick ideas???
Thanks

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



all on one server release, ballpark?

2007-06-26 Thread Bram - Smartelectronix

hey guys,


due to some unfortunate events we will have to release our current 
django-based site on one server instead of two. We were planning to put 
postgres on another machine, but that's not possible for now.

The machine is a dual opteron 1.8GHz (dualcore) with 4GB of RAM. Running 
postgres, django in mod_python + Apache2, lighttpd for media (on a 
different IP, but on the same machine) *and* memcached for anonymous users!

Can anyone give me some kind of ballpark of what we will be able to 
handle with this? As in request/second or whatever you might think of. I 
don't errors of 80%, it's just to have some idea ;-)

In the near future we will move postgres to another machine.


thanks a lot,


  - bram

Proud to be releasing another django site this week, fingers X'd. :-)

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



Re: Forms and formating error messages

2007-06-26 Thread AnaReis



On Jun 26, 3:09 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Mon, 2007-06-25 at 08:22 -0700, AnaReis wrote:
> > Hi,
> > I was trying to change the way in which the errors are presented in a
> > form.
> > I tried to put them in:
> > {{field.label}}:{{field}}{% if
> > field.field.required %}*{%endif%} > td>{%if field.errors%}{{field.errors}} > span>{%endif%}
> > but I still get them formatted as an  and I would like the errors
> > to appear as simple text..
>
> I'm beginning to suspect this is a slight design flaw in newforms: the
> presentation of error messages is hard-coded into the way the ErrorList
> class (in newforms.utils) is used in the HTML rendering.
>
> I can think of a couple of backwards-compatible ways we might be able to
> change this. I'll bounce some ideas of the developers list.
>
> > I tried these instructions in this page:
> >http://code.djangoproject.com/wiki/TemplatedForm
> > But I can't seem to make it work..
> > I have this error on my models.py: Exception Value:name
> > 'TemplatedForm' is not defined
> > I understand that I have to import something, I just don't know how to
> > import it...
>
> You have to import TemplatedForm from whichever file you defined it in.
> Both TemplatedForm and the new form subclass you are creating are just
> classes in your Python code. Import them as you would any othre class in
> Python.
>
> Regards,
> Malcolm
>
> --
> How many of you believe in telekinesis? Raise my 
> hand...http://www.pointy-stick.com/blog/

I wrote another response but it's been 2h or more and it doesn't show
here so I'll post it again... Sorry if this is repeated...

I'm kind of a noob on these python things and I don't know very well
how to handle these path things.
The file where TemplatedForm is, newforms.py, is in this directory:
/nobackup/reis/Project/Manager/utils

The import on my file is:
from Manager.utils.newforms import TemplatedForm

I have this error:
Exception Value:No module named utils.newforms

What am I doing wrong and why? Do I have to put something in the
settings file?
Sorry for the lameness...
Regards.


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



Re: Use of django.db.models.signals.class_prepared in the wild?

2007-06-26 Thread [EMAIL PROTECTED]

Hi,

On Jun 26, 10:41 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
>   I'm having some trouble finding any uses of class_prepared.
>   I imagine this is because the class_prepared signal is sent so early
> in Django's startup, but am curious:

I use class_prepared in django-multilingual to create a model with
translatable fields after the "main" model is fully created.  See
translation.py:

http://django-multilingual.googlecode.com/svn/trunk/multilingual/translation.py

-mk


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



Re: How is profile_callback in django-registration supposed to work?

2007-06-26 Thread Sam

The trunk version of django-registration has been modified and it is
now even more simple to create a profile object.

Edit registration/urls.py :

# Import your profile object
from profile.models import Profile

# add the dict with your profile creation function
   url(r'^register/$',
   register,
 
{'profile_callback':Profile.objects.create},
   name='registration_register'),


On Jun 24, 6:27 pm, Sam <[EMAIL PROTECTED]> wrote:
> This is how i use profile_callback with django-registration :
>
> 1. define the profile_callback function :
> # profile/models.py
>
> from django.db import models
> from django.contrib.auth.models import User
> from django.utils.translation import gettext_lazy as _
>
> class ProfileManager(models.Manager):
> """
> Custom manager for the ``Profile`` model.
>
> """
> def profile_callback(self, user):
> """
> Creates user profile while registering new user
> registration/urls.py
>
> """
> new_profile = Profile.objects.create(user=user,)
>
> class Profile(models.Model):
> user = models.ForeignKey(User, verbose_name=_('user'),
> unique=True)
> # TODO : fill in profile fields
>
> objects = ProfileManager()
>
> 2. Edit registration/urls.py :
>
> # Import your profile object
> from profile.models import Profile
>
> # add the dict with your profile creation function
>url(r'^register/$',
>register,
>{'profile_callback':
> Profile.objects.profile_callback},
>name='registration_register'),
>
> That's it.
>
> I'm still using 0.96 so i've added this on top of the registration/
> urls.py file to make it work:
> # TODO : remove when upgrading from 0.96
> def url(*args, **kwargs):
> return args
>
> --http://django-fr.org/pour les francophones ! :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?hl=en
-~--~~~~--~~--~--~---



Use of django.db.models.signals.class_prepared in the wild?

2007-06-26 Thread Jeremy Dunck

Hello all,
  I'm trying to document uses of django signals in preparation for a
presentation.
  I'm having some trouble finding any uses of class_prepared.
  I imagine this is because the class_prepared signal is sent so early
in Django's startup, but am curious:

  Does anyone know of an example other than the deferred hookups in
Django itself?

  -Jeremy

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



Re: newforms: How to make a Checkboxed user select list...

2007-06-26 Thread Jens Diemer

Jens Diemer schrieb:
> I would like to make a newforms user select list, from every existing django 
> users, looks like this:

I have found a solution:

class MailForm(forms.Form):
 users = forms.ModelMultipleChoiceField(
 queryset=User.objects.all(),
 widget=forms.CheckboxSelectMultiple
 )

=;-)

-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.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?hl=en
-~--~~~~--~~--~--~---



Re: ANN: Django-fr.org is out!

2007-06-26 Thread David Larlet

2007/6/22, Ramiro Morales <[EMAIL PROTECTED]>:
>
> On 6/21/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
> >
> > I don't speak French, but this is very nice to see.
> >
> > Is there any interest in a #django-es for Spanish?  I speak a little
> > of that and would like to improve.  I could help with Django and
> > others could help me with Spanish.  ;-)
> >
>
> /me raises hand
>
> I'm there right now. Alone. :)
>
> Also take a look to
>
> http://groups.google.es/group/django-es
> and
> http://django.es/
>
> Regards,
>
> --
>  Ramiro Morales
>

Wow, we're glad to motivate this new community! That's just awesome,
let's spread the world ;-).

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?hl=en
-~--~~~~--~~--~--~---



Re: 'retrieve': the missing permission?

2007-06-26 Thread David Larlet

2007/6/22, Chris Brand <[EMAIL PROTECTED]>:
>
> > > I just wonder why this permission is not part of the default
> > > permissions (like add, change and delete)?
> > >
> > > David
> > >
> > No more thoughts about that? I'm really surprised that it only happens
> > to me, maybe I will be luckier on the users' mailing-list?
>
> Chapter 18 of the Django book (http://www.djangobook.com/en/beta/chapter18/)
> says this :
> " For instance, although the admin is quite useful for reviewing data (see
> above), it's not designed with that purpose as a goal: note the lack of a
> "can view" permission (see Chapter 12). Django assumes that if people are
> allowed to view content in the admin, they're also allowed to edit it."

You're absolutely right, I miss that page. Thanks for the reminder.

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?hl=en
-~--~~~~--~~--~--~---



newforms: How to make a Checkboxed user select list...

2007-06-26 Thread Jens Diemer


I would like to make a newforms user select list, from every existing django 
users, looks like this:
--
 
   
 
   
   username1 - mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]
 
   
   
 
   
   username2 - mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]
 
   
   
 
   
   username3 - mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]
 
   
 
--

I don't know how to make this. Has anyone a idea?

-- 
Mfg.

Jens Diemer



A django powered CMS: http://www.pylucid.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?hl=en
-~--~~~~--~~--~--~---