Re: MySQLdb + AMD64

2008-09-25 Thread urukay


if you'r talking about developing pc, than it's no problem. I'm running xp64
with mySQL and no problem so far. Of course, it was little harder to get
working apache, or eclipse or eclipse with svn, but with sql, there was no
problem at all.

Radovan


theiviaxx wrote:
> 
> 
> I understand this isnt a django specific question, but i figured
> someone out there might have tried starting a django project with
> mysql on an AMD64 platform.  If so, how did they accomplish it.
> 
> On Sep 8, 7:19 pm, Martin Diers <[EMAIL PROTECTED]> wrote:
>> Perhaps you should direct this to a MySQL list somewhere? This in not  
>> a Django question.
>>
>> On Sep 6, 2008, at 2:43 PM, TheIvIaxx wrote:
>>
>>
>>
>> > After searching around for a bit for a build of MySQLdb, i have found
>> > that i will probably need to build the module for AMD64 on windows.
>> > Is there a guide or something that shows what needs to be done to
>> > build a module for a certain architecture?
>>
>> > Thanks
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/MySQLdb-%2B-AMD64-tp19350400p19682799.html
Sent from the django-users mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



Overriding a ForeignKey field in a form looses it's "Add new" plus sign

2008-09-25 Thread D3f0

I've written a class which has two foreign keys which are displayed as
tabular forms. The form gets too long, so, I tried to override those
fk fields, but I lost the classic "Add New" plus signs that sits just
at the left of FK selects.
Any clue how can I get them back, using my custom field?

Thanks
Nahuel
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: migration problem from Django0.96 to Django1.0

2008-09-25 Thread vijay bhaskar
Hi karen,
sorry for the delay,i did not notice this mail.To solve this issue, i have
taken the WEEKDAYS_ABBR code from the trunk and added in the
django.utils.dates file.

Regards & Thank you,
Vijay.

On Mon, Sep 15, 2008 at 8:09 PM, Karen Tracey <[EMAIL PROTECTED]> wrote:

> On Mon, Sep 15, 2008 at 1:58 AM, vijay bhaskar <[EMAIL PROTECTED]> wrote:
>
>> I solved that problem.
>>
>>
> How please?  Someone else is running into trouble with WEEKDAYS_ABBR and I
> can't understand why. What fixed the problem for you?
>
> Thanks,
> Karen
>
>
>>>
>>> On Mon, Sep 15, 2008 at 11:07 AM, vijay bhaskar <[EMAIL PROTECTED]>wrote:
>>>
 Hi karen,Thanks for your reply.but the problem is ,there is no
 definition for WEEKDAYS_ABBR in the django.utils.dates.That's the
 reason its throwing error.How can i get rid of this?

 Thanks & regards
 Vijay


 On Sat, Sep 13, 2008 at 5:39 PM, Karen Tracey <[EMAIL PROTECTED]>wrote:

> On Sat, Sep 13, 2008 at 5:28 AM, vijay <[EMAIL PROTECTED]> wrote:
>
>>
>> When i'am trying to migrate my application which is wriiten in 0.96
>> version to 1.0, i encountered the following error message.
>>
>>  File "c:\python25\lib\site-packages\django\utils\dateformat.py",
>> line 127, in D
>>return WEEKDAYS_ABBR[self.data.weekday()]
>> NameError: global name 'WEEKDAYS_ABBR' is not defined
>>
>>
>> Is there any patch available for this? How can i get rid of this
>> problem?
>>
>>
> Have you modified that file django\utils\dateformat.py?  The one
> shipped with 1.0 does not have the problem you are seeing since it imports
> WEEKDAYS_ABBR from where it is defined before using it, see line 14 in:
>
>
> http://code.djangoproject.com/browser/django/tags/releases/1.0/django/utils/dateformat.py
>
> (Also the line number reported in your error message does not match
> what is on that line the shipped version of the file, so something seems 
> to
> have happened to alter your 1.0 Django files, or at least this one.)
>
> Karen
>
>
>
>

>>>
>>
>>
>>
>
> >
>

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



Re: manyTomany visibility in admin

2008-09-25 Thread urukay


you saved it in Admin or in your own form? If in form, problem could be your
"def save()" function.
did check table(s) of Book model? is it empty?

Radovan

[EMAIL PROTECTED] wrote:
> 
> 
> sorry, i forgot to mention that i am using debian stable version 
> 0.95.1-1etch2
> 
> -
> 
> hi all
> 
> i have a model with two ManyToManyFields. The problem is, that when i
> choose some values,save it, and later come to the same record, the
> values for this columns are not visible as marked. From mysql terminal
> everything is ok. So it is little bit confusing.
> 
> class Tester(models.Model):
> title=models.CharField('title', maxlength=255)
> test_winner=models.ManyToManyField(Book,
> related_name="band_tester_winner")
> test_losser=models.ManyToManyField(Book,
> related_name="book_tester_looser")
> 
> def __str__(self):
> return self.title
> 
> class Admin:
> list_display = ('id', 'title', )
> list_display_links = ('title', )
> 
> actualy i do not know where to look for debugging
> thank you
> pavel
> 
> 
> 
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/manyTomany-visibility-in-admin-tp19669374p19682592.html
Sent from the django-users mailing list archive at Nabble.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
-~--~~~~--~~--~--~---



Absolute URLs (including domain name)

2008-09-25 Thread Karish

I am using {{ MEDIA_URL }} in my templates for images, CSS and JS. For
example, {{ MEDIA_URL }}img/abc.gif

I want to do something similar when I need absolute URLs, and I was
wondering what approaches exist. For example, I could define SITE_URL
= 'http://www.domain.com/' in settings.py, and then refer to that
(after setting up a context processor). Unfortunately, I have to strip
off the trailing slash from SITE_URL, so that I can do things like
this:

{{ SITE_URL }}{% url 'view_path' %}

(the url tag includes a slash at the beginning, so SITE_URL can't end
in a slash)

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: 'get_latest' is not a valid tag library

2008-09-25 Thread Rock
You need an empty __init.py__ in the directory or else the python
files there will not be found.

On Sep 25, 10:29 pm, Matthew Crist <[EMAIL PROTECTED]> wrote:
> Here's my template:
>
> {% load get_latest %}
>  "http://www.w3.org/TR/html4/loose.dtd;>
> 
>         
>                 My Site - {%block pagetitle %}{% endblock %}
>         
>         
>                 My Site
>                 
>                         
>                                 home
>                                 Blog
>                                 Links
>                                 About
>                         
>                 
>                 
>                         
>                                 {% block title %}{% endblock %}
>                                 {% block primary %}{% endblock %}
>                         
>                         
>                                 Recent Entries:
>                                 {% get_latest blog.Entry 5 as recent_posts %}
>                             
>                                 {% for obj in recent_posts %}
>                                         
>                                                 {{ obj.title}}
>                                         
>                                         {% endfor %}
>                                 
>                         
>                 
>         
> 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 'get_latest' is not a valid tag library

2008-09-25 Thread Matthew Crist

Here's my template:

{% load get_latest %}



My Site - {%block pagetitle %}{% endblock %}


My Site


home
Blog
Links
About




{% block title %}{% endblock %}
{% block primary %}{% endblock %}


Recent Entries:
{% get_latest blog.Entry 5 as recent_posts %}

{% for obj in recent_posts %}

{{ obj.title}}

{% endfor %}





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



Re: 'get_latest' is not a valid tag library

2008-09-25 Thread R. Gorman

Post your template code as well.

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



'get_latest' is not a valid tag library

2008-09-25 Thread Matthew Crist

I am trying to figure out templatetags, and I keep getting the
following error:

'get_latest' is not a valid tag library: Could not load template
library from django.templatetags.get_latest, No module named
get_latest

I started with this guide: 
http://www.b-list.org/weblog/2006/jun/07/django-tips-write-better-template-tags/

I have the file saved as "get_latest.py" in the "templatetags"
directory, which is in my "blog" app. I have set the blog app as an
installed app in the settings.

Here is the code that I am using:

from django.template import Library, Node
from django.db.models import get_model

register = Library()

class LatestContentNode(Node):
def __init__(self, model, num, varname):
self.num, self.varname = num, varname
self.model = get_model(*model.split('.'))

def render(self, context):
context[self.varname] = self.model._default_manager.all()
[:self.num]
return ''

def get_latest(parser, token):
bits = token.contents.split()
if len(bits) != 5:
raise TemplateSyntaxError, "get_latest tag takes exactly four
arguments"
if bits[3] != 'as':
raise TemplateSyntaxError, "third argument to get_latest tag
must be 'as'"
return LatestContentNode(bits[1], bits[2], bits[4])

get_latest = register.tag(get_latest)

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



Question about ornery nginx reverse proxy in front of apache mod_wsgi

2008-09-25 Thread Prairie Dogg

I'm trying to set up a new server to host several existing django
sites.  The stack is:

Ubuntu Hardy Heron
Apache 2.2 MPM Worker w/ mod_wsgi (for dynamic content)
Nginx (for static files)

I'm migrating away from mod_python.  The django apps run correctly
under apache mod_wsgi - I've tested this by running the sites under
Apache directly on port 80, everything works swimmingly.

Then, I put up an nginx instance to reverse proxy the dynamic content
and serve static files directly.  nginx serves the static files
correctly, but the dynamic content hangs indefinitely, eventually
throwing a 504 timeout error to the browser and leaving this message
in the nginx error log:

2008/09/26 00:38:05 [error] 3544#0: *10 upstream timed out (110:
Connection timed out) while connecting to upstream, client:
198.28.57.218, server: mysite.com, URL: "/whatever/53/", upstream:
"http://127.0.0.1:8080/whatever/53/;, host: "mysite.com"

I'm using the exact same nginx virtualhost config as I did under
mod_python.  Am I wrong to assume that this should Just Work™?  Has
anyone else experienced this problem when moving from mod_python to
mod_wsgi?  Any suggestions on what might be going wrong here?

I feel as if I've ruled out the "usual suspects" of file permissions
and path errors because dynamic content  works perfectly under apache
(apache port 8080 while running nginx works as well!)  But the
requests for dynamic content via nginx port 80 always time out.

Any help would be greatly, greatly appreciated.

Here are my config files:

--- apache.wsgi ---

import os, sys

apache_configuration= os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(workspace)

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

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()

--- Apache vhost file ---


ServerName mysite.com
ServerAdmin [EMAIL PROTECTED]

WSGIScriptAlias / /home/django/django-sites/mysite.com/mysite/
apache/apache.wsgi

   
   Order deny,allow
   Allow from all
   

# Log files in custom directory /var/log/apache2/vhosts
LogLevel debug
ErrorLog /var/log/apache2/mysite.com/error.log
CustomLog /var/log/apache2/mysite.com/access.log combined



--- nginx vhost file ---

server {
listen   80;
server_name  mysite.com;

# Main location
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect off;

proxy_set_header   Host $host;
proxy_set_header   X-Real-IP$remote_addr;
proxy_set_header   X-Forwarded-For
$proxy_add_x_forwarded_for;

client_max_body_size   10m;
client_body_buffer_size128k;

proxy_connect_timeout  90;
proxy_send_timeout 90;
proxy_read_timeout 90;

proxy_buffer_size  4k;
proxy_buffers  4 32k;
proxy_busy_buffers_size64k;
proxy_temp_file_write_size 64k;
}

# Static files location
location /media/ {
root   /var/www/mysite/;
}
}

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

2008-09-25 Thread Xian Chen
Hi All,

I have a problem with Django v0.95 ( I cannot convince the administrator to
install 1.0 for me.)

I got this feedback:(
AttributeError at /xianchen/ 'function' object has no attribute
'rindex' Request
Method: GET  Request URL: http://ubinet.engr.uconn.edu/xianchen/  Exception
Type: AttributeError  Exception Value: 'function' object has no attribute
'rindex'  Exception Location:
/var/lib/python-support/python2.4/django/core/urlresolvers.py
in get_mod_func, line 23
After looking up the internet, I found the urls.py should in this format
(r'^$', 'app.views.main_page'),

But, it still does not work.

Any suggestions?

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: A Newbie question: Need advice on how to create generic html templates with models

2008-09-25 Thread mcordes

Hi,

I'm not sure generic views are the answer. It sounds to me like you're
asking about reducing duplication in the templates themselves by
creating something you can reuse. That something is a template tag
(http://docs.djangoproject.com/en/dev/howto/custom-template-tags/). I
think you probably want an 'inclusion tag' and then you'd load and
call it on your various pages.

-Matt


On Sep 25, 7:24 pm, Karthik Krishnan <[EMAIL PROTECTED]> wrote:
> Thanks for replying Daniel. I wanted to know if I can use generic
> views for web application form objects. I would like to use them to
> avoid duplication on html pages.
>
> On Sep 25, 1:20 pm, Daniel Roseman <[EMAIL PROTECTED]>
> wrote:
>
> > On Sep 25, 8:51 pm, Karthik Krishnan <[EMAIL PROTECTED]> wrote:
>
> > > I know this may be a stupid question but please bear with me. Here is
> > > my problem
>
> > > In views.py I have a multiple methods, where each method is mapped to
> > > a unique model. There may be multiple methods mapped to the same
> > > model. But no method in views.py is mapped to multiple models.
>
> > > For a GET/POST request, we have mapped a form object to the request
> > > method. To display the form on the HTML page, we have to do
> > > {{form.as_p}} or {{form.as_ul} and so on.. But we have to display it
> > > differently with div tags using css files.
>
> > > If I have to do it individually, then I would have to this as follows
>
> > > Name {{form.name} and so
> > > on...
>
> > > Question 1 : Is there a way we can do it?
>
> > > The reason I am asking this is because we have 20 html forms and we
> > > would like to make it as automated as possible by invoking this
> > > method. What I am hoping for is something like this. Ideally this is
> > > what I hope to do.
>
> > > In my urls. py I could define the model
>
> > > ulr.py
>
> > > urlpatterns = patterns('',
> > >     (r'^login/$', views.object_list, {'model': models.User}),
> > >     (r'^customers/([A-Za-z0-9].*/$', views.object_list, {'model':
> > > models.Customer}),
> > > )
>
> > > In My views.py, I could return the same key for any number of models,
> > > only my template would change
>
> > > def login(request, model):
> > >     user = model.objects.filter(username = 'abcedf')
> > >     return render_to_response('success.html', {'form', user})
>
> > > def getCustomer(request, customer_name model):
> > >   customer = model.objects.filter(name = customer_name)
> > >  return render_to_response('success.html', {'form', customer})
>
> > > In my success html page
>
> > > I would display them as
>
> > > {{form.as_div}}
>
> > > Any help/suggestions would be more than welcome.
>
> > I'm not entirely sure I follow, but it sounds like Django's generic
> > views would do the trick.
> > Seehttp://docs.djangoproject.com/en/dev/ref/generic-views-
> > specifically the section on create/update views. That does the view/
> > form part for you, allowing you simply to define the URL in your
> > urls.py and give it a template. Is that what you're after?
>
> > --
> > DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: A Newbie question: Need advice on how to create generic html templates with models

2008-09-25 Thread Karthik Krishnan

Thanks for replying Daniel. I wanted to know if I can use generic
views for web application form objects. I would like to use them to
avoid duplication on html pages.

On Sep 25, 1:20 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> On Sep 25, 8:51 pm, Karthik Krishnan <[EMAIL PROTECTED]> wrote:
>
>
>
> > I know this may be a stupid question but please bear with me. Here is
> > my problem
>
> > In views.py I have a multiple methods, where each method is mapped to
> > a unique model. There may be multiple methods mapped to the same
> > model. But no method in views.py is mapped to multiple models.
>
> > For a GET/POST request, we have mapped a form object to the request
> > method. To display the form on the HTML page, we have to do
> > {{form.as_p}} or {{form.as_ul} and so on.. But we have to display it
> > differently with div tags using css files.
>
> > If I have to do it individually, then I would have to this as follows
>
> > Name {{form.name} and so
> > on...
>
> > Question 1 : Is there a way we can do it?
>
> > The reason I am asking this is because we have 20 html forms and we
> > would like to make it as automated as possible by invoking this
> > method. What I am hoping for is something like this. Ideally this is
> > what I hope to do.
>
> > In my urls. py I could define the model
>
> > ulr.py
>
> > urlpatterns = patterns('',
> >     (r'^login/$', views.object_list, {'model': models.User}),
> >     (r'^customers/([A-Za-z0-9].*/$', views.object_list, {'model':
> > models.Customer}),
> > )
>
> > In My views.py, I could return the same key for any number of models,
> > only my template would change
>
> > def login(request, model):
> >     user = model.objects.filter(username = 'abcedf')
> >     return render_to_response('success.html', {'form', user})
>
> > def getCustomer(request, customer_name model):
> >   customer = model.objects.filter(name = customer_name)
> >  return render_to_response('success.html', {'form', customer})
>
> > In my success html page
>
> > I would display them as
>
> > {{form.as_div}}
>
> > Any help/suggestions would be more than welcome.
>
> I'm not entirely sure I follow, but it sounds like Django's generic
> views would do the trick.
> Seehttp://docs.djangoproject.com/en/dev/ref/generic-views-
> specifically the section on create/update views. That does the view/
> form part for you, allowing you simply to define the URL in your
> urls.py and give it a template. Is that what you're after?
>
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Comments in Django 1.0 (free comments?)

2008-09-25 Thread Russell Keith-Magee

On Fri, Sep 26, 2008 at 6:31 AM, Janmansilver <[EMAIL PROTECTED]> wrote:
>
> I have tried to implement comments in a blog I'm building with this in
> my template:
...
> In template /home/weiter/webapps/django_v1/lib/python2.5/django/
> contrib/comments/templates/comments/form.html, error at line 2
> Caught an exception while rendering: Reverse for ' post_comment at 0x9a19294>' with arguments '()' and keyword arguments
> '{}' not found.
...
> I don't understand what I'm doing wrong?

You're hitting #9038. It's an annoying bug, but at least there is now
a patch; I'm hoping to get the patch (or something equivalent)
committed in the near future.

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



Comments in Django 1.0 (free comments?)

2008-09-25 Thread Janmansilver

I have tried to implement comments in a blog I'm building with this in
my template:

{% render_comment_form for wBlog.entry object.id %}

It then goes on to fetch another templete inside django that then
fails:

Template error

In template /home/weiter/webapps/django_v1/lib/python2.5/django/
contrib/comments/templates/comments/form.html, error at line 2
Caught an exception while rendering: Reverse for '' with arguments '()' and keyword arguments
'{}' not found.
1   {% load comments %}
2   
3 {% for field in form %}
4   {% if field.is_hidden %}
5 {{ field }}
6   {% else %}
7 
10  {% if field.errors %}{{ field.errors }}{% endif %}
11  {{ field.label_tag }} {{ field }}
12

I don't understand what I'm doing wrong?

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

2008-09-25 Thread Graham Dumpleton

On Sep 26, 8:26 am, "Xian Chen" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to run my Django app on a shared web server.
>
> As so many people share this server, I install python and Django(1.0) under
> my home directory.
>
> How can I configure the Apache with mod_python to make the django under my
> directory running?
>
> The server administrator refused to install Django in the /usr/bin directory

With mod_python you cannot make it use a different Python installation
than the one it was compiled with. The best you can manage is to use
virtualenv to build a Python virtual environment in your home
directory where you install all the Python modules/packages you want
and then refer to that.

  http://pypi.python.org/pypi/virtualenv

Only problem I see is that documentation for virtualenv seems to have
changed lately and no longer mentions the easy approach for using it
with mod_python. It has some new mechanism mentioned which I can't see
at the moment how it works.

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: INSTALLED_APPS from a template

2008-09-25 Thread Rock

I have no idea, but it only took me a few minutes to create a filter
you can put in some templatetags module:


from django import template
from django.conf import settings
from django.template.defaultfilters import stringfilter

register = template.Library()

@register.filter
@stringfilter
def installed(value):
apps = settings.INSTALLED_APPS
if "." in value:
for app in apps:
if app == value:
return True
else:
for app in apps:
fields = app.split(".")
if fields[-1] == value:
return True
return False


Assuming that you named this file "installed.py" then your template
can do this:

{% load installed %}

{% if "django.contrib.sites"|installed %}
   and so forth

If the string you supply (or the string yielded by your variable) has
a dot in it ("."), then the full name must match. Otherwise the filter
will just check the last component of the name. (You can edit that out
of the filter if you don't like that behavior.)

{{ "admin"|installed }}

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



Apache with home directory Django

2008-09-25 Thread Xian Chen
Hi,

I want to run my Django app on a shared web server.

As so many people share this server, I install python and Django(1.0) under
my home directory.

How can I configure the Apache with mod_python to make the django under my
directory running?

The server administrator refused to install Django in the /usr/bin directory

Thanks,
Xian

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

2008-09-25 Thread Jeff Anderson
jeffhg58 wrote:
> I just recently upgraded to Django 1.0, but when I log in with users
> that I have created I get up a popup window
> stating syntax error and after I login the clock and calendar objects
> are lost.
>   
You'll need to be much more specific. Where are you logging in. What do
you mean by "popup" and what clock and calendar objects are you speaking
of?



signature.asc
Description: OpenPGP digital signature


User Login with Django 1.0

2008-09-25 Thread jeffhg58

I just recently upgraded to Django 1.0, but when I log in with users
that I have created I get up a popup window
stating syntax error and after I login the clock and calendar objects
are lost.

Has anyone else experienced this issue?

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

2008-09-25 Thread [EMAIL PROTECTED]

I'm using django on Amazon EC2. And Django does not serve any static
files. Actually they are stored on S3 and we plan to use Amazon new
CDN functionnalities for that. So I'm trying to find the best solution
for serving dynamic files on instances with 2GB of RAM. These
instances are running Django ONLY.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



INSTALLED_APPS from a template

2008-09-25 Thread Tim Sawyer

Hi Folks,

I'd like to conditionally add a link based on whether a specific app is 
included in INSTALLED_APPS or not.  Is there an easy way to do this from a 
template?

Cheers,

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: actual django stack

2008-09-25 Thread Marcelo Sanches

I use both, apache mod_python to server django code and nginx at port 80 to 
serve just media and static files.

- Original Message - 
From: "Frédéric Sidler" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, September 25, 2008 4:41 PM
Subject: actual django stack


>
> What it the best Django stack today.
>
> In django doc, it says that apache with mod_python is the best
> solution in production. But in the same time I see that everyblock use
> nginx (probably in mode fastcgi).
>
> Did you some of you test different solution and can share some output 
> here.
>
> Here are the ones I see actually
>
> Apache mod_python
> Apache in fastcgi mode
> Lighttpd in fastcgi mode
> Nginx in fastcgi mode
>
> I'm not talking about load balancer, memcached and database here, just
> the application.
>
> >
>
> -- 
> Esta mensagem foi verificada pelo sistema de antivírus e
> acredita-se estar livre de perigo.
> 


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

2008-09-25 Thread cwurld

Problem solved - I am using the multilingual module. Although I
uploaded the version that is needed for django 1.0, my path was still
pointing to the old version.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: actual django stack

2008-09-25 Thread Norman Harman

Frédéric Sidler wrote:
> What it the best Django stack today.
> 
> In django doc, it says that apache with mod_python is the best
> solution in production. But in the same time I see that everyblock use
> nginx (probably in mode fastcgi).
> 
> Did you some of you test different solution and can share some output here.
> 
> Here are the ones I see actually
> 
> Apache mod_python
> Apache in fastcgi mode
> Lighttpd in fastcgi mode
> Nginx in fastcgi mode
> 
> I'm not talking about load balancer, memcached and database here, just
> the application.

"Best" for what?  Best has different meaning for different needs.  If 
you know enough to ask this question you should know enough to answer it 
for your particular situation.

Apache and mod_python is probably the easiest/most common/most tested 
and therefor probably the best to recommend to Djangonista's just 
starting out.

And you forgot wsgi options ;)


-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___
Get off the sidelines and huddle up with the Statesman all season long
for complete high school, college and pro coverage in print and online!

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

2008-09-25 Thread Jeff Anderson
Frédéric Sidler wrote:
> What it the best Django stack today.
>
> In django doc, it says that apache with mod_python is the best
> solution in production. But in the same time I see that everyblock use
> nginx (probably in mode fastcgi).
>
> Did you some of you test different solution and can share some output here.
>
> Here are the ones I see actually
>
> Apache mod_python
> Apache in fastcgi mode
> Lighttpd in fastcgi mode
> Nginx in fastcgi mode
>   
I've only used Django with apache/mod_python in production. At work we
are considering moving to lighttpd with fastcgi. I've played with
fastcgi, and it seems like just as solid of a solution as mod_python.
For apache, mod_wsgi has/will supercede mod_python.



signature.asc
Description: OpenPGP digital signature


Re: how to reject save of a model with many to many relation

2008-09-25 Thread Rajesh Dhawan

> I have two models, one of them has a many to many relation to the
> other one.
>
> I want to add some checks to the first model, so I overwrote the save
> method. If my checks are not ok, I plan not to call super().save(),
> but this gives me the error "'FirstModel' instance needs to have a
> primary key value before a many-to-many relationship can be used."
>
> As far as I understood, the problem is that since I don't create the
> entry in the db for the first model, the successive creation of the
> association between the two models fails.
>
> Is there a way to stop the creation of all entries when the save
> method in my first model is called?

You should consider using a custom ModelForm[1] instead of this
approach. Override its clean() method to perform your checks and throw
a ValidationError when you don't want the save to proceed. You can
then also make the Admin use this custom form[2].

[1] 
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method
[2] 
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin

-Rajesh 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: nested applications and syncdb question

2008-09-25 Thread Evan

i think he means like this:

+application
|
+-part1
||
|   +-models.py
|
+-part2
||
|   +-models.py
|
+-urls.py
|
+-views.py


On Sep 25, 4:01 pm, Stephen Sundell <[EMAIL PROTECTED]> wrote:
> I am trying to create one application with multiple modules in it.
> What I have now is an application directory with multiple directories
> each with its own models.py file.  If I include the application in the
> settings file and run validate it checks the models, but syncdb
> doesn't add them to the database.  I really was just looking for a way
> to separate models into different modules or files within the same
> application.  Is this possible?
>
> Thank you in advance for you're 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: A Newbie question: Need advice on how to create generic html templates with models

2008-09-25 Thread Daniel Roseman

On Sep 25, 8:51 pm, Karthik Krishnan <[EMAIL PROTECTED]> wrote:
> I know this may be a stupid question but please bear with me. Here is
> my problem
>
> In views.py I have a multiple methods, where each method is mapped to
> a unique model. There may be multiple methods mapped to the same
> model. But no method in views.py is mapped to multiple models.
>
> For a GET/POST request, we have mapped a form object to the request
> method. To display the form on the HTML page, we have to do
> {{form.as_p}} or {{form.as_ul} and so on.. But we have to display it
> differently with div tags using css files.
>
> If I have to do it individually, then I would have to this as follows
>
> Name {{form.name} and so
> on...
>
> Question 1 : Is there a way we can do it?
>
> The reason I am asking this is because we have 20 html forms and we
> would like to make it as automated as possible by invoking this
> method. What I am hoping for is something like this. Ideally this is
> what I hope to do.
>
> In my urls. py I could define the model
>
> ulr.py
>
> urlpatterns = patterns('',
>     (r'^login/$', views.object_list, {'model': models.User}),
>     (r'^customers/([A-Za-z0-9].*/$', views.object_list, {'model':
> models.Customer}),
> )
>
> In My views.py, I could return the same key for any number of models,
> only my template would change
>
> def login(request, model):
>     user = model.objects.filter(username = 'abcedf')
>     return render_to_response('success.html', {'form', user})
>
> def getCustomer(request, customer_name model):
>   customer = model.objects.filter(name = customer_name)
>  return render_to_response('success.html', {'form', customer})
>
> In my success html page
>
> I would display them as
>
> {{form.as_div}}
>
> Any help/suggestions would be more than welcome.


I'm not entirely sure I follow, but it sounds like Django's generic
views would do the trick.
See http://docs.djangoproject.com/en/dev/ref/generic-views -
specifically the section on create/update views. That does the view/
form part for you, allowing you simply to define the URL in your
urls.py and give it a template. Is that what you're after?

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



nested applications and syncdb question

2008-09-25 Thread Stephen Sundell

I am trying to create one application with multiple modules in it.
What I have now is an application directory with multiple directories
each with its own models.py file.  If I include the application in the
settings file and run validate it checks the models, but syncdb
doesn't add them to the database.  I really was just looking for a way
to separate models into different modules or files within the same
application.  Is this possible?

Thank you in advance for you're 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
-~--~~~~--~~--~--~---



A Newbie question: Need advice on how to create generic html templates with models

2008-09-25 Thread Karthik Krishnan

I know this may be a stupid question but please bear with me. Here is
my problem

In views.py I have a multiple methods, where each method is mapped to
a unique model. There may be multiple methods mapped to the same
model. But no method in views.py is mapped to multiple models.

For a GET/POST request, we have mapped a form object to the request
method. To display the form on the HTML page, we have to do
{{form.as_p}} or {{form.as_ul} and so on.. But we have to display it
differently with div tags using css files.

If I have to do it individually, then I would have to this as follows

Name {{form.name} and so
on...

Question 1 : Is there a way we can do it?

The reason I am asking this is because we have 20 html forms and we
would like to make it as automated as possible by invoking this
method. What I am hoping for is something like this. Ideally this is
what I hope to do.


In my urls. py I could define the model

ulr.py

urlpatterns = patterns('',
(r'^login/$', views.object_list, {'model': models.User}),
(r'^customers/([A-Za-z0-9].*/$', views.object_list, {'model':
models.Customer}),
)


In My views.py, I could return the same key for any number of models,
only my template would change

def login(request, model):
user = model.objects.filter(username = 'abcedf')
return render_to_response('success.html', {'form', user})

def getCustomer(request, customer_name model):
  customer = model.objects.filter(name = customer_name)
 return render_to_response('success.html', {'form', customer})


In my success html page

I would display them as

{{form.as_div}}


Any help/suggestions would be more than welcome.







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



actual django stack

2008-09-25 Thread Frédéric Sidler

What it the best Django stack today.

In django doc, it says that apache with mod_python is the best
solution in production. But in the same time I see that everyblock use
nginx (probably in mode fastcgi).

Did you some of you test different solution and can share some output here.

Here are the ones I see actually

Apache mod_python
Apache in fastcgi mode
Lighttpd in fastcgi mode
Nginx in fastcgi mode

I'm not talking about load balancer, memcached and database here, just
the application.

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



Re: GeoDjango / GIS Garbage Collection Error

2008-09-25 Thread Fredrik Lundh

Justin Bronn wrote:

> [W]hen __del__() is invoked in response to a module being deleted
> (e.g., when execution of the program is done), other globals
> referenced by the __del__() method may already have been deleted.
> 
> Thus, the solution is to not to not import GEOS globals from a
> different module.

or to make sure you keep your own references to the relevant objects at 
the instance level.  e.g.

 import module

 class MyClass

 def __init__(self):
 self.func = module.func # we'll need this in __del__

 def __del__(self):
 self.func(...) # call self.func instead of module.func




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



how to reject save of a model with many to many relation

2008-09-25 Thread Ottavio Campana

I have two models, one of them has a many to many relation to the
other one.

I want to add some checks to the first model, so I overwrote the save
method. If my checks are not ok, I plan not to call super().save(),
but this gives me the error "'FirstModel' instance needs to have a
primary key value before a many-to-many relationship can be used."

As far as I understood, the problem is that since I don't create the
entry in the db for the first model, the successive creation of the
association between the two models fails.

Is there a way to stop the creation of all entries when the save
method in my first model is called?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: ModelMultipleChoiceField and initial values

2008-09-25 Thread cardhu

Hi Vance,
I suppose your code is precompiling ok but isn't it required to
explicitly state 'queryset=' before 'Location.objects.all()'?

On Sep 22, 6:15 am, "Vance Dubberly" <[EMAIL PROTECTED]> wrote:
> Wow this is really screwing me royal.  Doesn't work with any form of
> select, best I can tell initial doesn't work with ChoiceFields at all.
>  I've tried going into the source and logging out the value param to
> the widget and it is always just [].
>
> Am I on crack, can somebody verify, so I can file a bug report if I'm
> not. ( by default these days I just assume I'm an idiot. )
>
> Vance
>
>
>
> On Sat, Sep 20, 2008 at 8:24 PM, Vance Dubberly <[EMAIL PROTECTED]> wrote:
> > Ok hopefully this will be the last stupid question I ask for a long
> > time... been struggling with this for several hours:
>
> > I've got aModelMultipleChoiceFieldin a form as such
>
> > class ApplicationCriteraForm(forms.Form):
> >  pay_hourly = forms.CharField()
> >  pay_yearly = forms.CharField()
> >  locations = 
> > forms.ModelMultipleChoiceField(Location.objects.all(),widget=forms.CheckboxSelectMultiple())
> >  transportation_method =
> > forms.ModelMultipleChoiceField(TransportMethod.objects.all(),
> > widget=forms.CheckboxSelectMultiple())
> >  driving_violations = forms.ChoiceField(BOOLEAN_CHOICE,
> > widget=forms.CheckboxSelectMultiple())
>
> > Now when I use this form I may have preset data for it, as in the form
> > is being used to update info instead of create it so I do something
> > like this:
>
> > criteria_form = ApplicationCriteraForm(initial={
> >    'pay_hourly' : application.pay_hourly,
> >    'pay_yearly' : application.pay_yearly,
> >    'locations ' : application.locations,
> >    'transportation_method' : application.transportation_method,
> >    'driving_violations' : application.driving_violations
> >  })
>
> > None of the multiple choice fields pre-popluate with data.  I've tried
> > a number of different methods as it looks like what the various
> > SelectMultiple widgets expect is a list of the id's but none of the
> > following work:
>
> > 'locations ' : application.locations,
> > 'locations ' : application.locations.all(),
> > 'locations ' : [ int(location.id) for location in 
> > application.locations.all()]
> > 'locations ' : application.locations.values()
>
> > Also it doesn't matter whether it's the CheckboxSelectMultiple or another.
>
> > Not real sure where what else to try... digging through django source
> > cause I'm sure I'm doing something amazingly stupid.
>
> > Vance
>
> > --
> > To pretend, I actually do the thing: I have therefore only pretended to 
> > pretend.
> >  - Jacques Derrida
>
> --
> To pretend, I actually do the thing: I have therefore only pretended to 
> pretend.
>  - Jacques Derrida

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

2008-09-25 Thread cwurld



On Sep 25, 1:10 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> On Sep 25, 5:42 pm, cwurld <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I am trying to upgrade my site from 0.97 to 1.0. When I use the
> > command:
>
> > python manage.py runserver
>
> > I get the error:
> > Error: cannot import name connect
>
> > Any ideas how to resolve this?
>
> > Thanks,
> > Chuck
>
> That clearly isn't the full traceback. It would be more helpful if you
> posted the whole thing.
>
> However, it's likely that this is related to the signals refactoring.
> Did you read the Backwards Incompatible Changes page before upgrading?
> If you had you would have seen 
> this:http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Signa...
> --
> DR.

It is the complete message that I get when I run the command from the
windows command line. That is why it is so frustrating. If I had more
to go on, I probably could solve it myself.

And yes, I did read that document, including the section on signals,
before I started this thread. But I thought that before I roll up my
sleeves and start studying the inner guts of django, I would ask for
some help.

Chuck



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



Re: GeoDjango / GIS Garbage Collection Error

2008-09-25 Thread Justin Bronn

On Sep 23, 5:09 pm, Andrew Fong <[EMAIL PROTECTED]> wrote:
> When a Django process terminates, I get the following error message:
>
> Exception exceptions.TypeError: "'NoneType' object is not callable"
> in  ignored
>

Thanks for giving detailed reproduction steps; I've confirmed this
behavior.

GEOSGeometry overrides `__del__` because the C object must be
destroyed at the end of its life cycle, otherwise memory would leak.
The Python documentation [1] warns against having global objects that
override `__del__` :

[W]hen __del__() is invoked in response to a module being deleted
(e.g., when execution of the program is done), other globals
referenced by the __del__() method may already have been deleted.

Thus, the solution is to not to not import GEOS globals from a
different module.

Regards,
-Justin

[1] http://docs.python.org/ref/customization.html#l2h-181
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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 error didn't clear until I reloaded polls detail view

2008-09-25 Thread Daniel Roseman

On Sep 25, 5:36 pm, arnold4321 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm just getting started with Django.  I'm working through the
> tutorial on setting up my first app.  I ran into something that
> strikes me as odd.  I guess I must have had some mistake in my polls/
> views.py file, because I was getting an error at mysite.com/admin to
> that effect with debug mode turned on.
>
> The error said something about a module not having a vote attribute.
> I'm not sure what the cause of the error was, but putting that aside,
> I found that I couldn't get rid of the error at mysite.com/admin
> without loading mysite.com/polls/2 a few times.  That is, I had to
> load the page that made use of the detail.html template.  I'm just
> wondering why I would have to load that page in order to clear an
> error that I was seeing on a completely different page, mysite.com/
> admin.  Futhermore, why would I have to refresh the detail page two or
> three times?  I found that out purely by accident.
>
> I'm not really sure what I did to fix the problem -- or even what the
> problem was -- because whatever fix I performed didn't do any good
> until I loaded the polls detail page a few times.
>
> Any explanation for this behavior?
>
> Thanks,
> Ryan

When you make changes to Django code, you need to restart the server.
When you're running the built-in development server, it usually
detects any changes and restarts itself - but sometimes it can get
stuck and doesn't restart.

It was probably a coincidence that refreshing a certain page twice
sorted it out for you. To be safe, after you make code changes check
the console you're running the server in - you should see the 'Django
version x.. development server is running at...' header appear again.
If not, press Ctrl-C to quit the server and run ./manage.py runserver
again.

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



Re: Manager to add entries where there is a ManyToMany relationship

2008-09-25 Thread SnappyDjangoUser

Hi Everyone,

Am I on the right track with my M2M model definition (which includes
an intermediate table)?  I still need help with 2 questions:

1. How do I create a Model Manager?

2. Within a view, what is the best way to add entries into tables that
have a M2M relationship with an intermediate table?  I've been reading
the following documentation with command line options, but I have not
been able to put a cohesive view method together for my models above.
Is there any examples of how to add to M2M tables within a view?
http://docs.djangoproject.com/en/dev/ref/models/relations/
http://www.djangoproject.com/documentation/models/m2m_intermediary/

I'm a bit stuck at the moment, so I would really appreciate any
guidance you can provide.

Thank you!

On Sep 24, 11:53 am, SnappyDjangoUser <[EMAIL PROTECTED]> wrote:
> Hi Everyone,
>
> I need some guidance with adding table entries where I have a M2M
> table relationship.  I am adding entires via a Quote ModelForm.  The
> problem is that I am getting the following error when submitting the
> form:  "Cannot set values on a ManyToManyField which specifies an
> intermediary model.  Use QuoteHasProduct's Manager instead."
>
> I have 2 questions:
>
> 1. How do I create a Manager to add entries to the QuoteHasProduct
> model? (see above error message)
> 2. My Quote ModelForm creates a nice multiselect box for the products
> selected in the M2M relationship.  My problem is that I also have
> several additional fields in the QuoteHasProduct table (e.g. quantity
> and product_quote) and I need a way to enter values for them.  Does
> anyone have a suggestion on a front end mechanism to select multiple
> products for an order and also enter the quantity and product_quote at
> the same time.  I am hoping there is an easy way to do this within the
> ModelForms class.
>
> For reference, the Models of my tables are below:
>
> class Product(models.Model):
>     idProduct = models.AutoField(primary_key=True)
>     Vendor_idVendor = models.ForeignKey(Vendor,
> db_column='Vendor_idVendor', verbose_name = 'Vendor Name')
>     Device_Family = models.CharField(max_length=90)
>     Product_Number = models.CharField(max_length=30)
>     Device_Description = models.TextField(blank=True)
>     class Meta:
>         db_table = u'Product'
>     def __unicode__(self):
>         return self.Device_Family
>
> class Quote(models.Model):
>     idQuote = models.AutoField(primary_key=True, verbose_name='Quote
> Number')
>     quote_date = models.DateField()
>     quote_number = models.CharField(max_length=45, blank=True)
>     quote_file = models.FileField(blank=True, upload_to='files/
> orders/')
>     products = models.ManyToManyField(Product,
> through='QuoteHasProduct') # filter_interface=models.HORIZONTAL
>     class Meta:
>         db_table = u'Quote'
>     def __unicode__(self):
>         return self.quote_number
>
> class QuoteHasProduct(models.Model):
>     Quote_idQuote = models.ForeignKey(Quote)
>     Product_idProduct = models.ForeignKey(Product)
>     quantity = models.IntegerField()
>     product_quote = models.DecimalField(max_digits=10,
> decimal_places=2)
>     class Meta:
>         db_table = u'Quote_has_Product'
>
> Thank you in advance for the guidance!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: runserver error

2008-09-25 Thread Daniel Roseman

On Sep 25, 5:42 pm, cwurld <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to upgrade my site from 0.97 to 1.0. When I use the
> command:
>
> python manage.py runserver
>
> I get the error:
> Error: cannot import name connect
>
> Any ideas how to resolve this?
>
> Thanks,
> Chuck

That clearly isn't the full traceback. It would be more helpful if you
posted the whole thing.

However, it's likely that this is related to the signals refactoring.
Did you read the Backwards Incompatible Changes page before upgrading?
If you had you would have seen this:
http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Signalrefactoring
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Querying Users with Permission

2008-09-25 Thread bobbyc

Looks like users = permission.user_set.all() works, but only if the
permission is explicitly assigned to the user. Ideally, I'd like to
assign the permissions in Groups.

On Sep 25, 1:45 pm, bobbyc881 <[EMAIL PROTECTED]> wrote:
> That gives an error... "Error was: 'Permission' object has no
> attribute 'users'"
>
> Seems like this should be easy...
>
> On Sep 25, 11:32 am, "Norman Harman" <[EMAIL PROTECTED]> wrote:
>
> > bobbyc881 wrote:
> > > I'm generating a list of Users in a specific group, in this case,
> > > "Artists", for a form:
>
> > > artist_group = Group.objects.get(name="Artists")
> > > artist =
> > > forms.ModelChoiceField(queryset=User.objects.filter(groups=artist_group),
> > > required=False)
>
> > > I'd like to re-write this to avoid using a Group that could get
> > > renamed, deleted, or change some other way in the future. I've created
> > > a custom permission called "in_artist_pulldown" to use. Is there a way
> > > to query Users that have the permission "in_artist_pulldown."  I can't
> > > quite seem to figure out how to access that.
>
> > User has a many to many relation with 
> > Permissionshttp://docs.djangoproject.com/en/dev/topics/db/queries/#many-to-many-...
>
> > user_permissions is the field name.
>
> > So, I think the syntax would be this.
>
> >    permission = Permission.objects.get(name="in_artist_pulldown")
> >    users = permission.users.all()
>
> > --
> > Norman J. Harman Jr.
> > Senior Web Specialist, Austin American-Statesman
> > ___
> > Get off the sidelines and huddle up with the Statesman all season long
> > for complete high school, college and pro coverage in print and online!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: Querying Users with Permission

2008-09-25 Thread bobbyc881

That gives an error... "Error was: 'Permission' object has no
attribute 'users'"

Seems like this should be easy...

On Sep 25, 11:32 am, "Norman Harman" <[EMAIL PROTECTED]> wrote:
> bobbyc881 wrote:
> > I'm generating a list of Users in a specific group, in this case,
> > "Artists", for a form:
>
> > artist_group = Group.objects.get(name="Artists")
> > artist =
> > forms.ModelChoiceField(queryset=User.objects.filter(groups=artist_group),
> > required=False)
>
> > I'd like to re-write this to avoid using a Group that could get
> > renamed, deleted, or change some other way in the future. I've created
> > a custom permission called "in_artist_pulldown" to use. Is there a way
> > to query Users that have the permission "in_artist_pulldown."  I can't
> > quite seem to figure out how to access that.
>
> User has a many to many relation with 
> Permissionshttp://docs.djangoproject.com/en/dev/topics/db/queries/#many-to-many-...
>
> user_permissions is the field name.
>
> So, I think the syntax would be this.
>
>    permission = Permission.objects.get(name="in_artist_pulldown")
>    users = permission.users.all()
>
> --
> Norman J. Harman Jr.
> Senior Web Specialist, Austin American-Statesman
> ___
> Get off the sidelines and huddle up with the Statesman all season long
> for complete high school, college and pro coverage in print and online!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



runserver error

2008-09-25 Thread cwurld

Hi,

I am trying to upgrade my site from 0.97 to 1.0. When I use the
command:

python manage.py runserver

I get the error:
Error: cannot import name connect

Any ideas how to resolve this?

Thanks,
Chuck
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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 error didn't clear until I reloaded polls detail view

2008-09-25 Thread arnold4321

Hi,

I'm just getting started with Django.  I'm working through the
tutorial on setting up my first app.  I ran into something that
strikes me as odd.  I guess I must have had some mistake in my polls/
views.py file, because I was getting an error at mysite.com/admin to
that effect with debug mode turned on.

The error said something about a module not having a vote attribute.
I'm not sure what the cause of the error was, but putting that aside,
I found that I couldn't get rid of the error at mysite.com/admin
without loading mysite.com/polls/2 a few times.  That is, I had to
load the page that made use of the detail.html template.  I'm just
wondering why I would have to load that page in order to clear an
error that I was seeing on a completely different page, mysite.com/
admin.  Futhermore, why would I have to refresh the detail page two or
three times?  I found that out purely by accident.

I'm not really sure what I did to fix the problem -- or even what the
problem was -- because whatever fix I performed didn't do any good
until I loaded the polls detail page a few times.

Any explanation for this behavior?

Thanks,
Ryan

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



Re: Deploying Django Apache mod_python

2008-09-25 Thread [EMAIL PROTECTED]

Thank you so much :-)! That did the trick.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: Deploying Django Apache mod_python

2008-09-25 Thread Bojan Mihelac

Would this help:

PythonPath "['/home/user/projects', '/home/user/projects/myproject'] +
sys.path"

Bojan

On Sep 25, 6:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to deploy my django project, but when I go to any urls of
> the project I get this error:
>
> Mod_python error: "PythonHandler django.core.handlers.modpython"
>
> Traceback (most recent call last):
>
>   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
> 299, in HandlerDispatch
>     result = object(req)
>
>   File "/usr/lib/python2.4/site-packages/django/core/handlers/
> modpython.py", line 222, in handler
>     return ModPythonHandler()(req)
>
>   File "/usr/lib/python2.4/site-packages/django/core/handlers/
> modpython.py", line 195, in __call__
>     response = self.get_response(request)
>
>   File "/usr/lib/python2.4/site-packages/django/core/handlers/
> base.py", line 128, in get_response
>     return self.handle_uncaught_exception(request, resolver, exc_info)
>
>   File "/usr/lib/python2.4/site-packages/django/core/handlers/
> base.py", line 159, in handle_uncaught_exception
>     callback, param_dict = resolver.resolve500()
>
>   File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 217, in resolve500
>     return self._resolve_special('500')
>
>   File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 206, in _resolve_special
>     callback = getattr(self.urlconf_module, 'handler%s' % view_type)
>
>   File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
> line 197, in _get_urlconf_module
>     self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])
>
>   File "/home/user/projects/myproject/../myproject/urls.py", line 5,
> in ?
>     admin.autodiscover()
>
>   File "/usr/lib/python2.4/site-packages/django/contrib/admin/
> __init__.py", line 40, in autodiscover
>     __import__("%s.admin" % app)
>
>   File "/home/user/projects/myproject/../myproject/news/admin.py",
> line 2, in ?
>     from myproject.news.models import Logo
>
>   File "/home/user/projects/myproject/../myproject/news/models.py",
> line 3, in ?
>     from tags.models import Tag
>
> ImportError: No module named tags.models
>
> The following is my Location section of httpd.conf:
>
> 
>     SetHandler python-program
>     PythonPath "['/home/user/projects'] + sys.path"
>     PythonHandler django.core.handlers.modpython
>     SetEnv DJANGO_SETTINGS_MODULE myproject.settings
>     PythonDebug On
> 
>
> My project exists in: /home/user/projects/myproject
>
> Any help would be much appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Deploying Django Apache mod_python

2008-09-25 Thread [EMAIL PROTECTED]

And my django install is in /usr/lib/python2.4/site-packages/django
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Deploying Django Apache mod_python

2008-09-25 Thread [EMAIL PROTECTED]

Hi,

I'm trying to deploy my django project, but when I go to any urls of
the project I get this error:

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

Traceback (most recent call last):

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

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

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

  File "/usr/lib/python2.4/site-packages/django/core/handlers/
base.py", line 128, in get_response
return self.handle_uncaught_exception(request, resolver, exc_info)

  File "/usr/lib/python2.4/site-packages/django/core/handlers/
base.py", line 159, in handle_uncaught_exception
callback, param_dict = resolver.resolve500()

  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 217, in resolve500
return self._resolve_special('500')

  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 206, in _resolve_special
callback = getattr(self.urlconf_module, 'handler%s' % view_type)

  File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py",
line 197, in _get_urlconf_module
self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])

  File "/home/user/projects/myproject/../myproject/urls.py", line 5,
in ?
admin.autodiscover()

  File "/usr/lib/python2.4/site-packages/django/contrib/admin/
__init__.py", line 40, in autodiscover
__import__("%s.admin" % app)

  File "/home/user/projects/myproject/../myproject/news/admin.py",
line 2, in ?
from myproject.news.models import Logo

  File "/home/user/projects/myproject/../myproject/news/models.py",
line 3, in ?
from tags.models import Tag

ImportError: No module named tags.models



The following is my Location section of httpd.conf:


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


My project exists in: /home/user/projects/myproject


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



Re: Query

2008-09-25 Thread Gerard Petersen

Anurag,

In your case a simple CGI script (in python) might suffice, and will only take 
you 'days' to build. If you choose to take on Django, it might take you 
'weeks'. With Django on the otherhand there are loads of features that will 
help you easily build complex web applications. But there's more information to 
digest before you have working functionality.

I'd look at the django tutorial: 
http://docs.djangoproject.com/en/dev/intro/tutorial01/

And ask yourself if you want to expand your described functionality in the 
future.

Hope it helps.

Regards,

Gerard.


ANURAG BAGARIA wrote:
> Dear Django Users,
> 
> I am totally new to the web technology kind of work. I need to develop a
> web interface (front end) which could upload certain data files to a
> server, run some calculations on it and then return the results in a
> form of an output file. I am told that this kind of work can be done
> using Django. I would request someone to kindly give me an overview of
> going about the process or any information regarding the same.
> 
> Looking forward to a positive response from the users and thanking you
> all in advance.
> 
> Warm regards.
> 
> -- 
> The road to success is always under construction ...!!!
> 
> 
> ANURAG KUMAR BAGARIA
> PhD Student
> Institute for Biophysical Chemistry
> J. W. Goethe University, Frankfurt
> Frankfurt am Main, Germany
> 
> > 

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


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



Re: Querying Users with Permission

2008-09-25 Thread Norman Harman

bobbyc881 wrote:
> I'm generating a list of Users in a specific group, in this case,
> "Artists", for a form:
> 
> artist_group = Group.objects.get(name="Artists")
> artist =
> forms.ModelChoiceField(queryset=User.objects.filter(groups=artist_group),
> required=False)
> 
> I'd like to re-write this to avoid using a Group that could get
> renamed, deleted, or change some other way in the future. I've created
> a custom permission called "in_artist_pulldown" to use. Is there a way
> to query Users that have the permission "in_artist_pulldown."  I can't
> quite seem to figure out how to access that.


User has a many to many relation with Permissions 
http://docs.djangoproject.com/en/dev/topics/db/queries/#many-to-many-relationships

user_permissions is the field name.

So, I think the syntax would be this.

   permission = Permission.objects.get(name="in_artist_pulldown")
   users = permission.users.all()

-- 
Norman J. Harman Jr.
Senior Web Specialist, Austin American-Statesman
___
Get off the sidelines and huddle up with the Statesman all season long
for complete high school, college and pro coverage in print and online!

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



Query

2008-09-25 Thread ANURAG BAGARIA
Dear Django Users,

I am totally new to the web technology kind of work. I need to develop a web
interface (front end) which could upload certain data files to a server, run
some calculations on it and then return the results in a form of an output
file. I am told that this kind of work can be done using Django. I would
request someone to kindly give me an overview of going about the process or
any information regarding the same.

Looking forward to a positive response from the users and thanking you all
in advance.

Warm regards.

-- 
The road to success is always under construction ...!!!


ANURAG KUMAR BAGARIA
PhD Student
Institute for Biophysical Chemistry
J. W. Goethe University, Frankfurt
Frankfurt am Main, Germany

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: Concept Q: Extra model fields for clean templates sake

2008-09-25 Thread Gerard Petersen

Brian,

Now that I read it ... so obvious. I've come from a long history of procedural 
coding. So I understand OOP but don't take full advantage of it yet ... 
obviously .. :-)

Thanx and Greetz!

Gerard.

Brian Neal wrote:
> On Sep 25, 4:33 am, Gerard Petersen <[EMAIL PROTECTED]> wrote:
>> Hi All,
>>
>> I'm finding myself creating more and more fields in a model to keep my 
>> templates clean. Since it's merely temporary calculated data, and not data 
>> to store permanently it feels like the wrong place. An example:
>>
>> I have a product model (child object of an order model). The product has a 
>> 'per_price' and 'amount' field that get filled by the user. I gave the 
>> product an extra field called 'total_price' where I store 'amount * 
>> per_price' just before my view and my template come together. This way all 
>> that's needed to display an invoice is in the objects list.
>>
>> Calculating this in the template also doesn't seem the way. For MVC's sake I 
>> belief this belongs in the view, but then it's to late (read: there's no 
>> field on the object) to store temporary stuff.
>>
>> The Q: How does one relate temporary data to objects in a list, before it's 
>> rendered in a template?
> 
> In addition to what has already been mentioned, it is also handy to
> define convenience functions on your model classes that return
> information like this. So your model could be given a total_price()
> member function that calculates it based upon member data. These
> convenience functions are easily accessed in the template.
> > 

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


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



Re: amd64 vs x86 hosting

2008-09-25 Thread David Durham, Jr.

>> I think the primary difference is the amount of RAM that is supported
>> and whether or not you have compatible software.  With that said, all
>> modern processors are x64 so you probably want to default with an x64
>> OS unless you need x86 for software compatibility reasons.
>
> That's not what our tests tells. Just swaping operating system build
> for amd64 gives some 10% ~ 15% gain. It's a gain that enables
> inserting a small site into the same box.

I hope you end up running amd64 on Intel(R) Core(TM) 2 Duo because you
can get another 10 to 15 percent improvement that way.  :)

-Dave

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



Re: How can I test my api between two servers running django

2008-09-25 Thread Steve Holden

Alexander Pugachev wrote:
> crazy russian
>
> 2008/9/23 Vitaliy <[EMAIL PROTECTED] >
>
>
> >so they both created test db for each other
> I meen for them selfs :)
>

We can probably do without any kind of racial slur, thanks.

regards
 Steve
(a crazy englishman)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: new user needs some advice setting up a model...

2008-09-25 Thread paul

this works well when i'm editing an individual shot.  however, i get a
error when editing shots inline.  i've had a good look around - and
this was a known problem.  does anyone know if this has been fixed?

another question: right now, i'm using the admin UI to input data.
right now, my app is more of an internal produciton system - so it
doens't need to look pretty.  however, i have also read that 'auto
forms' could/should be used instead.  can anyone set me straight
please?

many thanks again,

paul


On Sep 24, 9:40 pm, "Alexander Pugachev"
<[EMAIL PROTECTED]> wrote:
> You can force database to watch after columns to be unique by one or in
> combinations.
> Django admin interface also can watch after this restrictions.
> How to make a model to have few attributes unique together is described
> here:
>  http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together
> So you make job and id to be unique together in shot model.
>
> 2008/9/24 paul <[EMAIL PROTECTED]>
>
>
>
> > hi all,
>
> > i've thrown myself into developing an animation pipeline using
> > django.  i'm new to both python and django - but have in the (distant)
> > past written thousands of lines of c,c++ & perl.  so, please be gentle
> > - but maybe not too gentle with me.
>
> > this first question is quite simple.  i have a job and shot classes
> > (should i call them tables?).  each job has a unique name, and can
> > have many shots attached to it.  a shot must have a unique name within
> > each job.  ie,
>
> > job=bmw, shot=1,2,3,looktest
> > job=goldfrapp, shot=1,2,3,4,5,6,looktest,animtest
>
> > currently, i'm using the admin UI to input job and shot information.
> > my question is what is the best way to make sure that i never have a
> > two shots of the same name per job?  should this logic be inserted
> > into the save method of the shot, or could/should it be inserted
> > elsewhere (ie, within the model itself)?
>
> > sorry for the simplicity of the question - i'm still trying to get to
> > grips with django/pythonific best practice...
>
> > regards to all,
>
> > paul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Querying Users with Permission

2008-09-25 Thread bobbyc881

I'm generating a list of Users in a specific group, in this case,
"Artists", for a form:

artist_group = Group.objects.get(name="Artists")
artist =
forms.ModelChoiceField(queryset=User.objects.filter(groups=artist_group),
required=False)

I'd like to re-write this to avoid using a Group that could get
renamed, deleted, or change some other way in the future. I've created
a custom permission called "in_artist_pulldown" to use. Is there a way
to query Users that have the permission "in_artist_pulldown."  I can't
quite seem to figure out how to access that.

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



Problems with Filter+Exclude

2008-09-25 Thread [EMAIL PROTECTED]

I need Help with this QuerySet !!!

FooTable.objects.filter(endzeit__lte
=convertFirstDayOfWeekToDatetime).exclude(user__user_permissions__codename='bla')

I this error:
-
no such column: auth_user.id

Request Method: POST
Request URL:http://10.20.137.34:8000/sarbs/bookroom/
Exception Type: OperationalError
Exception Value:

no such column: auth_user.id

Exception Location: /usr/lib/python2.5/site-packages/django/db/
backends/sqlite3/base.py in execute, line 167
Python Executable:  /usr/bin/python
Python Version: 2.5.2


but it still works if i only use

FooTable.objects.exclude(user__user_permissions__codename='bla')

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

2008-09-25 Thread Russell Keith-Magee

On Thu, Sep 25, 2008 at 8:52 PM, Rodrigo Culagovski
<[EMAIL PROTECTED]> wrote:
>
> Ok, so if I raiseValidationError in the save() methods, will this just
> give a big fat ugly general error, or a cute "You have to provide your
> complete credit card number" error?

Well... it will do whatever you program it to do. It depends entirely
on the validation error that you raise, where you catch that error,
and how you process it.

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: Concept Q: Extra model fields for clean templates sake

2008-09-25 Thread Brian Neal

On Sep 25, 4:33 am, Gerard Petersen <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm finding myself creating more and more fields in a model to keep my 
> templates clean. Since it's merely temporary calculated data, and not data to 
> store permanently it feels like the wrong place. An example:
>
> I have a product model (child object of an order model). The product has a 
> 'per_price' and 'amount' field that get filled by the user. I gave the 
> product an extra field called 'total_price' where I store 'amount * 
> per_price' just before my view and my template come together. This way all 
> that's needed to display an invoice is in the objects list.
>
> Calculating this in the template also doesn't seem the way. For MVC's sake I 
> belief this belongs in the view, but then it's to late (read: there's no 
> field on the object) to store temporary stuff.
>
> The Q: How does one relate temporary data to objects in a list, before it's 
> rendered in a template?

In addition to what has already been mentioned, it is also handy to
define convenience functions on your model classes that return
information like this. So your model could be given a total_price()
member function that calculates it based upon member data. These
convenience functions are easily accessed in the template.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



manyTomany visibility in admin

2008-09-25 Thread [EMAIL PROTECTED]

sorry, i forgot to mention that i am using debian stable version 
0.95.1-1etch2

-

hi all

i have a model with two ManyToManyFields. The problem is, that when i
choose some values,save it, and later come to the same record, the
values for this columns are not visible as marked. From mysql terminal
everything is ok. So it is little bit confusing.

class Tester(models.Model):
title=models.CharField('title', maxlength=255)
test_winner=models.ManyToManyField(Book,
related_name="band_tester_winner")
test_losser=models.ManyToManyField(Book,
related_name="book_tester_looser")

def __str__(self):
return self.title

class Admin:
list_display = ('id', 'title', )
list_display_links = ('title', )

actualy i do not know where to look for debugging
thank you
pavel




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



manyTomany visibility in admin

2008-09-25 Thread [EMAIL PROTECTED]

hi all

i have a model with two ManyToManyFields. The problem is, that when i 
choose some values,save it, and later come to the same record, the 
values for this columns are not visible as marked. From mysql terminal 
everything is ok. So it is little bit confusing.

class Tester(models.Model):
title=models.CharField('title', maxlength=255)
test_winner=models.ManyToManyField(Book, 
related_name="band_tester_winner")
test_losser=models.ManyToManyField(Book, 
related_name="book_tester_looser")

def __str__(self):
return self.title

class Admin:
list_display = ('id', 'title', )
list_display_links = ('title', )

actualy i do not know where to look for debugging
thank you
pavel



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: Concept Q: Extra model fields for clean templates sake

2008-09-25 Thread Gerard Petersen

Daniel,

On the object dynamicness, I think my brain malfunctioned because somehow I new 
this, but you just helped me remove 3 fields on my product model ... ;-)

As far as placing the calculation in the view or the template (thanks on the 
example btw). An invoice is now generated in html but in the future I want to 
be able to generate them in pdf or ms word as well. So doing the work in the 
view seems like easier transition to those filetypes in the future.


Regards,

Gerard.

Daniel Roseman wrote:
> On Sep 25, 10:33 am, Gerard Petersen <[EMAIL PROTECTED]> wrote:
>> Hi All,
>>
>> I'm finding myself creating more and more fields in a model to keep my 
>> templates clean. Since it's merely temporary calculated data, and not data 
>> to store permanently it feels like the wrong place. An example:
>>
>> I have a product model (child object of an order model). The product has a 
>> 'per_price' and 'amount' field that get filled by the user. I gave the 
>> product an extra field called 'total_price' where I store 'amount * 
>> per_price' just before my view and my template come together. This way all 
>> that's needed to display an invoice is in the objects list.
>>
>> Calculating this in the template also doesn't seem the way. For MVC's sake I 
>> belief this belongs in the view, but then it's to late (read: there's no 
>> field on the object) to store temporary stuff.
>>
>> The Q: How does one relate temporary data to objects in a list, before it's 
>> rendered in a template?
>>
>> Thanx a lot,
>>
>> Gerard.
>>
>> Some source snippets if it's not clear:
>>
>> #  Model
>> class Product(models.Model):
>> per_price = models.DecimalField('Product price', max_digits=15, 
>> decimal_places=2)
>> total_price = models.DecimalField('Calculated', max_digits=15, 
>> decimal_places=2, editable=False, null=True)
>> amount = models.IntegerField('#', max_length=10)
>>
>> #  View
>> def download_order(request, order_id):
>> for p in product_list:
>> # Calculate product totals
>> p.total = Decimal(p.amount * p.per_price)
>>
>> #  Template
>> {% for product in product_list %}
>> 
>> {{ product.name }}
>> {{ product.description }}
>> {{ product.total }}
>>
> 
> 
> Well I'd disagree that you shouldn't do this in the template - this is
> exactly the sort of thing that could go there.
> 
> However if you're committed to doing it in the view, you should
> remember that model instances are just Python objects, so are dynamic.
> It's perfectly legal to assign to an attribute on the model which
> isn't defined elsewhere. So even if you didn't have a total_price
> field, you could still do p.total_price = whatever and then access
> that in the template.
> 
> Another way of doing it would be to add both the total and the model
> to a list:
> products_totals = [(p, p.amount * p.per_price) for p in product_list]
> 
> and in the template:
> {% for product in product_list %}
> {{ product.0.name }}
> {{ product.0.description }}
> {{ product.1 }}
> 
> ... or you could even make it a list of dictionaries so that the
> template is clearer.
> --
> DR.
> > 

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


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



Re: migration problem from Django0.96 to Django1.0

2008-09-25 Thread Karen Tracey
On Thu, Sep 25, 2008 at 7:35 AM, jbarker <[EMAIL PROTECTED]> wrote:

>
> The issue is that WEEKDAYS_ABBR is not defined in /usr/lib/python2.5/
> site-packages/django/utils/dates.py so it's not found. Edit dates.py
> and add it in.
>
>
For anyone who hits this problem, just editing dates.py to contain
WEEKDAYS_ABBR is not the way to fix it.  Hitting this problem indicates you
installed Django 1.0 on top of some earlier level of Django without first
removing the old level, and what you wind up with is a mixture of old and
new files -- this dates.py file is not the only one affected.  You need to
go back and remove Django entirely and reinstall in order to get a complete
Django 1.0 install.

Karen

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



Re: Whither Validators?

2008-09-25 Thread Rodrigo Culagovski

Ok, so if I raiseValidationError in the save() methods, will this just
give a big fat ugly general error, or a cute "You have to provide your
complete credit card number" error?

Thanks for the clarification.

Rodrigo

On Sep 24, 7:41 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Thu, Sep 25, 2008 at 12:30 AM, Rodrigo Culagovski
>
> <[EMAIL PROTECTED]> wrote:
>
> > Validators (django.core.validators) seem to have been removed from
> > 1.0. What replaces them?
>
> Well... validators weren't ever really there to begin with. There was
> some initial stub code, but it wasn't fully integrated into models.
>
> Model validation (Ticket #6845) was on the list of possible v1.0
> features, but got bumped from the feature list because the
> implementation wasn't quite ready. It's certainly on the list of
> features intended for v1.1.
>
> In the meantime, there is form-level validation; you can also override
> the save() method to ensure that invalid models aren't saved. It's not
> particularly pretty, but a better solution is on the way. If you're
> feeling adventurous, you can try out the patch on #6845 and let us
> know about any problems you have.
>
> 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: Difference between sqlite3 and mysql backend on test code involving generic relationships

2008-09-25 Thread Oliver Andrich
Well, it seems to happen, when the post_syncdb signal code from
django.contrib.auth is called. Somehow calling the code from ./manage.py
test differes from ./manage.py flush. I think I will reproduce this in a
minimal django project and try file a bug report.

Best regards,
Oliver

-- 
Oliver Andrich <[EMAIL PROTECTED]> --- http://oliverandrich.net/

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

2008-09-25 Thread Thomas Guettler

Hi,

maybe the SQLLogMiddleware snippet helps you:
 http://www.djangosnippets.org/snippets/344/

 Thomas Güttler

Chris schrieb:
> I'm trying to debug a usage of callproc, which doesn't return any rows
> when used inside Django. Is there anyway to view the SQL and escaped
> values sent from db cursor? I found
> http://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-raw-sql-queries-django-is-running
> by this doesn't show anything. When they say "just do this", are they
> implying we should run that from a manage.py shell?
>
>   


-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de


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

2008-09-25 Thread Tim Chase


 > (I'm using windows xp home)
 >
 > I typed : C:\>django-admin.py25 into the command prompt and it comes
 > up with the message:
 >
 > 'C:\' is not recognized as and internal or external  command operable
 > program or batch file.

If you typed that whole string literally  it was treated as

C:\  > django-admin.py25
111  2 33344

1) a program to run called "C:\".  No such program exists, and thus the 
error it gives you

2) redirect the output of that "program" (that doesn't exist) into a 
file in the current directory called "django-admin.py25"

3) the file name it would redirect to

4) likely a copy error tacking on a 25 from perhaps a footnote


What you want is to interpret this portion:

C:\>

as your shell prompt.  When you first bring up a command-prompt, it's 
likely something likie

   C:\Documents and Settings\timbis\>

Assuming you've followed the instructions to set your PATH environment 
variable, you just type

   django-admin.py

at this prompt.  Going through a short primer on using Dos might be a 
good start to get you comfortable at wandering around in your 
command-shell.  There's a fair bit of power and control, but it requires 
learning how to use it.

-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: Difference between sqlite3 and mysql backend on test code involving generic relationships

2008-09-25 Thread Oliver Andrich
I looked a bit deeper into this issue, and so far I can say, that the
exception is raised by django.test.TestCase in the method _pre_setup.
call_command('flush', verbosity=0, interactive=False) is where it
originates. Calling ./manage.py flush on the command line works like a
charm. I also have to note, that DocumentTests includes 3 tests - the first
always works while the later two always fail. But it is not depend on the
test itself, but simply on the order of the tests in the test case.

Bye, Oliver
-- 
Oliver Andrich <[EMAIL PROTECTED]> --- http://oliverandrich.net/

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



[OT] Looking for developers: platform for fast and effective learning

2008-09-25 Thread Adam Dziendziel

Hello everybody,

I'm working on a website for fast and effective learning using spaced
repetition technique.
This is the same method used in SuperMemo, Mnemosyne, FullRecall or
Anki software.
I'd want to create an online version, supporting easy adding of own
material and sharing with others. The method is very effective and is
great for learning foreign language, learning to exams etc. I wonder
that there is no such site running already. There is SuperMemo.net,
but it is a typical commercial application, oriented for selling
commercial courses. I would like to put on building community,
collaboration in writing material and social learning.

I'm looking for ambitious people, who want to take part in this
undertaking. I can offer revenue share, if the project succeed.

Technologies: Python (Pylons) + JavaScript (Ext JS)
I have a working base in Pylons and Ext JS but we can consider
changing tools.

Best regards,
Adam Dziendziel
adam (dot) dziendziel (at) gmail (dot) com

PS. Sorry for OT, it is hard to find a good place to ask.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: migration problem from Django0.96 to Django1.0

2008-09-25 Thread jbarker

The issue is that WEEKDAYS_ABBR is not defined in /usr/lib/python2.5/
site-packages/django/utils/dates.py so it's not found. Edit dates.py
and add it in.

Joe

On Sep 15, 10:39 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Mon, Sep 15, 2008 at 1:58 AM, vijay bhaskar <[EMAIL PROTECTED]> wrote:
> > I solved that problem.
>
> How please?  Someone else is running into trouble with WEEKDAYS_ABBR and I
> can't understand why. What fixed the problem for you?
>
> Thanks,
> Karen
>
>
>
> >> On Mon, Sep 15, 2008 at 11:07 AM, vijay bhaskar <[EMAIL PROTECTED]>wrote:
>
> >>> Hi karen,Thanks for your reply.but the problem is ,there is no
> >>> definition for WEEKDAYS_ABBR in the django.utils.dates.That's the reason
> >>> its throwing error.How can i get rid of this?
>
> >>> Thanks & regards
> >>> Vijay
>
> >>> On Sat, Sep 13, 2008 at 5:39 PM, Karen Tracey <[EMAIL PROTECTED]>wrote:
>
>  On Sat, Sep 13, 2008 at 5:28 AM, vijay <[EMAIL PROTECTED]> wrote:
>
> > When i'am trying to migrate my application which is wriiten in 0.96
> > version to 1.0, i encountered the following error message.
>
> >  File "c:\python25\lib\site-packages\django\utils\dateformat.py",
> > line 127, in D
> >    return WEEKDAYS_ABBR[self.data.weekday()]
> > NameError: global name 'WEEKDAYS_ABBR' is not defined
>
> > Is there any patch available for this? How can i get rid of this
> > problem?
>
>  Have you modified that file django\utils\dateformat.py?  The one shipped
>  with 1.0 does not have the problem you are seeing since it imports
>  WEEKDAYS_ABBR from where it is defined before using it, see line 14 in:
>
> http://code.djangoproject.com/browser/django/tags/releases/1.0/django...
>
>  (Also the line number reported in your error message does not match what
>  is on that line the shipped version of the file, so something seems to 
>  have
>  happened to alter your 1.0 Django files, or at least this one.)
>
>  Karen

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



Re: collecting field values from bound forms (beginner question)

2008-09-25 Thread Daniel Roseman

On Sep 25, 9:36 am, "I.K." <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've spent a short while reading the documentation but not spotted
> what I need. Could somebody point me to the right place please?
>
> Is there a way to put a bound  Django form into a template to render
> an HTML form with the previously posted values in it?  I'd like to get
> the field value specifically, as I introduce javascript handlers on
> some fields and don't want django to render the whole field.
>
> For example, a user fills in an html form with their address but
> leaves out a mandatory field, after validation I wish to render the
> same HTML with all of the previously submitted values in the form.
>
> Thanks in advance

I'm not really sure what you're asking here - at first you say you
don't want Django to render the form, then you say you want it
completely rendered.

Assuming all you want is to redisplay a partially filled form that
failed validation along with all the entered values, that's actually
the standard way to handle forms in Django. See here:
http://docs.djangoproject.com/en/dev/topics/forms/#using-a-form-in-a-view
On a POST, the form is bound to the data, and if it is not valid, the
bound form is redisplayed.

Does that answer your question?

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



Re: Admin redirecting to wrong URL?

2008-09-25 Thread Allan

Hi Graham.

I do indeed have the PythonOption set in httpd.conf.  Unfortunately,
this doesn't seem to be the issue -- www.mysite.com/django/admin/
still gets transformed to www.mysite.com/admin after the admin login,
which generates a 404 because that's not where admin is.

Any other ideas?  I'm really scratching my head on this one

Allan


On Sep 24, 8:07 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Sep 24, 11:37 pm, Allan <[EMAIL PROTECTED]> wrote:
>
> > Hi Graham,
>
> > Thanks for responding.  I'm using Django 1.0, hosted at Webfaction on
> > Apache usingmod_python.  What special configuration or hacks would
> > you suggest to get admin properly working at a sub URL of this
> > configuration?
>
> For mod_python, are you following what documentation at:
>
>  http://docs.djangoproject.com/en/dev/howto/deployment/modpython/
>
> says for Django 1.0 and setting:
>
>   PythonOption django.root /django
>
> This is required for mod_python else Django doesn't know it is mounted
> at a sub URL.
>
> Graham
>
> > Allan -- Atlanta
>
> > On Sep 23, 8:04 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Sep 24, 5:43 am, Allan <[EMAIL PROTECTED]> wrote:
>
> > > > My application is working well at mysite.com/django/, and I get
> > > > an admin login at mysite.com/django/admin/ -- but when I
> > > > enter my credentials, I seem to be redirected to mysite.com/
> > > > admin/ (which is a 404 error).  Did I miss an admin config setting
> > > > somewhere?
>
> > > > A relevant excerpt from urls.py appears below.
>
> > > > Allan
>
> > > > import os
> > > > from django.conf.urls.defaults import *
> > > > from django.conf import settings
> > > > from django.contrib import admin
>
> > > > admin.autodiscover()
>
> > > > urlpatterns = patterns('',
>
> > > >     (r'^contact/$', 'careers_contact.views.contact'),
> > > >     (r'^careers/$', 'careers_contact.views.careers'),
>
> > > >     (r'^admin/(.*)', admin.site.root),
> > > > )
>
> > > How are you hosting Django and what version of Django are you using?
>
> > > Depending on how you are hosting Django and what version, you may have
> > > to set special configuration or use hacks to allow it to properly host
> > > at a sub URL of an Apache installation.
>
> > > 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: Concept Q: Extra model fields for clean templates sake

2008-09-25 Thread Daniel Roseman

On Sep 25, 10:33 am, Gerard Petersen <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm finding myself creating more and more fields in a model to keep my 
> templates clean. Since it's merely temporary calculated data, and not data to 
> store permanently it feels like the wrong place. An example:
>
> I have a product model (child object of an order model). The product has a 
> 'per_price' and 'amount' field that get filled by the user. I gave the 
> product an extra field called 'total_price' where I store 'amount * 
> per_price' just before my view and my template come together. This way all 
> that's needed to display an invoice is in the objects list.
>
> Calculating this in the template also doesn't seem the way. For MVC's sake I 
> belief this belongs in the view, but then it's to late (read: there's no 
> field on the object) to store temporary stuff.
>
> The Q: How does one relate temporary data to objects in a list, before it's 
> rendered in a template?
>
> Thanx a lot,
>
> Gerard.
>
> Some source snippets if it's not clear:
>
> #  Model
> class Product(models.Model):
>     per_price = models.DecimalField('Product price', max_digits=15, 
> decimal_places=2)
>     total_price = models.DecimalField('Calculated', max_digits=15, 
> decimal_places=2, editable=False, null=True)
>     amount = models.IntegerField('#', max_length=10)
>
> #  View
> def download_order(request, order_id):
>     for p in product_list:
>         # Calculate product totals
>         p.total = Decimal(p.amount * p.per_price)
>
> #  Template
>     {% for product in product_list %}
>         
>             {{ product.name }}
>             {{ product.description }}
>             {{ product.total }}
>


Well I'd disagree that you shouldn't do this in the template - this is
exactly the sort of thing that could go there.

However if you're committed to doing it in the view, you should
remember that model instances are just Python objects, so are dynamic.
It's perfectly legal to assign to an attribute on the model which
isn't defined elsewhere. So even if you didn't have a total_price
field, you could still do p.total_price = whatever and then access
that in the template.

Another way of doing it would be to add both the total and the model
to a list:
products_totals = [(p, p.amount * p.per_price) for p in product_list]

and in the template:
{% for product in product_list %}
{{ product.0.name }}
{{ product.0.description }}
{{ product.1 }}

... or you could even make it a list of dictionaries so that the
template is clearer.
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: amd64 vs x86 hosting

2008-09-25 Thread mcosta

On Sep 24, 6:07 pm, "David Durham, Jr." <[EMAIL PROTECTED]>
wrote:
> On Wed, Sep 24, 2008 at 6:14 AM, mcosta <[EMAIL PROTECTED]> wrote:
> > One question: ¿amd64 or x86? we've got some bechmark claiming superior
> > performance for amd64, both with python and mysql, but then we can not
> > tune with psyco. We've taken a look at pyrex but we do not know even
> > if we are shooting in our foot with any of these. ¿are these
> > technologies useful for actual web app tuning?
>
> I think the primary difference is the amount of RAM that is supported
> and whether or not you have compatible software.  With that said, all
> modern processors are x64 so you probably want to default with an x64
> OS unless you need x86 for software compatibility reasons.

That's not what our tests tells. Just swaping operating system build
for amd64 gives some 10% ~ 15% gain. It's a gain that enables
inserting a small site into the same box.

I like to do my own tests, so I ignore the published ones. But a quick
google search shows the same I stated above:

http://www.scribd.com/doc/363677/Benchmarks-AMD64-in-32bit-mode-vs-64bit-mode-Ubuntu

But how I told, we have real world fact with LAMP + cakePHP, and not
with Linux+(cherokee, apache)+Mysql+(django, pylons) etc
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: amd64 vs x86 hosting

2008-09-25 Thread mcosta

On Sep 24, 5:32 pm, Christian Joergensen <[EMAIL PROTECTED]> wrote:
> mcosta wrote:
> > One question: ¿amd64 or x86? we've got some bechmark claiming superior
> > performance for amd64, both with python and mysql, but then we can not
> > tune with psyco. We've taken a look at pyrex but we do not know even
> > if we are shooting in our foot with any of these. ¿are these
> > technologies useful for actual web app tuning?
>
> In my experience, when it comes to database backed web applications, the
> application logic is seldom the bottleneck (unless, of course, you do a
> lot of numbers crushing).
>
> You should probably focus your optimization on your database instead,
> and not so much whether you should use psyco or pyrex to speed up your
> Python code.

So we should go with amd64 for the faster mysql and easy memory
upgrade. In a hurry we can get obscene RAM sizes.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Difference between sqlite3 and mysql backend on test code involving generic relationships

2008-09-25 Thread Oliver Andrich
Hi,

I encounter strange differences when I run my test code against sqlite3 and
against mysql. I am about to test it with Postgresql later today. My models
make heavy use of generic relationships. And everytime I run "./manage.py
test" with the mysql backend I receive the following error.

IntegrityError: (1452, 'Cannot add or update a child row: a foreign key
constraint fails (`test_redweb_crossmedia/auth_permission`, CONSTRAINT
`content_type_id_refs_id_728de91f` FOREIGN KEY (`content_type_id`)
REFERENCES `django_content_type` (`id`))')

This is one example testcode I use.

class DocumentTests(TestCase):

def setUp(self):
self.user = User.objects.get_or_create(username='test',
password='test')[0]

def test_creation_of_attachments_and_the_manager(self):
test_document = File(open(path.join(BASEDIR, 'test.pdf'), 'rb'))
doc = Document(content_object=self.user, created_by=self.user)
doc.file.save('test.pdf', test_document)
[...]
doc.delete()

I get_or_create an user, create some kind of attachment class, setup a
generic relationship between both and thats it. In sqlite3 this works like a
charm. Can anybody drop me a helpful tip? The app itself works like
expected, but I would appreciate to have working testcode. :)

Best regards,
Oliver

-- 
Oliver Andrich <[EMAIL PROTECTED]> --- http://oliverandrich.net/

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

2008-09-25 Thread Graham Dumpleton

On Sep 25, 8:29 pm, "n00m" <[EMAIL PROTECTED]> wrote:
> what if to rename mod_python.so to mod_python_1.so and mod_python_2.so and 
> keep them both
> in apache's modules and run them as if they are different beasts.

You cannot do that. If you are wanting process separation then use
mod_wsgi daemon mode or fastcgi.

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: Command Prompt

2008-09-25 Thread Amit Ramon

* timbis2 <[EMAIL PROTECTED]> [2008-09-25 02:25 -0700]:
> 
> (I'm using windows xp home)
> 
> I typed : C:\>django-admin.py25 into the command prompt and it comes
> up with the message:
> 

> 'C:\' is not recognized as and internal or external  command operable
> program or batch file.

Are you actually typing "C:\>" ??? This is part of the command prompt,
if you saw it in some example it was not meant to be typed. Or, at
least, if you meant to provide the full path of django-admin.py, the
greater-than character (>) should not be there. All you have to type
is django-admin.py to run it, or, to get help:
django-admin.py help
or, for the version
django-admin.py --version

All this assumes it is in your PATH. If not, provide the full path of
it. On windows it should be something like
c:\dir1\dir2\django-admin.py
(I'm not on windows, so I don't know the exact location.)

Hope this helps,

Amit

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

2008-09-25 Thread n00m


what if to rename mod_python.so to mod_python_1.so and mod_python_2.so and keep 
them both 
in apache's modules and run them as if they are different beasts.


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



Concept Q: Extra model fields for clean templates sake

2008-09-25 Thread Gerard Petersen

Hi All,

I'm finding myself creating more and more fields in a model to keep my 
templates clean. Since it's merely temporary calculated data, and not data to 
store permanently it feels like the wrong place. An example:

I have a product model (child object of an order model). The product has a 
'per_price' and 'amount' field that get filled by the user. I gave the product 
an extra field called 'total_price' where I store 'amount * per_price' just 
before my view and my template come together. This way all that's needed to 
display an invoice is in the objects list. 

Calculating this in the template also doesn't seem the way. For MVC's sake I 
belief this belongs in the view, but then it's to late (read: there's no field 
on the object) to store temporary stuff.

The Q: How does one relate temporary data to objects in a list, before it's 
rendered in a template?

Thanx a lot,

Gerard.


Some source snippets if it's not clear:

#  Model
class Product(models.Model):
per_price = models.DecimalField('Product price', max_digits=15, 
decimal_places=2)
total_price = models.DecimalField('Calculated', max_digits=15, 
decimal_places=2, editable=False, null=True)
amount = models.IntegerField('#', max_length=10)

#  View
def download_order(request, order_id):
for p in product_list:
# Calculate product totals
p.total = Decimal(p.amount * p.per_price)


#  Template
{% for product in product_list %}

{{ product.name }}
{{ product.description }}
{{ product.total }}



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


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



Command Prompt

2008-09-25 Thread timbis2

(I'm using windows xp home)

I typed : C:\>django-admin.py25 into the command prompt and it comes
up with the message:



'C:\' is not recognized as and internal or external  command operable
program or batch file.

How can this be resolved??? It simply won't work!

so that the current version of Django is printed on the screen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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: 'module' object has no attribute 'TabularInLine' Attribute Error in Django 1

2008-09-25 Thread Elliot Tucker

Thanks for being dumb TeenSpirit83, i've just spent 30mins trying to
fix exactly the same typo...small world.

On Sep 11, 2:56 pm, TeenSpirit83 <[EMAIL PROTECTED]> wrote:
> > The L in Inline should not be capitalized.  Is it in some doc you are
> > working from?
>
> > Karen
>
> The docs are correct!
> I'm so dumb, it is the first time I notice the L is not capitalized!
> I was sure of the opposite!
> Thanks a lot Karen!

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



collecting field values from bound forms (beginner question)

2008-09-25 Thread I.K.

Hi,

I've spent a short while reading the documentation but not spotted
what I need. Could somebody point me to the right place please?

Is there a way to put a bound  Django form into a template to render
an HTML form with the previously posted values in it?  I'd like to get
the field value specifically, as I introduce javascript handlers on
some fields and don't want django to render the whole field.

For example, a user fills in an html form with their address but
leaves out a mandatory field, after validation I wish to render the
same HTML with all of the previously submitted values in the form.

Thanks in advance

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



Re: Why does Django generate HTTP 500 errors for static media when Debug is set to False?

2008-09-25 Thread Graham Dumpleton



On Sep 25, 10:58 am, shacker <[EMAIL PROTECTED]> wrote:
> On Sep 24, 4:34 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > If however you have used in Apache configuration the ErrorDocument
> > directive for 404 at some point, possibly by enabling multi language
> > custom error documents, then when the 404 occurs, rather than
> > returning an internally generated generic 404 error response, Apache,
> > based on the value of the ErrorDocument directive may trigger a sub
> > request to a handler to generate the custom error document.
>
> We had a very similar problem with a wsgi setup on a cPanel machine.
> cPanel defines the location of a bunch of Apache error documents
> globally for all vhosts - error docs that don't exist in a Django
> setup. The solution was to override those settings in the vhost
> configuration for the site in question, like this:
>
> ErrorDocument 401 "Authentication Error"
> ErrorDocument 403 "Forbidden"
>
> That way 401 and 403 return strings, rather than paths to non-existent
> files, and the problem goes away.

Alternatively, add error pages in Django and set the ErrorDocument
directive to be the path that Django hosts the error page at.

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: UserProfile problem

2008-09-25 Thread Lars Stavholm

Denis Morozov wrote:
> Look at this post, it seems to be what you need:
> http://pyxx.org/2008/08/18/how-to-extend-user-model-in-django-and-enable-new-fields-in-newforms-admin/
> 
> And you have to read comments to that page, where is some fix to the
> code in the comments.

And that, of course, worked just fine:)
Thanks
/Lars

> On Sep 24, 7:03 pm, Lars Stavholm <[EMAIL PROTECTED]> wrote:
>> Running django-1.0 out of svn trunk, just updated today (9084).
>>
>> I've defined my UserProfile according to the latest documentation:
>>
>> class UserProfile(models.Model):
>>  user  = models.ForeignKey(User, unique=True)
>>  dep   = models.CharField("Department", max_length=20, blank=True)
>>  phone = models.CharField(max_length=20, blank=True)
>>  notes = models.TextField(blank=True)
>>
>> I've added the following to my settings.py:
>>
>> AUTH_PROFILE_MODULE = 'app.userprofile'
>>
>> But I still don't get any extra fields in the admin.
>>
>> What am I missing?
>>
>> Any input appreciated
>> /Lars
> > 
> 



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



Re: get children of children

2008-09-25 Thread krylatij

You can also try django-mptt,
that works great with object hierarchy
http://code.google.com/p/django-mptt/

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