Re: How to hire a freelance Django developer

2011-03-30 Thread moham...@efazati.org

http://djangopeople.net/

On 03/30/2011 11:06 AM, Lakshman Prasad wrote:

> Is there a good *free* resource to browse freelance Django developers

github.com  is out there: 
https://github.com/search?q=django


On Wed, Mar 30, 2011 at 5:34 AM, Micah Carrick > wrote:


Hey folks,

Let me start by saying: Please don't email me your resume--this is
not a job listing.

That being said, I do need to hire python/django developers and
system admins from time to time to help me out with projects or
take something off my plate. Is there a good *free* resource to
browse freelance Django developers and/or post freelance gigs? I'm
typically hiring somebody to help with very small, open-source
projects for which I am not trying to make money off of. So paying
$300 at github, stackoverflow, or any other paid job posting site
is not an option.




-- 
You received this message because you are subscribed to the Google

Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com
.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


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



django-packagemaker a paster tool for making reusable apps

2011-03-30 Thread Preston Holmes
I've just pushed an initial release of a tool that will hopefully make
it easier to make apps more easily shareable.

The idea is something like this:

manage.py startapp gets you a start, but once you get something to the
point where you might want to share it, now you've got to wrap it up
in all the packaging.  This means copying and pasting boilerplate for
a setup.py, setting up the dist layout, etc.

This is also required if you want to use your app via pip
requirements.

This tool uses paste script to automate much of this process and can
be used as an alternative to startapp

https://github.com/ptone/django-packagemaker

The template is opinionated about a few things, and this is just a
start, feedback and contributions welcomed.

-Preston

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



UnicodeDecodeError with makemessages in django-1.3

2011-03-30 Thread Dirk Eschler
Hello,

i get a UnicodeDecodeError when running makemessages in the project folder 
with django-1.3, it works fine with django-1.2.

The release notes mention a change in the project-level handling of 
translations. Adding the project locale folder to LOCALE_PATHS doesn't seem to 
make a difference. I'm not sure if i understand the deprecation correctly - 
does it mean that the whole locale folder in the project directory should be 
dropped in favour of app level locale folders? Has this anything to do with 
the exception i get?

$ ./manage.py makemessages -l de
processing language de
Traceback (most recent call last):
  File "./manage.py", line 11, in 
execute_manager(settings)
  File "/path/to//django/core/management/__init__.py", line 438, in 
execute_manager
utility.execute()
  File "/path/to//django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/path/to//django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/path/to//django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
  File "/path/to//django/core/management/base.py", line 351, in handle
return self.handle_noargs(**options)
  File "/path/to//django/core/management/commands/makemessages.py", line 365, 
in handle_noargs
make_messages(locale, domain, verbosity, process_all, extensions, 
symlinks, ignore_patterns, no_wrap, no_obsolete)
  File "/path/to//django/core/management/commands/makemessages.py", line 233, 
in make_messages
f.write(templatize(src, orig_file[2:]))
  File "/path/to//django/utils/translation/__init__.py", line 127, in 
templatize
return _trans.templatize(src, origin)
  File "/path/to//django/utils/translation/trans_real.py", line 450, in 
templatize
content = u''.join(comment)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 284: 
ordinal not in range(128)


Best Regards,
Dirk Eschler

-- 
Dirk Eschler 

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



Re: Invalid values in a form cause validation to fail

2011-03-30 Thread ALJ
Hi Karen,

Here is an example that I use to replicate the error:

view >>
def myview(request)
filter_form = RatingsListFilterForm(request.GET or None)
if filter_form.is_valid():
return HttpResponse("Worked!")

return render_to_response('ratings_list.html',
  {'filter_form':filter_form,
 
#'current_ratings_list':current_ratings_list,
   #'temp':temp},
   },
 
context_instance=RequestContext(request))
>>

form >
class RatingsListFilterForm(forms.Form):
organisation_name = forms.CharField(required=False,
widget=forms.TextInput(attrs={'class':'textbox'}))
corporation = forms.ModelChoiceField(required=False,
queryset=Corporation.objects.all(),
widget=forms.Select(attrs={'class':'selector'}))

>>>

Traceback>>
File "C:\Python26\lib\site-packages\django\core\handlers\base.py" in
get_response
  92. response = callback(request, *callback_args,
**callback_kwargs)
File "C:\Python26\lib\site-packages\django\contrib\auth\decorators.py"
in __call__
  78. return self.view_func(request, *args, **kwargs)
File "E:\Programming\mysite\svs\views.py" in _function
  25. return function(request,*args, **kwargs)
File "E:\Programming\mysite\svs\views.py" in ratings_list
  36. if filter_form.is_valid():
File "C:\Python26\lib\site-packages\django\forms\forms.py" in is_valid
  120. return self.is_bound and not bool(self.errors)
File "C:\Python26\lib\site-packages\django\forms\forms.py" in
_get_errors
  111. self.full_clean()
File "C:\Python26\lib\site-packages\django\forms\forms.py" in
full_clean
  240. value = field.clean(value)
File "C:\Python26\lib\site-packages\django\forms\models.py" in clean
  993. value = self.queryset.get(**{key: value})
File "C:\Python26\lib\site-packages\django\db\models\query.py" in get
  299. clone = self.filter(*args, **kwargs)
File "C:\Python26\lib\site-packages\django\db\models\query.py" in
filter
  498. return self._filter_or_exclude(False, *args, **kwargs)
File "C:\Python26\lib\site-packages\django\db\models\query.py" in
_filter_or_exclude
  516. clone.query.add_q(Q(*args, **kwargs))
File "C:\Python26\lib\site-packages\django\db\models\sql\query.py" in
add_q
  1675. can_reuse=used_aliases)
File "C:\Python26\lib\site-packages\django\db\models\sql\query.py" in
add_filter
  1614. connector)
File "C:\Python26\lib\site-packages\django\db\models\sql\where.py" in
add
  56. obj, params = obj.process(lookup_type, value)
File "C:\Python26\lib\site-packages\django\db\models\sql\where.py" in
process
  269. params =
self.field.get_db_prep_lookup(lookup_type, value)
File "C:\Python26\lib\site-packages\django\db\models\fields
\__init__.py" in get_db_prep_lookup
  210. return [self.get_db_prep_value(value)]
File "C:\Python26\lib\site-packages\django\db\models\fields
\__init__.py" in get_db_prep_value
  361. return int(value)

Exception Type: ValueError at /svs/
Exception Value: invalid literal for int() with base 10: 'ww'


I'm using Django 1.1 if that makes any difference

Regards

ALJ



On Mar 30, 2:10 am, Karen Tracey  wrote:
> On Tue, Mar 29, 2011 at 4:40 PM, ALJ  wrote:
> > I have a form within a view which allows users to filter results
> > within a database. The request is a GET because I want the users to be
> > able to bookmark the results.
>
> > My querystring looks something like:
>
> >http://127.0.0.1:8001/myapp/?organisation_name=&corporation=4&authori...
>
> > My view checks the form as it comes in (form.is_valid()) and bounces
> > them back if they have been messing about with the querystring. The
> > validation picks up errors if I do something like
> > "..&corporation=99&...", but if I do something like
> > "...&corporation=&" it brings up a traceback
>
> > Exception Value:
> > invalid literal for int() with base 10: ''
>
> > I would have expected that the validation process would have picked up
> > that it isn't valid and just returned field error.
>
> It does, in general. This form/view:
>
> class TestForm(forms.Form):
>     num = forms.IntegerField()
>
> def testme(request):
>     if request.GET:
>         tf = TestForm(request.GET)
>         if tf.is_valid():
>             return http.HttpResponse("Worked!")
>     else:
>         tf = TestForm()
>     return render_to_response('form.html', {'form': tf})
>
> rendered with a method="get" form, causes re-display of the form with an
> error message "Enter a whole number." associated with the num field if the
> value www is entered in the

authentication switching mid-session

2011-03-30 Thread Chris Curvey
When my Django system is under heavy load (system CPU > 90%), I start
getting complaints from users that their authentication changes in the
middle of a session.  For example:

1) Bob logs in to the site.  The site says "Hello Bob" at the top of
each page.
2) Bob uses the site for a while without incident
3) Bob notices that the top of the page now says "Hello Steve".

The problem is intermittent, and I can't duplicate it (but I have seen
it with my own eyes).  I'm running Django 1.2.5 on Windows, with
SessionMiddleware installed.  I have django.contrib.sessions in my
INSTALLED_APPS, and I believe that I'm using database-backed sessions,
with a MySQL database.

The only "odd" thing that I'm doing is that I have four instances of
Apache running, with my Django app running via mod_wsgi in each of
them.  There is another apache server in front that does load-
balancing, so multiple requests from a single user may get routed to
different apache instances (which is what I want, to get maximum
throughput on Ajax calls).  But I thought that having the sessions be
database-backed would deal with this (multiple session requests can
hit the database at the same time).

Any thoughts?  I'm sorry this is such a lousy, unrepeatable case.

P.S.  I have looked at http://code.djangoproject.com/ticket/1180,
which says that this issue has been fixed, but I can't tell if this is
the same issue or not.

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



fixtures with updated timestamps

2011-03-30 Thread Robert Šmol
Hi,

is it possible to load fixtures of models that have a datetime field and
then updated those?

I mean we have a nice preset database, but it gets old over time, I need to
refresh the time attributes during tests and new development deployments.

Robert

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



Re: fixtures with updated timestamps

2011-03-30 Thread Marcos Moyano
You can write a pre_save signal
http://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.signals.pre_save

Hope it helps,
Marcos

On Wed, Mar 30, 2011 at 8:09 AM, Robert Šmol  wrote:

> Hi,
>
> is it possible to load fixtures of models that have a datetime field and
> then updated those?
>
> I mean we have a nice preset database, but it gets old over time, I need to
> refresh the time attributes during tests and new development deployments.
>
> Robert
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Some people, when confronted with a problem, think “I know, I'll use regular
expressions.” Now they have two problems.

Jamie Zawinski, in comp.emacs.xemacs

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



Re: develop to product

2011-03-30 Thread yongzhen zhang
And the nginx error log is:

2011/03/30 05:50:35 [error] 1090#0: *40 open() "/var/www/nginx-default/
favicon.ico" failed (2: No such file or directory), client:
184.73.245.208, server: localhost, request: "GET /favicon.ico HTTP/
1.0", host: "www.imaboy.cn", referrer: "http://www.google.com/search?
hl=en&source=hp&btnG=Google+Search&q=xanax+2mg+bars"
2011/03/30 07:14:38 [error] 1090#0: *43 open() "/var/www/nginx-default/
robots.txt" failed (2: No such file or directory), client:
66.249.66.2, server: localhost, request: "GET /robots.txt HTTP/1.1",
host: "imaboy.cn"

The fact is that i have file under "/var/www/favicon.ico", but now it
seems that it try to open it from  "/var/www/nginx-default/
favicon.ico".

On 3月30日, 下午1时09分, Sam Walters  wrote:
> Hi Yongzhen,
>
> Looks like you're trying to run two mis-configured web servers.
>
> if you're on linux stop the nginx process eg: /etc/init.d/nginx stop
> The stuff you've submitted is for apache: Send us the contents of the
> apache log file showing the error.
>
> Perhaps *if the error is long* usehttp://pastebin.com/instead of
> putting the error code into the email.
>
> cheers
>
> sam_w
>
>
>
> On Wed, Mar 30, 2011 at 8:40 AM, creecode  wrote:
> > Hello Yongzhen,
>
> > The first thing you might want to find out is why, apparently, nginx
> > is giving you an error when you say that you are using apache/wsgi.
>
> > If I had to guess I'd say you might have an nginx server acting as a
> > proxy in your stack somewhere.  I'm not an expert though as I've just
> > been getting to grips with basic proxying myself.
>
> > Check for an nginx error log somewhere... see what that says, if
> > there...
>
> > On Mar 29, 2:07 pm, yongzhen zhang <4...@live.cn> wrote:
>
> >> nginx/0.7.65
>
> > Toodle-l..
> > creecode
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

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



Django Web Application Cost So Many memory

2011-03-30 Thread bird sky
Hello Everybody:
 I encounter a problem that my Django project, it has more than 60
app modules, and some models are very large, more than 30 fields . And
when I startup my project, regardless of in development server, fast
cgi(flup),or mod_wsgi. i found it cost at least 60M memory per
instance. I guess this has some relation with that "django will load
all models on startup" . but how can I deal with my problem? Because
if an instance cost 60M memory, when I deploy my project in prefork
web server with 100 instance, i will cost 6GB memory. I don't think
this is a normal state.

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



Re: Django Web Application Cost So Many memory

2011-03-30 Thread moham...@efazati.org

do you have any cache ing?

On 03/30/2011 04:33 PM, bird sky wrote:

Hello Everybody:
  I encounter a problem that my Django project, it has more than 60
app modules, and some models are very large, more than 30 fields . And
when I startup my project, regardless of in development server, fast
cgi(flup),or mod_wsgi. i found it cost at least 60M memory per
instance. I guess this has some relation with that "django will load
all models on startup" . but how can I deal with my problem? Because
if an instance cost 60M memory, when I deploy my project in prefork
web server with 100 instance, i will cost 6GB memory. I don't think
this is a normal state.



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



Re: Django Web Application Cost So Many memory

2011-03-30 Thread 付毅
no. i don't use any cache, and I 've try to remove the app module which I
doubt cost memory. I found that the most memory eater is the app module who
has very large models.py

On Wed, Mar 30, 2011 at 8:32 PM, moham...@efazati.org
wrote:

>  do you have any cache ing?
>
> On 03/30/2011 04:33 PM, bird sky wrote:
>
> Hello Everybody:
>  I encounter a problem that my Django project, it has more than 60
> app modules, and some models are very large, more than 30 fields . And
> when I startup my project, regardless of in development server, fast
> cgi(flup),or mod_wsgi. i found it cost at least 60M memory per
> instance. I guess this has some relation with that "django will load
> all models on startup" . but how can I deal with my problem? Because
> if an instance cost 60M memory, when I deploy my project in prefork
> web server with 100 instance, i will cost 6GB memory. I don't think
> this is a normal state.
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Django Web Application Cost So Many memory

2011-03-30 Thread Xavier Ordoquy
Hi,

> Because
> if an instance cost 60M memory, when I deploy my project in prefork
> web server with 100 instance, i will cost 6GB memory. I don't think
> this is a normal state.

I hardly see the need for 100 instances.
Could you elaborate on that need ?
Imagine those 100 instances are processing at full speed. You'll need 100 CPUs, 
not counting databases.
I doubt 6Gb would be an issue if you already have 100 CPUs.

Regards,
Xavier.


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



Experienced -> Senior Python / Django Developer Required

2011-03-30 Thread Tom Inglis
Role:

We require an experienced Python / Django developer for our exciting
Edinburgh-based startup company. The role involves the full lifecycle
agile development of sophisticated social website and mobile
applications, and will grow in time to include leadership of a team
of
developers.

Essential Skills:

Python, Django
HTML 5, CSS 3
JavaScript, jQuery
PostgreSQL

Desirable Skills:

Ubuntu
Nginx, WSGI
Solr
Memcached
OpenStreetMap
Amazon Web Services
Ruby

Benefits:

The successful candidate will benefit from the autonomy to shape the
direction of the company's technology, whilst working on cutting edge
projects for major clients. They will be based at our stylish office
in central Edinburgh, and will command a competitive salary.

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



How to send emails?

2011-03-30 Thread LIU Liang
Hello,
I want to realize the verification of email when sign up. But I don't
know how to send a email.
for example with a account of gmail.
I have tried the method following, but there's errors.
Could anybody help?

I create a django project, and add email configuration in settings.py.
then
python manage.py shell
In [1]: from django.core.mail import send_mail
In [2]: send_mail('Subject', 'Body of the message.',
'from_usern...@gmail.com',['to_usern...@gmail.com'])

but...

>>> from django.core.mail import send_mail
>>> send_mail('Subject', 'Body of message.', 'mmhan...@gmail.com', ['mmhancxt@gm
ail.com'])
Traceback (most recent call last):
  File "", line 1, in 
  File "D:\Python27\lib\site-packages\django\core\mail.py", line 407,
in send_ma
il
connection=connection).send()
  File "D:\Python27\lib\site-packages\django\core\mail.py", line 281,
in send
return self.get_connection(fail_silently).send_messages([self])
  File "D:\Python27\lib\site-packages\django\core\mail.py", line 179,
in send_me
ssages
new_conn_created = self.open()
  File "D:\Python27\lib\site-packages\django\core\mail.py", line 144,
in open
local_hostname=DNS_NAME.get_fqdn())
  File "D:\Python27\lib\smtplib.py", line 239, in __init__
(code, msg) = self.connect(host, port)
  File "D:\Python27\lib\smtplib.py", line 295, in connect
self.sock = self._get_socket(host, port, self.timeout)
  File "D:\Python27\lib\smtplib.py", line 273, in _get_socket
return socket.create_connection((port, host), timeout)
  File "D:\Python27\lib\socket.py", line 567, in create_connection
raise error, msg
error: [Errno 10060]
>>>

Thank you!

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



Re: Experienced -> Senior Python / Django Developer Required

2011-03-30 Thread nadaeivar
Hi,
I'm in Senegal africa, cant i postule
Envoyé par mon BlackBerry® smartphone de Tigo

-Original Message-
From: Tom Inglis 
Sender: django-users@googlegroups.com
Date: Wed, 30 Mar 2011 05:34:35 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: Experienced -> Senior Python / Django Developer Required

Role:

We require an experienced Python / Django developer for our exciting
Edinburgh-based startup company. The role involves the full lifecycle
agile development of sophisticated social website and mobile
applications, and will grow in time to include leadership of a team
of
developers.

Essential Skills:

Python, Django
HTML 5, CSS 3
JavaScript, jQuery
PostgreSQL

Desirable Skills:

Ubuntu
Nginx, WSGI
Solr
Memcached
OpenStreetMap
Amazon Web Services
Ruby

Benefits:

The successful candidate will benefit from the autonomy to shape the
direction of the company's technology, whilst working on cutting edge
projects for major clients. They will be based at our stylish office
in central Edinburgh, and will command a competitive salary.

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

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



[ANN]: FeinCMS 1.3 release candidate

2011-03-30 Thread Matthias Kestenholz
Twelve days ago, the first preview for FeinCMS 1.3 has been released.
If we don't hit any bugs in the next few days, I'll probably release
1.3.0 final in about a week.


What is FeinCMS anyway?
===


FeinCMS is one of the most advanced Content Management Systems built on top
of Django. FeinCMS not only includes a page module with many bundled content
types (plugins), a media library and up-to-date documentation but also the
tools to build your own CMS if our view of how a page CMS is supposed to
act like does not fit your requirements.


PyPI: http://pypi.python.org/pypi/FeinCMS/
Github: https://github.com/matthiask/feincms/
Docs: http://www.feinheit.ch/media/labs/feincms/

Please report any issues you find in the issue tracker of github:
https://github.com/matthiask/feincms/issues


Changes since the last announcement mail (for 1.3.0.pre1):

* The tree editor now correctly uses django.contrib.admin's permission
  checking mechanisms.
* The ContentProxy implementation is even lazier now and does nearly
  nothing that isn't absolutely required up front.
* The media files have been moved from feincms/media to feincms/static
  for the convenience of everyone using django.contrib.staticfiles
* The 3rd party application embedding content type (ApplicationContent)
  supports TemplateResponse return values.
* The bundled jQuery has been updated to 1.5.1.
* A few bugfixes and documentation improvements.



This release would not have been possible without the contributions by the
community. Thanks for all the patches, bug reports and ideas which went into
this release.






FeinCMS 1.3 release notes (upcoming)



FeinCMS 1.3 includes many bugfixes and cleanups and a number of new features.
The cleanups and features caused a few backwards incompatible changes. The
upgrade path is outlined below.

Highlights
==

* FeinCMS pages use the standard Django permalink mechanism inside the
  ``get_absolute_url`` implementation. This means that you have to update the
  URL definition if you did not include ``feincms.urls`` directly.

  Change this::

  url(r'^$|^(.*)/$', 'feincms.views.base.handler'),

  to this::

  url(r'', include('feincms.urls')),

  Defining the URL patterns directly is still possible. Have a look at
  ``feincms.urls`` to find out how this should be done.

* FeinCMS requires at least Django 1.2 but already has support for Django 1.3
  features such as staticfiles. The FeinCMS media file folder has been moved
  from ``feincms/media/feincms`` to ``feincms/static/feincms`` - if you use
  ``django.contrib.staticfiles`` with Django 1.3 (and you should!), FeinCMS'
  media files for the administration interface will automatically be made
  available without any further work on your part.

* Content types can specify the media files (Javascript and CSS files) they
  need to work correctly. See :ref:`contenttypes-extramedia` for information
  on how to use this in your own content types.

* The content type loading process has been streamlined and requires much
  less database queries than before. The performance hit on sites with deep
  page hierarchies, inheritance and many regions is several times smaller
  than before.

* The content type interface has been extended with two new methods, available
  for all content types who need it: ``process`` is called before rendering
  pages and is guaranteed to receive the current request instance. Each and
  every content type (not only application contents as before) has the
  ability to return full HTTP responses which are returned directly to the
  user. ``finalize`` is called after rendering and can be used to set
  HTTP headers and do other post-processing tasks. See
  :ref:`contenttypes-processfinalize` for more information.


(Backwards incompatible and other) Changes
==

* The default ``ContentProxy`` has been rewritten to load all content type
  instances on initialization. The instances stay around for the full
  request-response cycle which allows us to remove many quasi-global variables
  (variables attached to the ``request`` object). The new initialization is
  much more efficient in terms of SQL queries needed; the implementation is
  contained inside the ``ContentProxy`` class and not distributed all over
  the place.

* The ``ContactFormContent`` has been updated to take advantage of the
  new content type interface where content types can influence the
  request-response cycle in more ways.

* The ``ct_tracker`` extension has been rewritten to take advantage of the
  new ``ContentProxy`` features. This means that the format of ``_ct_inventory``
  could not be kept backwards compatible. Because of this you have to empty
  the ``_ct_inventory`` fields yourself on upgrading::

  $ ./manage.py shell
  >>> from feincms.module.page.models import Page
  >>> Page.objects.all().update(_ct_inventory=No

Instructions for code changing to Django 1.3

2011-03-30 Thread Thiago Carvalho D' Ávila
I have a project running in Django 1.2.5 and I want to update it (the code)
to Django 1.3. I've seen the release notes, but there is no direct
instructions to *what I have to change in the code*.

It would be very useful to me, to all the community (I know that a lot of
people may be in the exact same situation), and to the new version adoption
if exists an official document like this.

This would be a great culture to adquire to make a better Django and a more
easy framework to the developers.

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



Re: How to send emails?

2011-03-30 Thread Ryan Osborn
Hi,

django-registration can take care of this for you: 
https://bitbucket.org/ubernostrum/django-registration/

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to send emails?

2011-03-30 Thread Micah Carrick
You can setup gmail in your settings.py

DEFAULT_FROM_EMAIL = 'your-email@your-domain'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'your-gmail-usern...@gmail.com'
EMAIL_HOST_PASSWORD = 'your-gmail-password'

And you can use the email_user() method of the models.User obejct:
http://docs.djangoproject.com/en/dev/topics/auth/

On Wed, Mar 30, 2011 at 5:53 AM, LIU Liang  wrote:

> Hello,
> I want to realize the verification of email when sign up. But I don't
> know how to send a email.
> for example with a account of gmail.
> I have tried the method following, but there's errors.
> Could anybody help?
>
> I create a django project, and add email configuration in settings.py.
> then
>python manage.py shell
> In [1]: from django.core.mail import send_mail
> In [2]: send_mail('Subject', 'Body of the message.',
> 'from_usern...@gmail.com',['to_usern...@gmail.com'])
>
> but...
>
> >>> from django.core.mail import send_mail
> >>> send_mail('Subject', 'Body of message.', 'mmhan...@gmail.com',
> ['mmhancxt@gm
> ail.com'])
> Traceback (most recent call last):
>  File "", line 1, in 
>  File "D:\Python27\lib\site-packages\django\core\mail.py", line 407,
> in send_ma
> il
>connection=connection).send()
>  File "D:\Python27\lib\site-packages\django\core\mail.py", line 281,
> in send
>return self.get_connection(fail_silently).send_messages([self])
>  File "D:\Python27\lib\site-packages\django\core\mail.py", line 179,
> in send_me
> ssages
>new_conn_created = self.open()
>  File "D:\Python27\lib\site-packages\django\core\mail.py", line 144,
> in open
>local_hostname=DNS_NAME.get_fqdn())
>  File "D:\Python27\lib\smtplib.py", line 239, in __init__
>(code, msg) = self.connect(host, port)
>  File "D:\Python27\lib\smtplib.py", line 295, in connect
>self.sock = self._get_socket(host, port, self.timeout)
>  File "D:\Python27\lib\smtplib.py", line 273, in _get_socket
>return socket.create_connection((port, host), timeout)
>  File "D:\Python27\lib\socket.py", line 567, in create_connection
>raise error, msg
> error: [Errno 10060]
> >>>
>
> Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
*Green Tackle* - *Environmentally Friendly Fishing Tackle*
www.GreenTackle.com 

 Email: mi...@greentackle.com
 Phone: 971.270.2206
 Toll Free: 877.580.9165
 Fax: 503.946.3106

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



Re: Django Web Application Cost So Many memory

2011-03-30 Thread 付毅
i don't think 100 instance means to 100 CPUs. I just want to use http_load
to test pressure to my web server. if i make the 100 cocurrent request per
second with 100 cocurrent connection. I will make 100 python process
instance when I deploy my web project in prefork environment. Any others
agree with me?

On Wed, Mar 30, 2011 at 9:07 PM, Xavier Ordoquy wrote:

> Hi,
>
> > Because
> > if an instance cost 60M memory, when I deploy my project in prefork
> > web server with 100 instance, i will cost 6GB memory. I don't think
> > this is a normal state.
>
> I hardly see the need for 100 instances.
> Could you elaborate on that need ?
> Imagine those 100 instances are processing at full speed. You'll need 100
> CPUs, not counting databases.
> I doubt 6Gb would be an issue if you already have 100 CPUs.
>
> Regards,
> Xavier.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Django Web Application Cost So Many memory

2011-03-30 Thread 付毅
I've found one of my app module has a large model. there are 207 models in
models.py.  When I add this app module into INSTALL_APPS, the process
instance memory increase nearly 10M more.

I think can I move these model classes out of my models.py file and move
them in to another .py file. And when I want to use it , just Dynamic Load
them as need?? Any suggestions?

On Wed, Mar 30, 2011 at 9:41 PM, 付毅  wrote:

> i don't think 100 instance means to 100 CPUs. I just want to use http_load
> to test pressure to my web server. if i make the 100 cocurrent request per
> second with 100 cocurrent connection. I will make 100 python process
> instance when I deploy my web project in prefork environment. Any others
> agree with me?
>
>
> On Wed, Mar 30, 2011 at 9:07 PM, Xavier Ordoquy wrote:
>
>> Hi,
>>
>> > Because
>> > if an instance cost 60M memory, when I deploy my project in prefork
>> > web server with 100 instance, i will cost 6GB memory. I don't think
>> > this is a normal state.
>>
>> I hardly see the need for 100 instances.
>> Could you elaborate on that need ?
>> Imagine those 100 instances are processing at full speed. You'll need 100
>> CPUs, not counting databases.
>> I doubt 6Gb would be an issue if you already have 100 CPUs.
>>
>> Regards,
>> Xavier.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

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



Re: Django Web Application Cost So Many memory

2011-03-30 Thread James Bennett
On Wed, Mar 30, 2011 at 8:41 AM, 付毅  wrote:
> i don't think 100 instance means to 100 CPUs. I just want to use http_load
> to test pressure to my web server. if i make the 100 cocurrent request per
> second with 100 cocurrent connection. I will make 100 python process
> instance when I deploy my web project in prefork environment. Any others
> agree with me?

Well, I'm not sure I agree with how you're interpreting your stats; a
process can report that it's using 60MB, but that doesn't mean that
two such processes would consume a total of 120MB of memory.

I'd also be curious to know what sort of stuff you're doing that's
using (allegedly) so much memory per-process.


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

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



Re: Instructions for code changing to Django 1.3

2011-03-30 Thread James Bennett
2011/3/30 Thiago Carvalho D' Ávila :
> I have a project running in Django 1.2.5 and I want to update it (the code)
> to Django 1.3. I've seen the release notes, but there is no direct
> instructions to what I have to change in the code.

Every item in the release notes that mentions a required change also
(as far as I can tell) either includes a code sample or links to
further documentation that you can read to find out what you need to
do.

Could you provide a specific example of something you don't think has
sufficient explanation?


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

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



Re: Django Web Application Cost So Many memory

2011-03-30 Thread 付毅
hi Bennett:
i attache my ps output file, just see the RSS column, that is the real
memory usage for every instance


On Wed, Mar 30, 2011 at 9:51 PM, James Bennett wrote:

> On Wed, Mar 30, 2011 at 8:41 AM, 付毅  wrote:
> > i don't think 100 instance means to 100 CPUs. I just want to use
> http_load
> > to test pressure to my web server. if i make the 100 cocurrent request
> per
> > second with 100 cocurrent connection. I will make 100 python process
> > instance when I deploy my web project in prefork environment. Any others
> > agree with me?
>
> Well, I'm not sure I agree with how you're interpreting your stats; a
> process can report that it's using 60MB, but that doesn't mean that
> two such processes would consume a total of 120MB of memory.
>
> I'd also be curious to know what sort of stuff you're doing that's
> using (allegedly) so much memory per-process.
>
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of
> correct."
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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

USER   PID %CPU %MEM   VSZ   RSS  TT  STAT STARTED  TIME COMMAND
root 78171 11.4  0.8 128408 63480  ??  S 9:58下午   0:03.86 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78113  2.9  0.8 139344 70208  ??  S 9:35下午   0:20.62 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78094  0.6  0.8 139344 70464  ??  S 9:30下午   0:22.42 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78152  0.5  0.8 128408 63484  ??  S 9:50下午   0:07.20 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78112  0.4  0.8 139344 70200  ??  S 9:35下午   0:15.93 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78193  0.4  0.7 126360 60916  ??  S10:03下午   0:00.17 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78170  0.3  0.8 137296 68816  ??  S 9:58下午   0:03.78 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78124  0.2  0.8 139344 70256  ??  S 9:43下午   0:15.04 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78154  0.2  0.8 137296 68748  ??  S 9:54下午   0:05.87 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78148  0.1  0.8 139344 70188  ??  S 9:48下午   0:10.54 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78192  0.1  0.7 126360 61760  ??  S10:01下午   0:00.95 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78088  0.0  0.8 139344 70508  ??  S 9:28下午   0:25.50 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78089  0.0  0.8 139344 70184  ??  S 9:29下午   0:22.32 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78090  0.0  0.8 139344 70236  ??  S 9:29下午   0:19.92 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78091  0.0  0.8 139344 70528  ??  S 9:30下午   0:21.93 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78096  0.0  0.8 139344 70476  ??  S 9:30下午   0:18.26 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78097  0.0  0.8 139344 70260  ??  S 9:30下午   0:24.18 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78114  0.0  0.8 139344 70148  ??  S 9:35下午   0:15.27 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78115  0.0  0.8 139344 70212  ??  S 9:35下午   0:19.70 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78116  0.0  0.8 139344 70220  ??  S 9:36下午   0:13.64 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78118  0.0  0.8 139344 70216  ??  S 9:37下午   0:14.99 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78119  0.0  0.8 139344 70248  ??  S 9:39下午   0:15.21 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78123  0.0  0.8 139344 70180  ??  S 9:40下午   0:11.17 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78125  0.0  0.8 139344 70208  ??  S 9:43下午   0:09.74 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78142  0.0  0.8 139344 70176  ??  S 9:45下午   0:15.32 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78143  0.0  0.8 139344 70192  ??  S 9:46下午   0:11.42 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78153  0.0  0.8 139344 70148  ??  S 9:52下午   0:10.31 python 
/home/x/www/capitalog/manage.py runfcgi h
root 78169  0.0  0.8 139344 70088  ??  S 9:58下午   0:05.28 python 
/home/x/www/capitalog/manage.py runf

Re: Instructions for code changing to Django 1.3

2011-03-30 Thread Shawn Milochik
It just so happens that there's a two-hour Webinar by Jacob
Kaplan-Moss tomorrow on this very topic:

http://www.eventbrite.com/event/1008507473

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



need to change models

2011-03-30 Thread jay K.

Hello,

I've been struggling for quite a white with this

whenever i change my models.py file by adding a new text area
I get a 'error 500 internal server error'

besides i keep getting an error whenever i try to syncdb my database

can anyone please explain what i'm doing wrong?

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: need to change models

2011-03-30 Thread moham...@efazati.org

send your error also ;)

On 03/30/2011 06:40 PM, jay K. wrote:

Hello,

I've been struggling for quite a white with this

whenever i change my models.py file by adding a new text area
I get a 'error 500 internal server error'

besides i keep getting an error whenever i try to syncdb my database

can anyone please explain what i'm doing wrong?

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: need to change models

2011-03-30 Thread Shawn Milochik
Use South:
http://south.aeracode.org/

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



Re: authentication switching mid-session

2011-03-30 Thread Bill Freeman
Do you have any caching in front of things?

On Wed, Mar 30, 2011 at 7:07 AM, Chris Curvey  wrote:
> When my Django system is under heavy load (system CPU > 90%), I start
> getting complaints from users that their authentication changes in the
> middle of a session.  For example:
>
> 1) Bob logs in to the site.  The site says "Hello Bob" at the top of
> each page.
> 2) Bob uses the site for a while without incident
> 3) Bob notices that the top of the page now says "Hello Steve".
>
> The problem is intermittent, and I can't duplicate it (but I have seen
> it with my own eyes).  I'm running Django 1.2.5 on Windows, with
> SessionMiddleware installed.  I have django.contrib.sessions in my
> INSTALLED_APPS, and I believe that I'm using database-backed sessions,
> with a MySQL database.
>
> The only "odd" thing that I'm doing is that I have four instances of
> Apache running, with my Django app running via mod_wsgi in each of
> them.  There is another apache server in front that does load-
> balancing, so multiple requests from a single user may get routed to
> different apache instances (which is what I want, to get maximum
> throughput on Ajax calls).  But I thought that having the sessions be
> database-backed would deal with this (multiple session requests can
> hit the database at the same time).
>
> Any thoughts?  I'm sorry this is such a lousy, unrepeatable case.
>
> P.S.  I have looked at http://code.djangoproject.com/ticket/1180,
> which says that this issue has been fixed, but I can't tell if this is
> the same issue or not.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Trouble raising forms.ValidationError in save() override in admin.py

2011-03-30 Thread Sithembewena Lloyd Dube
Hi all,

In the admin.py code of my project, I have an override to a save() method
where I check a file upload's extension and, based on that,
should either save the instance object or update show an error message on
the admin form as follows:

def save_model(self, request, obj, form, change):
  try:
   file_name = request.FILES['audio_file'].name
   if file_name.split('.')[1] == 'mp3':
obj.save()
   else:
raise forms.ValidationError("The podcast file must be of
type .mp3")
  except:
   raise forms.ValidationError("A podcast file is required.")

The issue is that when a forms.ValidationError is raised as expected, I am
getting a stack trace instead of the error message being displayed on the
form.
I do have debug set to True in my settings as this is a development
environment, but how can I cause the errors to be displayed on the form
instead of a stack trace as follows?:

ValidationError at /admin/browse/podcast/add/

[u'A podcast file is required.']

 Request Method: POST  Request URL:
http://127.0.0.1:8000/admin/browse/podcast/add/  Django Version: 1.2.3
 Exception
Type: ValidationError  Exception Value:

[u'A podcast file is required.']

 Exception Location:
C:\Websites\TPFRepository\thepokerfarm\..\thepokerfarm\browse\admin.py
in save_model, line 212  Python Executable: C:\Python26\python.exe  Python
Version: 2.6.5
...etc

Thanks!
-- 
Regards,
Sithembewena Lloyd Dube

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



OPTIMISING OVERHEAD IN DJANGO WITH MYSQL DATABASE

2011-03-30 Thread Dipo Elegbede
Hi all,

I have a django application that uses mysql database.

Everything works just fine except that I noticed some queries do spend a lot
of time to load.

I have about 15,000 checklists the system would have to browse through to
render my dashboard, which indicates which checklists is totally complete or
partial and all.

I would love to know if there is a way to make these queries work faster.

I have tried caching but that would be useful for as long no new data is
hitting the database which is most unlikely, it also disable filters which
are key part of the application.

Is there a way to optimise mysql queries?

kindly help.

Documentations and explanations would be most appreciated.

Cheers.

-- 
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise Application
Development

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



Re: Trouble raising forms.ValidationError in save() override in admin.py

2011-03-30 Thread Shawn Milochik
No, the forms.ValidationError has to be raised in one of the clean()
methonds of your model. Otherwise it will result in a stack trace.

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



Re: OPTIMISING OVERHEAD IN DJANGO WITH MYSQL DATABASE

2011-03-30 Thread Shawn Milochik
All-caps hurts my eyes. Did not read.

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



Re: Limiting file upload type?

2011-03-30 Thread Sithembewena Lloyd Dube
Hi David. Thanks for the response. Took a detour and just returned to this
task.

I decided to do a quick check on file extension after all. This is in the
admin area and for now this will have to do:

def save_model(self, request, obj, form, change):
  try:
   file_name = request.FILES['audio_file'].name
   if file_name.split('.')[1] == 'mp3':
obj.save()
   else:
raise forms.ValidationError("The podcast file must be of
type .mp3")
  except:
   raise forms.ValidationError("A podcast file is required.")

Just out of curiosity, what does your custom FielField look like?

Many thanks!

On Fri, Mar 25, 2011 at 5:20 PM, David De La Harpe Golden <
david.delaharpe.gol...@ichec.ie> wrote:

> On 25/03/11 13:48, Sithembewena Lloyd Dube wrote:
> > Hi folks,
> >
> > I have a model with a FileField, and I need to chech that the file is
> .mp3
> > before it is uploaded. How would I go about this without the hack of
> getting
> > the file name and slicing it?
> >
>
> Uh. File names are just names.  There's no guarantee a file called
> blah.mp3 is an mp3.  I assume what you actually want is to try to make
> sure the client only uploads mp3 audio files.
>
> Browsers do typically try to respect the "accept" html attribute [1] in
> a file upload field in a form to limit the options in the file select
> dialog to files of the specified type (at least by default), so could
> say accept="audio/mpeg" (strictly that'll cover mp1 and mp2 too, but meh
> [2]) - but try adding it as an attr on the widget of the field of the
> django form.[3]
>
> However, remember, /you can't trust the client/.  So you're going to
> have to let some or all of the upload happen and check or recheck on the
> server, at least if you really care if it's really an mp3 file.
>
> We use a FileField subclass that just call python-magic [4] for a quick
> initial mimetype check (and pyclamd [5] to virus scan), though of course
> it's not infallible either, you may (will) need further file format
> specific validation if you care whether the file is valid and
> uncorrupted (and probably ultimately a human approval process in your
> case, automatically judging if a completely valid .mp3 is just 4 minutes
> of some guy screaming obscenities is difficult...)
>
> [1] http://www.w3.org/TR/html401/interact/forms.html#adef-accept
> [2] http://tools.ietf.org/html/rfc3003
> [3]
>
> http://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.Widget.attrs
> [4] http://packages.debian.org/sid/python-magic
> [5] http://xael.org/norman/python/pyclamd/
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

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



manage.py command not found

2011-03-30 Thread jay K.
Hello,

I am following the tutorial at
http://south.aeracode.org/docs/installation.html#installation-configure in
order
to install South.

I've installed it successfully and modified INSTALLED_APPS so
it includes 'south', in the settings.py

now I execute the command: ./manage.py shell inside my current project, but
get a "permission denied" message,
so I execute the same command, this time with sudo, so sudo ./manage.py ,
but it tells me that
./manage.py command not found

can anyone explain me what's wrong?

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: manage.py command not found

2011-03-30 Thread Shawn Milochik
Check the permissions on manage.py. I'm guessing it's not executable.

Either use chmod +x on manage.py or execute it with Python: python manage.py.

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



2 Python/Django Developers Needed ASAP

2011-03-30 Thread Ken Zinchiak

In need of 2 Python, Django developers, for Mobile Applications, ASAP

In the NYC area for the 3 largest media company in the country.

Permanent roles

 

Functions:

Develop back end services for Mobile Applications

Develop extensible online applications

Develop and maintain Automated Testing Frameworks

Working in our own Cloud Environment

 

Required Skills:

Python, prefer 2-4 years exp.

Django framework

Open Source Familiarity

OOP

Linux command line proficiency

 

Desired Skills:

Clustered Server Environment

Scalable Wed Architecture

Web Interface Design


Look forward to hearing from you soon.

Thanks,

 

Ken Zinchiak

Moore Associates

973-560-4830

973-296-5787  Cell

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



Re: manage.py command not found

2011-03-30 Thread Juan Gabriel Aldana Jaramillo
Hi,

Try it: python manage.py

On Wed, Mar 30, 2011 at 9:52 AM, Shawn Milochik  wrote:

> Check the permissions on manage.py. I'm guessing it's not executable.
>
> Either use chmod +x on manage.py or execute it with Python: python
> manage.py.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: manage.py command not found

2011-03-30 Thread jay K.
Hello, Shawn

I type python manage.py shell in my project directory and get the following
error

Error: No module named xx

regards

On Wed, Mar 30, 2011 at 11:52 AM, Shawn Milochik  wrote:

> Check the permissions on manage.py. I'm guessing it's not executable.
>
> Either use chmod +x on manage.py or execute it with Python: python
> manage.py.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Django Web Application Cost So Many memory

2011-03-30 Thread Xavier Ordoquy

Le 30 mars 2011 à 15:41, 付毅 a écrit :

> i don't think 100 instance means to 100 CPUs. I just want to use http_load to 
> test pressure to my web server. if i make the 100 cocurrent request per 
> second with 100 cocurrent connection. I will make 100 python process instance 
> when I deploy my web project in prefork environment. Any others agree with me?

If you have 100 instances, 9 of 10 which are waiting in python code, you've got 
a huge architecture issue.
Let a front server (nginx, apache, and co) deal with administrative tasks and 
let django deal with computing the pages.
There are tons of blog posts out there that explains how to do it.

Regards,
Xavier.

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



Re: OPTIMISING OVERHEAD IN DJANGO WITH MYSQL DATABASE

2011-03-30 Thread Brian Neal
On Mar 30, 9:36 am, Dipo Elegbede  wrote:
> Hi all,
>
> I have a django application that uses mysql database.
>
> Everything works just fine except that I noticed some queries do spend a lot
> of time to load.
>
> I have about 15,000 checklists the system would have to browse through to
> render my dashboard, which indicates which checklists is totally complete or
> partial and all.
>
> I would love to know if there is a way to make these queries work faster.
>
> I have tried caching but that would be useful for as long no new data is
> hitting the database which is most unlikely, it also disable filters which
> are key part of the application.
>
> Is there a way to optimise mysql queries?
>
> kindly help.
>
> Documentations and explanations would be most appreciated.
>

Have you looked at the queries to see what they are? Do they make
sense? Are you using the django debug toolbar? Can you use
select_related()? Have you run "explain" on the queries? Have you seen
this:

http://docs.djangoproject.com/en/1.3/topics/db/optimization/

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



Re: manage.py command not found

2011-03-30 Thread jay K.
hi, Shawn

I finally managed to get python manage.py shell to work, by commenting
out those INSTALLED_APPS that had an issue with 'import x'

it turns out that 'import x' was the problem.

do you have any suggestions to fix 'import x'?

thanks


On Wed, Mar 30, 2011 at 12:25 PM, jay K. wrote:

> Hello, Shawn
>
> I type python manage.py shell in my project directory and get the following
> error
>
> Error: No module named xx
>
> regards
>
>
> On Wed, Mar 30, 2011 at 11:52 AM, Shawn Milochik wrote:
>
>> Check the permissions on manage.py. I'm guessing it's not executable.
>>
>> Either use chmod +x on manage.py or execute it with Python: python
>> manage.py.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

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



Re: Django Web Application Cost So Many memory

2011-03-30 Thread 付毅
hi Xavier Ordoquy
So , you mean 60M per python process is in a normal status? I really
encouter this kind of website before

On Wed, Mar 30, 2011 at 11:35 PM, Xavier Ordoquy wrote:

>
> Le 30 mars 2011 à 15:41, 付毅 a écrit :
>
> > i don't think 100 instance means to 100 CPUs. I just want to use
> http_load to test pressure to my web server. if i make the 100 cocurrent
> request per second with 100 cocurrent connection. I will make 100 python
> process instance when I deploy my web project in prefork environment. Any
> others agree with me?
>
> If you have 100 instances, 9 of 10 which are waiting in python code, you've
> got a huge architecture issue.
> Let a front server (nginx, apache, and co) deal with administrative tasks
> and let django deal with computing the pages.
> There are tons of blog posts out there that explains how to do it.
>
> Regards,
> Xavier.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: manage.py command not found

2011-03-30 Thread Shawn Milochik
On Wed, Mar 30, 2011 at 11:57 AM, jay K.  wrote:
>
> hi, Shawn
>
> I finally managed to get python manage.py shell to work, by commenting
> out those INSTALLED_APPS that had an issue with 'import x'
>
> it turns out that 'import x' was the problem.
>
> do you have any suggestions to fix 'import x'?


Depends on what x is.

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



noobie cannot get mod_wsgi to import settings

2011-03-30 Thread Sells, Fred
I've been googling and trying this for 2 days now, I'm sure I'm just
confused about something basic because it cannot be that hard.  I've
tried all the hints I found via google and they made sense but no
success.

I'm running RHEL 6 Python 2.6.5, django 1.2.4 and mod_wsgi 3.2.  I'm
trying to configure the server so I can deploy independent django sites
via wsgi.  So my directory structure looks like this:
/var/www/wsgi-scripts
-> myapp.wsgi
-> test2.wsgi
...  such that I can drop in any wsgi file to deploy a new app.

I plan to deploy my django sites (totally independent of one another,
but all related to our intranet) as follows
/home/djangodeploy
-> __init__.py
-> mysite1
-> mysite2

I got a basic myapp.wsgi working OK and it prints out sys.path as
follows:
/home/djangodeploy
/usr/lib/python26.zip
/usr/lib/python2.6
/usr/lib/python2.6/plat-linux2
...snip...
/usr/lib/python2.6/site-packages/webkit-1.0

I've made sure apache is the user for all files and even changed
permissions to 777.  I've remembered to restart apache each time.   I
tried to import settings.py from the command line to make sure there
were no syntax errors and it works.  This site worked under the debug
server also.

My wsgi.conf file looks like this:

LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /wsgi /var/www/wsgi-scripts
WSGIPythonPath /home/djangodeploy
LogLevel info
WSGISocketPrefix /var/run/wsgi


Order allow,deny
Allow from all


  ### I'm not sure about this last
Directory, grasping at straws.
Order allow,deny
Allow from all



My wsgi module to launch django looks like this

import os,  sys
print >>sys.stderr, __file__, sys.path
#import homeworks  # this did not work


os.environ['DJANGO_SETTINGS_MODULE'] = 'homeworks.settings' #this did
not work
#never gets here
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
__

And the output of the apache error log looks like this (timestamp and ip
deleted for brevity):
ImportError: Could not import settings 'homeworks.settings' (Is it on
sys.path? Does it have syntax errors?): No module named
homeworks.settings

/var/www/wsgi-scripts/test2.wsgi ['/home/djangodeploy',
'/usr/lib/python26.zip', '/usr/lib/python2.6',
'/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk',
'/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload',
'/usr/lib/python2.6/site-packages',
'/usr/lib/python2.6/site-packages/gst-0.10',
'/usr/lib/python2.6/site-packages/gtk-2.0',
'/usr/lib/python2.6/site-packages/webkit-1.0']

mod_wsgi (pid=2399): Exception occurred processing WSGI script
'/var/www/wsgi-scripts/test2.wsgi'.
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py",
line 230, in __call__
 self.load_middleware()
   File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py",
line 33, in load_middleware
 for middleware_path in settings.MIDDLEWARE_CLASSES:
   File "/usr/lib/python2.6/site-packages/django/utils/functional.py",
line 276, in __getattr__
 self._setup()
   File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line
40, in _setup
 self._wrapped = Settings(settings_module)
   File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line
75, in __init__
 raise ImportError("Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e))
[Wed Mar 30 11:46:53 2011] [error] [client 192.168.218.34] ImportError:
Could not import settings 'homeworks.settings' (Is it on sys.path? Does
it have syntax errors?): No module named homeworks.settings


Would someone be kind enough to show me my mistake.  I've tried all I
can think of.

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



check for existence in bulk

2011-03-30 Thread dmitry b
Hi,

is there a way to check in bulk for record existence and get back a
map of results similar to what's returned by in_bulk().  In my case, I
need to look up records by a unique field which is not the primary key
and I don't want object instances back, just true or false.


Thanks
Dmitry

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



Re: check for existence in bulk

2011-03-30 Thread Calvin Spealman
I think your best bet is

MyModel.objects.filter(some_field__in=ok_values).count() == len(ok_values)

On Wed, Mar 30, 2011 at 12:44 PM, dmitry b  wrote:
> Hi,
>
> is there a way to check in bulk for record existence and get back a
> map of results similar to what's returned by in_bulk().  In my case, I
> need to look up records by a unique field which is not the primary key
> and I don't want object instances back, just true or false.
>
>
> Thanks
> Dmitry
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://techblog.ironfroggy.com/
Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy

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



Re: manage.py command not found

2011-03-30 Thread Eddie Sullivan
If you're talking about the line that imports your app, that usually
means you have an error in your application code (the views or the
models). Try starting the shell and run "import x" manually and
see what errors you get.
-Eddie

On Mar 30, 11:57 am, "jay K."  wrote:
> hi, Shawn
>
> I finally managed to get python manage.py shell to work, by commenting
> out those INSTALLED_APPS that had an issue with 'import x'
>
> it turns out that 'import x' was the problem.
>
> do you have any suggestions to fix 'import x'?
>
> thanks
>
> On Wed, Mar 30, 2011 at 12:25 PM, jay K. wrote:
>
>
>
> > Hello, Shawn
>
> > I type python manage.py shell in my project directory and get the following
> > error
>
> > Error: No module named xx
>
> > regards
>
> > On Wed, Mar 30, 2011 at 11:52 AM, Shawn Milochik wrote:
>
> >> Check the permissions on manage.py. I'm guessing it's not executable.
>
> >> Either use chmod +x on manage.py or execute it with Python: python
> >> manage.py.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Django users" group.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.

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



Joins with multiple databases and temporary tables

2011-03-30 Thread Gary Gendel
I've got a strange situation and I was wondering how to handle it.

The database has stored procedures that crunch on tables and store the
results in temporary tables.  These resulting tables point to various
records in persistent tables.

The first question is how to control the connection in Django to leave
the connection open so I don't lose the temporary tables before I'm
finished working with them?

The second part is a bit trickier.  The temporary tables are stored in
a different database.  I don't want to get into why this was done, but
I need is to override the database name in the models for the
temporary tables.  I don't see a way to do this at the model level,
only at the connection level.  How do I specify that the model is a
table in a different database?  I want to end up with something like
this:

select ... from mytemp.temp1,normal.table1 where
mytemp.temp1.refId=normal.table1.id;

Thanks.
Gary

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



model manager and request

2011-03-30 Thread Tony
Is there a way to use the "request.user" attributes in a custom model
manager?  So I could filter by certain attributes the current logged
in user has?  This is the preferable way I would like to filter the
objects the user sees, so if there is a way, I would appreciate the
help.  If there is no way to do it like this, I would be open to other
suggestions although, the way my project is structured I dont want to
do this in my view functions.
thanks for any 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



inlineformset_factory default values

2011-03-30 Thread Nick
I am using inlineformsets_factory on a form and every time I save
those fields that are not made available in the form are overridden to
null values on save.

How do i get it just to update those fields that are specifically
listed in the form?

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



Re: model manager and request

2011-03-30 Thread Jacob Kaplan-Moss
On Wed, Mar 30, 2011 at 1:11 PM, Tony  wrote:
> Is there a way to use the "request.user" attributes in a custom model
> manager?  So I could filter by certain attributes the current logged
> in user has?  This is the preferable way I would like to filter the
> objects the user sees, so if there is a way, I would appreciate the
> help.  If there is no way to do it like this, I would be open to other
> suggestions although, the way my project is structured I dont want to
> do this in my view functions.

First, you need to understand that doing it in the view function is
the right place to do it. There it's easy; you'd just do something
like::

def my_view(request):
objects = MyModel.objects.viewable_by(request.user)

Your question is a bit like asking, "Is there a good way to get more
ventilation in this room? I know I could just open a window, but the
way the room is structured I'd rather cut holes in the wall or
something." That is, avoiding doing view-like things in views is
deliberately doing things the hard way.

So please, think about doing this right. The guy who has to maintain
your code will thank you.

That said, if you *must* go about this the wrong way, the typical
approach is to combine a piece of middleware (hack alert #1) with
threadlocals (hack alert #2). The middleware would look something
like::

# myapp/middleware.py

import threading

evil_threadlocals = threading.local()

def get_request():
return evil_threadlocals.request

class EvilMiddleware(object):
def process_request(self, request):
evil_threadlocals.request = request

You'd then add ``myapp.EvilMiddleware`` to ``MIDDLEWARE_CLASSES``, and
then deep in your manager you'd do::


class MyManager(models.Manager):
def evil_hacky_method(self):
from myapp.middleware import get_request
return self.filter(user=get_request())

Hopefully I've made it clear that doing this is a bad idea, so
*please* think about a light refactor before you head down this path.

Jacob

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



Re: check for existence in bulk

2011-03-30 Thread Jason Culverhouse

On Mar 30, 2011, at 9:47 AM, Calvin Spealman wrote:

> I think your best bet is
> 
> MyModel.objects.filter(some_field__in=ok_values).count() == len(ok_values)
> 
> On Wed, Mar 30, 2011 at 12:44 PM, dmitry b  wrote:
>> Hi,
>> 
>> is there a way to check in bulk for record existence and get back a
>> map of results similar to what's returned by in_bulk().  In my case, I
>> need to look up records by a unique field which is not the primary key
>> and I don't want object instances back, just true or false.

You could use values_list  and flat as in:

   User.objects.filter(username__in =['jason', 'was', 
'here']).values_list('username', flat=True)

returns a list:

   [u'jason', u'was']

After that you can figure out the best way to perform the lookup.

Jason


>> 
>> 
>> Thanks
>> Dmitry

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



Re: model manager and request

2011-03-30 Thread Shawn Milochik
Jacob,

This sort of thing comes up so frequently on this list that we've all
seen those answers dozens of times, although not usually in so concise
a manner.

My question, to which there seems to be no answer, is what a good
approach to do something that I know (from spending a long time on
this list) is also in high demand: Storing audit information.

Simple requirement:
Store datetime.now(), request.user, and changes to a model
automatically on post_save.

Problem:
The "correct" solutions do not work. If you're using any pluggable
apps at all you have to fork them or not log them. Refactoring is not
an option.

I understand why request information is simply not in scope in
models.py. This isn't a rant or a demand for a fundamental change to
the way Django works. I'm just looking for either:

1. A definitive "This is currently impossible in Django."

2. This is possible with this clever hack/middleware/pseudocode/whatever.

Obviously this method (should it exist) allows a lot of bad designs in
Django apps. But for the case of applying automatic logging in a
Django project, it seems like a reasonable desire. Especially given
that, as Django is a Web framework, there is always a request and
always a user (even if it's an anonymous user).

Your thoughts would be greatly appreciated. I'll also be attending
your webinar tomorrow. If you find this question to be in scope or
have extra time then I'd love to see it addressed.

Thank you,
Shawn

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



Re: inlineformset_factory default values

2011-03-30 Thread Nick
The problem I'm having is this. Those fields that I do not include in
my form attempt to update the DB, when the post data is missing those
values it blanks out those fields in the DB.

I have gotten around this by explicitly stating the fields I would
like to update but if I try to include data that cannot be updated via
the form (i.e. {{form.field.value}}) Then it will blank out the value
of that field. I don't, however, know how to access these values for
use in the template any other way.  Here is my view code:


CampaignFormSet = inlineformset_factory(Race, Campaign,
can_delete=False, extra=0, max_num=0, fiel
ds=('gen_vote','name','status','party'))

r = get_object_or_404(Race, id=race_id)

if request.method == 'POST':
race_form = RaceForm(request.POST, instance=r)
if race_form.is_valid():
race_form.save(commit=False)
formset = CampaignFormSet(request.POST, instance=r)

if formset.is_valid():
race_form.save()
instances = formset.save(commit=False)
for instance in instances:

instance.save()

return HttpResponseRedirect('')

else:

formset = CampaignFormSet(instance=r)

here is the template


{% for form in formset %}
{{form.name.value}}
{{form.party}}
{{form.vote}}

On Mar 30, 1:14 pm, Nick  wrote:
> I am using inlineformsets_factory on a form and every time I save
> those fields that are not made available in the form are overridden to
> null values on save.
>
> How do i get it just to update those fields that are specifically
> listed in the form?

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



new subpage in django

2011-03-30 Thread jay K.
Hello,

How do you create a new subpage in django?

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Web Application Cost So Many memory

2011-03-30 Thread Xavier Ordoquy
Hi,

Sounds correct to me.

Regards,
Xavier.

Le 30 mars 2011 à 17:48, 付毅 a écrit :

> hi Xavier Ordoquy
> So , you mean 60M per python process is in a normal status? I really encouter 
> this kind of website before
> 
> On Wed, Mar 30, 2011 at 11:35 PM, Xavier Ordoquy  wrote:
> 
> Le 30 mars 2011 à 15:41, 付毅 a écrit :
> 
> > i don't think 100 instance means to 100 CPUs. I just want to use http_load 
> > to test pressure to my web server. if i make the 100 cocurrent request per 
> > second with 100 cocurrent connection. I will make 100 python process 
> > instance when I deploy my web project in prefork environment. Any others 
> > agree with me?
> 
> If you have 100 instances, 9 of 10 which are waiting in python code, you've 
> got a huge architecture issue.
> Let a front server (nginx, apache, and co) deal with administrative tasks and 
> let django deal with computing the pages.
> There are tons of blog posts out there that explains how to do it.
> 
> Regards,
> Xavier.
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

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



Re: new subpage in django

2011-03-30 Thread Xavier Ordoquy

Le 30 mars 2011 à 21:16, jay K. a écrit :

> Hello,
> 
> How do you create a new subpage in django?
> 
> thanks

Hi,

What do you mean or I'd rather ask, what are you trying to do ?

Regards,
Xavier.

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



Django IDE : how to start the devserver in an editor?

2011-03-30 Thread MrMuffin
I`m trying to develop a simple plugin[0] for the Editra[1] editor for
django development. Right now it can create django projects and apps
from within the editor. The editor is based on wxPython and I want to
start the devserver from within the editor, show a simple form with
the option to stop or kill/restart the server.

The goal is to minimize the need to do repetetive tasks in the console/
shell. My reason for doing this is that I`m working in a Microsoft
only company where you seldom do stuff using the command line. Selling
django is hard when I`m in and out of the shell/command line to start/
restart the server, syncdb, migrate etc. To make the job of selling
django to my co-workers and hopefully make development easier ( at
least for the django developers who likes to work in an IDE ) I`ve
started the work on a plugin for Editra. Right now the plugin adds a
menu item called Django with two subitems; create project and create
app. A context menu is in the works which will give different options
depending on the content of the file being edited; right click in a
window holding settings.py will give you the option to start the
server, call syncdb, migrate etc. A right click in views.py will give
you options to help you generate views, in models.py scaffolding,
generation of admin.py etc.

The only thing I cannot get my head around is how to start/kill/
restart the devserver from inside the app. If anybody has any
information about this I`d be very grateful. When the plugin is more
stable and has a few more features I`ll post something, perhaps do a
screencast as well. Any help, input, comments or ideas are
appreciated.

NB! I know the main problem here is not django specific, more
wxpython, but I post the message here because I hope this project
might be of interest to other django developers as well.

Regards,
Thomas Weholt


[0] https://bitbucket.org/weholt/editra.djangomanagement
[1] http://editra.org/

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



RE: Django IDE : how to start the devserver in an editor?

2011-03-30 Thread Sells, Fred
Using eclipse you can create a run configuration that starts the
dbserver and it will auto-reload whenever you change a file.  Of course
since the dbserver auto restarts when it detects a file change, the
command line is not all that bad.

-Original Message-
From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of MrMuffin
Sent: Wednesday, March 30, 2011 3:21 PM
To: Django users
Subject: Django IDE : how to start the devserver in an editor?

I`m trying to develop a simple plugin[0] for the Editra[1] editor for
django development. Right now it can create django projects and apps
from within the editor. The editor is based on wxPython and I want to
start the devserver from within the editor, show a simple form with
the option to stop or kill/restart the server.

The goal is to minimize the need to do repetetive tasks in the console/
shell. My reason for doing this is that I`m working in a Microsoft
only company where you seldom do stuff using the command line. Selling
django is hard when I`m in and out of the shell/command line to start/
restart the server, syncdb, migrate etc. To make the job of selling
django to my co-workers and hopefully make development easier ( at
least for the django developers who likes to work in an IDE ) I`ve
started the work on a plugin for Editra. Right now the plugin adds a
menu item called Django with two subitems; create project and create
app. A context menu is in the works which will give different options
depending on the content of the file being edited; right click in a
window holding settings.py will give you the option to start the
server, call syncdb, migrate etc. A right click in views.py will give
you options to help you generate views, in models.py scaffolding,
generation of admin.py etc.

The only thing I cannot get my head around is how to start/kill/
restart the devserver from inside the app. If anybody has any
information about this I`d be very grateful. When the plugin is more
stable and has a few more features I`ll post something, perhaps do a
screencast as well. Any help, input, comments or ideas are
appreciated.

NB! I know the main problem here is not django specific, more
wxpython, but I post the message here because I hope this project
might be of interest to other django developers as well.

Regards,
Thomas Weholt


[0] https://bitbucket.org/weholt/editra.djangomanagement
[1] http://editra.org/

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


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



django custom template tags: how to send to (parser, token)

2011-03-30 Thread justin jools
I've just started using custom tags and need some help parsing info
to:

@register.tag
def friends_of(parser, token):
tag_name, user_var = token.split_contents()
return FriendsOfNode(user_var)

class FriendsOfNode(template.Node):
def __init__(self, user_var):
self.user_var = template.Variable(user_var)

def render(self, context):
user = self.user_var.resolve(context)
context.update({'friends': Friendship.objects.friends_of(user,
True)})
return u''

I tried:

friends: {% friends_of {{ user }} %}

output:

ValueError at /friends/

too many values to unpack

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



Re: new subpage in django

2011-03-30 Thread jay K.
hello,

what i'm trying to do is to create a subpage for a website written in django

e.g.

for http://www.xzy.com/subpage I'd like to add 'subpage2', so it would look
like

http://www.xzy.com/subpage/subpage2

how do i do that?

thanks

On Wed, Mar 30, 2011 at 4:20 PM, Xavier Ordoquy wrote:

>
> Le 30 mars 2011 à 21:16, jay K. a écrit :
>
> > Hello,
> >
> > How do you create a new subpage in django?
> >
> > thanks
>
> Hi,
>
> What do you mean or I'd rather ask, what are you trying to do ?
>
> Regards,
> Xavier.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: new subpage in django

2011-03-30 Thread Sandro Dutra
Probably adding "http://www.xzy.com/subpage/subpage2"; to your URLConf.

2011/3/30 jay K. :
> hello,
>
> what i'm trying to do is to create a subpage for a website written in django
>
> e.g.
>
> for http://www.xzy.com/subpage I'd like to add 'subpage2', so it would look
> like
>
> http://www.xzy.com/subpage/subpage2
>
> how do i do that?
>
> thanks
>
> On Wed, Mar 30, 2011 at 4:20 PM, Xavier Ordoquy 
> wrote:
>>
>> Le 30 mars 2011 à 21:16, jay K. a écrit :
>>
>> > Hello,
>> >
>> > How do you create a new subpage in django?
>> >
>> > thanks
>>
>> Hi,
>>
>> What do you mean or I'd rather ask, what are you trying to do ?
>>
>> Regards,
>> Xavier.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: new subpage in django

2011-03-30 Thread Ovnicraft
On Wed, Mar 30, 2011 at 3:14 PM, jay K.  wrote:

> hello,
>
> what i'm trying to do is to create a subpage for a website written in
> django
>
> e.g.
>
> for http://www.xzy.com/subpage I'd like to add 'subpage2', so it would
> look like
>
> http://www.xzy.com/subpage/subpage2


Read: http://docs.djangoproject.com/en/1.3/topics/http/urls/

Regards,


>
>
> how do i do that?
>
> thanks
>
>
> On Wed, Mar 30, 2011 at 4:20 PM, Xavier Ordoquy wrote:
>
>>
>> Le 30 mars 2011 à 21:16, jay K. a écrit :
>>
>> > Hello,
>> >
>> > How do you create a new subpage in django?
>> >
>> > thanks
>>
>> Hi,
>>
>> What do you mean or I'd rather ask, what are you trying to do ?
>>
>> Regards,
>> Xavier.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Cristian Salamea
@ovnicraft

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



Re: model manager and request

2011-03-30 Thread Tony
yeah, shawn said the exact dilemma I am having.  I am working with a
plugged in app and dont want to change its code and mess with its
views and create a new fork, it just seems like small thing to make a
change for (and I would probably mess something else up).

On Mar 30, 11:58 am, Shawn Milochik  wrote:
> Jacob,
>
> This sort of thing comes up so frequently on this list that we've all
> seen those answers dozens of times, although not usually in so concise
> a manner.
>
> My question, to which there seems to be no answer, is what a good
> approach to do something that I know (from spending a long time on
> this list) is also in high demand: Storing audit information.
>
> Simple requirement:
>     Store datetime.now(), request.user, and changes to a model
> automatically on post_save.
>
> Problem:
>     The "correct" solutions do not work. If you're using any pluggable
> apps at all you have to fork them or not log them. Refactoring is not
> an option.
>
> I understand why request information is simply not in scope in
> models.py. This isn't a rant or a demand for a fundamental change to
> the way Django works. I'm just looking for either:
>
>     1. A definitive "This is currently impossible in Django."
>
>     2. This is possible with this clever hack/middleware/pseudocode/whatever.
>
> Obviously this method (should it exist) allows a lot of bad designs in
> Django apps. But for the case of applying automatic logging in a
> Django project, it seems like a reasonable desire. Especially given
> that, as Django is a Web framework, there is always a request and
> always a user (even if it's an anonymous user).
>
> Your thoughts would be greatly appreciated. I'll also be attending
> your webinar tomorrow. If you find this question to be in scope or
> have extra time then I'd love to see it addressed.
>
> Thank you,
> Shawn

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



Re: Django IDE : how to start the devserver in an editor?

2011-03-30 Thread roberto
MrMuffin,

You've also have the editra group where the author use to answering
quickly all of the questions posted there:
https://groups.google.com/group/editra?hl=en

I like your ideas and features to add into the plugin for django.

Good luck !

Roberto

On Mar 30, 4:21 pm, MrMuffin  wrote:
> I`m trying to develop a simple plugin[0] for the Editra[1] editor for
> django development. Right now it can create django projects and apps
> from within the editor. The editor is based on wxPython and I want to
> start the devserver from within the editor, show a simple form with
> the option to stop or kill/restart the server.
>
> The goal is to minimize the need to do repetetive tasks in the console/
> shell. My reason for doing this is that I`m working in a Microsoft
> only company where you seldom do stuff using the command line. Selling
> django is hard when I`m in and out of the shell/command line to start/
> restart the server, syncdb, migrate etc. To make the job of selling
> django to my co-workers and hopefully make development easier ( at
> least for the django developers who likes to work in an IDE ) I`ve
> started the work on a plugin for Editra. Right now the plugin adds a
> menu item called Django with two subitems; create project and create
> app. A context menu is in the works which will give different options
> depending on the content of the file being edited; right click in a
> window holding settings.py will give you the option to start the
> server, call syncdb, migrate etc. A right click in views.py will give
> you options to help you generate views, in models.py scaffolding,
> generation of admin.py etc.
>
> The only thing I cannot get my head around is how to start/kill/
> restart the devserver from inside the app. If anybody has any
> information about this I`d be very grateful. When the plugin is more
> stable and has a few more features I`ll post something, perhaps do a
> screencast as well. Any help, input, comments or ideas are
> appreciated.
>
> NB! I know the main problem here is not django specific, more
> wxpython, but I post the message here because I hope this project
> might be of interest to other django developers as well.
>
> Regards,
> Thomas Weholt
>
> [0]https://bitbucket.org/weholt/editra.djangomanagement
> [1]http://editra.org/

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



Re: Django Web Application Cost So Many memory

2011-03-30 Thread Adam Nelson
I think 60M is fine.  For us, with nginx in front of gunicorn, we can get 
many simultaneous connections per process.

-Adam

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



Documentation Checked But Unclear: How to supress form.errors from views when needed?

2011-03-30 Thread hank23
I have an edit screen with more than a dozen fields on it of various
types (text/CharField, select/CharField, date/DateField). When I
refresh the screen sometimes I want to suppress all of the field
required errors generated by empty fields prior to the refresh
actually taking place. So far I have not found anything that works. I
know in a view that I can check if there are errors for particular
fields(like this  if form.errors.has_key('title') :
titleerrors = len(form.errors['title'] titleerrors =
str(titleerrors))) and then display the counts on the screen, but I
have not figured out how to suppress them yet once I know they exist.
I do not believe that I can suppress them at the form level in
forms.py, in an overridden clean() method, without suppressing them
all of the time, which is not my intent. Thanks for the help.

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



Re: django custom template tags: how to send to (parser, token)

2011-03-30 Thread bruno desthuilliers


On 30 mar, 21:55, justin jools  wrote:
> I've just started using custom tags and need some help parsing info
> to:
>
> @register.tag
> def friends_of(parser, token):
>     tag_name, user_var = token.split_contents()

Don't assume you'll only have what you expected here. The canonical
form would be:

  args = token.split_contents()
  tag_name = args.pop(0)

  if len(args) > 1:
  raise TemplateSyntaxError("some useful message here")

>     return FriendsOfNode(user_var)
>
> class FriendsOfNode(template.Node):
>     def __init__(self, user_var):
>         self.user_var = template.Variable(user_var)
>
>     def render(self, context):
>         user = self.user_var.resolve(context)
>         context.update({'friends': Friendship.objects.friends_of(user,
> True)})
>         return u''
>
> I tried:
>
> friends: {% friends_of {{ user }} %}

This should be {% friends_of user %}. The {{ varname }} syntax is only
for value substitution in the template itself, not for templatetags.

Also and as a side note, when using a template tag to populate the
context, it's better to give a way to specify the var name under which
the value(s) will be available, ie:

{% friends_of user as whatever %}

(which will of course require a bit more parsing...)

>
> output:
>
> ValueError at /friends/
>
> too many values to unpack

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



Re: Documentation Checked But Unclear: How to supress form.errors from views when needed?

2011-03-30 Thread Shawn Milochik
What do you mean by "if I refresh a page"? If you refresh a page that
has a form on it but has not been submitted, I wouldn't expect the
behavior you describe.

If you submit a form improperly and it displays errors, then you hit
'refresh,' the view will still get the POST (or GET) and will do
whatever your view does.

It sounds like, and correct me if I'm wrong, you want the view to
somehow know whether the POST is actually a re-submission of the
previous submission. If so, you could probably find a way to do that,
but it seems to me that an invalid form is an invalid form, and the
errors are legit.

Shawn

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



How to store multiple instances of a single object in the database

2011-03-30 Thread rohan
Hi,

I am creating a chemistry database using django's admin interface in
Sqlite3.

The database has a simulations table which has a many to many
relationship with the compounds table.
Each simulation needs to start off with a fixed number of compounds
that it has and each simulation can have 1 or more compounds. suppose
a simulation has water molecule and hcl molecule, it must start off
with 25 water molecules and 10 hcl molecules. Is there anyway in
Django to define this within the database? Please let me know if the
question is not clear and I will post my models here.

Thank you

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



Persistent Connection

2011-03-30 Thread Daniel Corbe
Guys, can I have a persistent connection in models django

eg I have an infinite loop with a sleep (1) and then a model.save ()
but every save he opens and closes a new connection, creating an unnecessary
deman of connections and processing.
Anyone know how to circumvent it? for example using a connection every 5
minutes.
Or any better solution
hugs to all

-- 
Daniel Corbe Hahne Latorre
dan...@corbe.com.br
55 48 9618-5115
skype: daniel_corbe

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



How to filter the list_display in the django admin with the request.session[user_id]

2011-03-30 Thread Pablo Vidal
I need to know how to filter in the django admin model License, the
licenses of the user logged-in to the admin.

class License(models.Model):
user = models.ForeignKey('wiki.User')
name = models.CharField(max_length = 100)

def __unicode__(self):
return self.name

Example:

So if Bob has created in the License Model 3 licenses, but John has
created only two, then the model has 5 licenses total, but if Bob logs
in to the admin he should only see his licenses (3 Licenses).

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



Re: How to filter the list_display in the django admin with the request.session[user_id]

2011-03-30 Thread Jason Culverhouse

On Mar 30, 2011, at 2:31 PM, Pablo Vidal wrote:

> I need to know how to filter in the django admin model License, the
> licenses of the user logged-in to the admin.
> 
> class License(models.Model):
>user = models.ForeignKey('wiki.User')
>name = models.CharField(max_length = 100)
> 
>def __unicode__(self):
>return self.name
> 
> Example:
> 
> So if Bob has created in the License Model 3 licenses, but John has
> created only two, then the model has 5 licenses total, but if Bob logs
> in to the admin he should only see his licenses (3 Licenses).

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.queryset

class MyModelAdmin(admin.ModelAdmin):
def queryset(self, request):
qs = super(MyModelAdmin, self).queryset(request)
if request.user.is_superuser:
return qs
return qs.filter(author=request.user)

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

Jason

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



Re: Django Web Application Cost So Many memory

2011-03-30 Thread Diederik van der Boor
Op woensdag 30 maart 2011 17:48:38 schreef 付毅:
> hi Xavier Ordoquy
> So , you mean 60M per python process is in a normal status? I really
> encouter this kind of website before

Please note this is for the entire website, not per apache instance.
There is one Django process (via mod_wsgi, or standalone fastcgi) that
handles all requests coming from visitors.

I hope this was obvious, but I got the impression that bit got lost in the 
discussion,

Greetings,
Diederik

 
> On Wed, Mar 30, 2011 at 11:35 PM, Xavier Ordoquy 
wrote:
> > Le 30 mars 2011 à 15:41, 付毅 a écrit :
> > > i don't think 100 instance means to 100 CPUs. I just want to use
> > 
> > http_load to test pressure to my web server. if i make the 100 cocurrent
> > request per second with 100 cocurrent connection. I will make 100 python
> > process instance when I deploy my web project in prefork environment. Any
> > others agree with me?
> > 
> > If you have 100 instances, 9 of 10 which are waiting in python code,
> > you've got a huge architecture issue.
> > Let a front server (nginx, apache, and co) deal with administrative tasks
> > and let django deal with computing the pages.
> > There are tons of blog posts out there that explains how to do it.
> > 
> > Regards,
> > Xavier.
> > 
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.

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



Re: How to store multiple instances of a single object in the database

2011-03-30 Thread Ryan Osborn
Have you considered using the 'through' argument for the many to many 
field?  This lets you specify your own intermediate table to which you can 
add extra data.  So you could add in a quantity field so you would know how 
many of each molecule you need.

Here is the documentation: 
http://docs.djangoproject.com/en/1.3/topics/db/models/#intermediary-manytomany

Hope this helps,

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



multiline TextField

2011-03-30 Thread electrocoder
Hi. I write blog application. I want multiline TextField.
Sample : paragraph or tab or return
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Web Application Cost So Many memory

2011-03-30 Thread Graham Dumpleton
Why are you using prefork MPM and running Django embedded that way.

Prefork MPM may be fine for PHP, but it is a poor solution for fat Python 
web applications unless you are prepared to give it the necessary memory 
resources and configure Apache properly specifically for that single Python 
web applications requirements.

If you are going to use embedded mode of Apache, then you should at least 
use worker MPM and then you still need to be mindful of how Apache MPM 
settings are configured so as to try and keep processes persistent all the 
time and not let Apache kill off/restart processes when it feels it needs to 
as the startup load will only make performance worse when you need it, ie., 
when load spikes.

For a discussion on why embedded mode is not always the best, especially 
with prefork MPM, go read:

  http://blog.dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usage.html

If using Apache/mod_wsgi the preferred setup would be daemon mode where you 
can better control processes/threads independent of Apache MPM, meaning you 
can still use prefork MPM if you are stuck with support a PHP application on 
the same Apache.

Graham

On Wednesday, March 30, 2011 11:03:37 PM UTC+11, bird sky wrote:
>
> Hello Everybody: 
>  I encounter a problem that my Django project, it has more than 60 
> app modules, and some models are very large, more than 30 fields . And 
> when I startup my project, regardless of in development server, fast 
> cgi(flup),or mod_wsgi. i found it cost at least 60M memory per 
> instance. I guess this has some relation with that "django will load 
> all models on startup" . but how can I deal with my problem? Because 
> if an instance cost 60M memory, when I deploy my project in prefork 
> web server with 100 instance, i will cost 6GB memory. I don't think 
> this is a normal state.

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



Re: How to store multiple instances of a single object in the database

2011-03-30 Thread rohan
Hey Ryan,

That seems very helpful. I will try using this argument.
Thanks a lot.

Rohan
On Mar 30, 5:10 pm, Ryan Osborn  wrote:
> Have you considered using the 'through' argument for the many to many
> field?  This lets you specify your own intermediate table to which you can
> add extra data.  So you could add in a quantity field so you would know how
> many of each molecule you need.
>
> Here is the 
> documentation:http://docs.djangoproject.com/en/1.3/topics/db/models/#intermediary-m...
>
> Hope this helps,
>
> 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to store multiple instances of a single object in the database

2011-03-30 Thread rohan
The method works perfectly. Thanks once again.

On Mar 30, 5:36 pm, rohan  wrote:
> Hey Ryan,
>
> That seems very helpful. I will try using this argument.
> Thanks a lot.
>
> Rohan
> On Mar 30, 5:10 pm, Ryan Osborn  wrote:
>
>
>
>
>
>
>
> > Have you considered using the 'through' argument for the many to many
> > field?  This lets you specify your own intermediate table to which you can
> > add extra data.  So you could add in a quantity field so you would know how
> > many of each molecule you need.
>
> > Here is the 
> > documentation:http://docs.djangoproject.com/en/1.3/topics/db/models/#intermediary-m...
>
> > Hope this helps,
>
> > 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



staticfile app question

2011-03-30 Thread typeshige
Like many people, I'm switching over to use a static directory to
serve site media. Overall, it works extremely well, but I have a
question about one aspect of it.

I have a CSS file that includes urls. I was wondering about the
possibility of the staticfile app inserting the proper STATIC_URL as
it's being collected.

For example, things like:

#container-head {
background: transparent url('/static/img/bg/cap/head-inner-
bg.gif') 50% 0 no-repeat;
}

Would it be a bad idea to write like this:

#container-head {
background: transparent url('{{ STATIC_URL }}img/bg/cap/head-inner-
bg.gif') 50% 0 no-repeat;
}

the collectstatic command could insert the right url as it is being
copied?

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



Re: staticfile app question

2011-03-30 Thread Shawn Milochik
I have the exact same problem. I hope there is a solution, because
good site design often results in image references in the CSS.

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



[no subject]

2011-03-30 Thread bishwendu kundu
 for different databases the query could be formatted as
s=temp1.objects.using("mytemp").filter(refId=table1.objects.using("normal").get(pk=something).id)
I cannot understand the get argument but may be if you give it a try with a
suitable args."using" differentiates between databases.

For the first problem;
   may be if you get the cursor to the connection you want to keep open and
execute sql commands directly on it.This can be done as

from django.db import connections
cursor=connection["your_db_alias used in settings"].cursor()

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



Re: Joins with multiple databases and temporary tables

2011-03-30 Thread bish029
for different databases the query could be formatted as
s=temp1.objects.using("mytemp").filter(refId=table1.objects.using("normal").get(pk=something).id)
where temp1 is table in  database mytemp.table1 in databse normal
I cannot understand the get argument but may be if you give it a try
with a suitable args it may work."using" differentiates between
databases.

For the first problem;
   may be if you get the cursor to the connection you want to keep
open and execute sql commands directly on it.This can be done as

from django.db import connections
cursor=connection["your_database_alias used in settings"].cursor()


On Mar 30, 10:39 pm, Gary Gendel  wrote:
> I've got a strange situation and I was wondering how to handle it.
>
> The database has stored procedures that crunch on tables and store the
> results in temporary tables.  These resulting tables point to various
> records in persistent tables.
>
> The first question is how to control the connection in Django to leave
> the connection open so I don't lose the temporary tables before I'm
> finished working with them?
>
> The second part is a bit trickier.  The temporary tables are stored in
> a different database.  I don't want to get into why this was done, but
> I need is to override the database name in the models for the
> temporary tables.  I don't see a way to do this at the model level,
> only at the connection level.  How do I specify that the model is a
> table in a different database?  I want to end up with something like
> this:
>
> select ... from mytemp.temp1,normal.table1 where
> mytemp.temp1.refId=normal.table1.id;
>
> Thanks.
> Gary

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



Re: staticfile app question

2011-03-30 Thread Mike Ramirez
On Wednesday, March 30, 2011 04:20:32 pm Shawn Milochik wrote:
> I have the exact same problem. I hope there is a solution, because
> good site design often results in image references in the CSS.


The best one I've come up with and it's far from 'best' is to run a command 
that edits css templates and spits them out to the directory they should be 
served on at update time. AFAIK DJango can not process the .css files in the 
media/static directory on the fly.  

But you might be able to trick it, just thought about this as I was writing 
above.  Have a url  in urls.py of a regex that ends in '.css' and direct it to 
a view that serves your css.  

something like this:

url(r'^media/css/(?P[\w-]+)\.css$', 'views.css', name='serve-css'),

with my views.css just for processing css templates.

I don't know how hard it would be to implement or how well it would work, I 
haven't done it. It's a thought of this.

Mike


-- 
I appoint you ambassador to Fantasy Island!!!

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



RE: staticfile app question

2011-03-30 Thread Sells, Fred
This may be using a canon to swat a fly, but...

I had a project some time ago where I needed a very repetitive
java/swing UI.  I ended up creating python classes that had a __repr__
method that generated the java source code.  Then I was able to have
very concise python files that instantiated the classes I needed and
used that to generate java.

Perhaps a similar idea would work with .css possible even using the
django template system.

Now I use flex/flash a lot more than html/js/css so I could be out of
touch here



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



Re: staticfile app question

2011-03-30 Thread Jason Culverhouse

On Mar 30, 2011, at 4:50 PM, Mike Ramirez wrote:

> On Wednesday, March 30, 2011 04:20:32 pm Shawn Milochik wrote:
>> I have the exact same problem. I hope there is a solution, because
>> good site design often results in image references in the CSS.
> 
> 

I think you guys are over analyzing the problem

You can use relative urls in css

Just look at 
http://www.djangoproject.com/m/css/base.css

Assuming this layout under STATIC_URL
{{STATIC_URL}}
css/screen.css
images/header.gif

Just use a relative path in screen.css
#container-head {
   background: transparent url('../images/header.gif') 50% 0 no-repeat;
}

Jason


> The best one I've come up with and it's far from 'best' is to run a command 
> that edits css templates and spits them out to the directory they should be 
> served on at update time. AFAIK DJango can not process the .css files in the 
> media/static directory on the fly.  
> 
> But you might be able to trick it, just thought about this as I was writing 
> above.  Have a url  in urls.py of a regex that ends in '.css' and direct it 
> to 
> a view that serves your css.  
> 
> something like this:
> 
> url(r'^media/css/(?P[\w-]+)\.css$', 'views.css', name='serve-css'),
> 
> with my views.css just for processing css templates.
> 
> I don't know how hard it would be to implement or how well it would work, I 
> haven't done it. It's a thought of this.
> 
> Mike
> 
> 
> -- 
> I appoint you ambassador to Fantasy Island!!!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Re: staticfile app question

2011-03-30 Thread Mike Ramirez
On Wednesday, March 30, 2011 04:58:42 pm Sells, Fred wrote:
> This may be using a canon to swat a fly, but...
> 
> I had a project some time ago where I needed a very repetitive
> java/swing UI.  I ended up creating python classes that had a __repr__
> method that generated the java source code.  Then I was able to have
> very concise python files that instantiated the classes I needed and
> used that to generate java.
> 
> Perhaps a similar idea would work with .css possible even using the
> django template system.
> 

pretty much what I was thinking of.  but not using __repr__ or a string just 
the templates, but the idea is the same. I don't find css to repedative, not 
as much as gui programming, no where near as close, so dynamically creating 
sheets wouldn't be really neccessary. Just fill in existing templates.

You could probably do this with flatpages too.


Mike

-- 
What on earth would a man do with himself if something did not stand in his 
way?
-- H.G. Wells

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



Re: staticfile app question

2011-03-30 Thread Mike Ramirez
On Wednesday, March 30, 2011 05:01:08 pm Jason Culverhouse wrote:
> On Mar 30, 2011, at 4:50 PM, Mike Ramirez wrote:
> > On Wednesday, March 30, 2011 04:20:32 pm Shawn Milochik wrote:
> >> I have the exact same problem. I hope there is a solution, because
> >> good site design often results in image references in the CSS.
> 
> I think you guys are over analyzing the problem
> 
> You can use relative urls in css
> 
> Just look at
>   http://www.djangoproject.com/m/css/base.css
> 

Never really been a fan of relative urls or paths. It feels clumsy and full of 
pitfalls. The angst it causes me isn't worth it, since absolute solves all 
that. 

Mike
-- 
Avoid Quiet and Placid persons unless you are in Need of Sleep.
-- National Lampoon, "Deteriorata"

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



Re: staticfile app question

2011-03-30 Thread Jason Culverhouse

On Mar 30, 2011, at 5:10 PM, Mike Ramirez wrote:

> On Wednesday, March 30, 2011 05:01:08 pm Jason Culverhouse wrote:
>> On Mar 30, 2011, at 4:50 PM, Mike Ramirez wrote:
>>> On Wednesday, March 30, 2011 04:20:32 pm Shawn Milochik wrote:
 I have the exact same problem. I hope there is a solution, because
 good site design often results in image references in the CSS.
>> 
>> I think you guys are over analyzing the problem
>> 
>> You can use relative urls in css
>> 
>> Just look at
>>  http://www.djangoproject.com/m/css/base.css
>> 
> 
> Never really been a fan of relative urls or paths. It feels clumsy and full 
> of 
> pitfalls. The angst it causes me isn't worth it, since absolute solves all 
> that. 
> 

Some don't immediately grok that the that the url references in the style sheet 
are relative to the css file.  If your reference are relative, then everything 
stays
modular and you'll make a python developer happy when he doesn't have to 
muck  css.

To quote the spec
http://www.w3.org/TR/CSS21/syndata.html#uri
4.3.4 URLs and URIs

"""
In order to create modular style sheets that are not dependent on the absolute
location of a resource, authors may use relative URIs. Relative URIs
(as defined in [RFC3986]) are resolved to full URIs using a base URI.
RFC 3986, section 5, defines the normative algorithm for this process.

For CSS style sheets, the base URI is that of the style sheet, not that of the 
source document.

For example, suppose the following rule:

body { background: url("yellow") }

is located in a style sheet designated by the URI:

http://www.example.org/style/basic.css
The background of the source document's BODY will be tiled with whatever image 
is described by the resource designated by the URI

http://www.example.org/style/yellow

"""

> Mike
> -- 
> Avoid Quiet and Placid persons unless you are in Need of Sleep.
>   -- National Lampoon, "Deteriorata"
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



Re: Invalid values in a form cause validation to fail

2011-03-30 Thread Karen Tracey
On Wed, Mar 30, 2011 at 6:34 AM, ALJ  wrote:

> Hi Karen,
>
> Here is an example that I use to replicate the error:
>
> view >>
> [snip]
> >>
>
> form >
> class RatingsListFilterForm(forms.Form):
>organisation_name = forms.CharField(required=False,
> widget=forms.TextInput(attrs={'class':'textbox'}))
>corporation = forms.ModelChoiceField(required=False,
> queryset=Corporation.objects.all(),
> widget=forms.Select(attrs={'class':'selector'}))
>
> >>>
>
> Traceback>>
> [snip]
> I'm using Django 1.1 if that makes any difference
>

This was a bug in Django, the code you post works on 1.3 and 1.2.5. I
believe the issue was corrected with the fix for ticket #13149.

Karen
-- 
http://tracey.org/kmt/

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



Re: staticfile app question

2011-03-30 Thread Mike Ramirez
On Wednesday, March 30, 2011 05:34:05 pm Jason Culverhouse wrote:

I don't think you don't grok me, I'm not arguing they aren't allowed and I do 
know how they work. Your suggestion has been thought about, tossed around and 
rejected, way before this conversation took place.

Mike

-- 
Of all forms of caution, caution in love is the most fatal.

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



Re: staticfile app question

2011-03-30 Thread Mike Ramirez
On Wednesday, March 30, 2011 05:34:05 pm Jason Culverhouse wrote:

Just to add, if you have a seperate server and/or non-normal directory layout 
for for images and css files, this method doesn't work that well either.  

Again I'm not saying your suggestion is not a good one, it's just not one that 
fits every situation. 

Mike

-- 
You will become rich and famous unless you don't.

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



Force an ajax window to close

2011-03-30 Thread CrabbyPete
I have a ajax form using smoothbox and mootools to show a form.
Smoothbox has a button to close the box, but I want to force it closed
once the submit button is pressed and the form validated. Is there a
way django can close a browser window?

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



Is Django "leaking memory"?

2011-03-30 Thread dlamotte
I've documented what is going on here:

http://stackoverflow.com/questions/5494178/why-doesnt-memory-get-released-to-system-after-large-queries-or-series-of-queri

Basically, the memory doesn't "grow continuously" but it isn't
released to the system (yes DEBUG = False in settings.py).  What I'm
seeing is that after executing a series of large querysets, the memory
never gets released to the system.  I go into it in depth on the
stackoverflow question.  Is this the behavior to be expected or am I
encountering a bug in Django?

- Dan

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



WxPython and django

2011-03-30 Thread Aref
Hello,

I have created a small app with wxpython to manage and query databases
and now I am learning django and was wondering if it is possible to
incorporate some of the wxpython code in django. What I am trying to
do is to create the same app as the one in wxpython but make it web-
based rather than desktop. I know the django admin does that but I
wanted to learn how to create web based apps and thought that would be
a good exercise. Thanks for any pointers or ideas.

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



Re: WxPython and django

2011-03-30 Thread Calvin Spealman
They are completely unrelated. WX is a library for working with
desktop-based UI toolkits, and Django is a framework for producing and
delivering HTML/CSS/JS web content to a browser.

On Wed, Mar 30, 2011 at 10:03 PM, Aref  wrote:
> Hello,
>
> I have created a small app with wxpython to manage and query databases
> and now I am learning django and was wondering if it is possible to
> incorporate some of the wxpython code in django. What I am trying to
> do is to create the same app as the one in wxpython but make it web-
> based rather than desktop. I know the django admin does that but I
> wanted to learn how to create web based apps and thought that would be
> a good exercise. Thanks for any pointers or ideas.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://techblog.ironfroggy.com/
Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy

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



Re: Force an ajax window to close

2011-03-30 Thread Mike Ramirez
On Wednesday, March 30, 2011 06:36:56 pm CrabbyPete wrote:
> I have a ajax form using smoothbox and mootools to show a form.
> Smoothbox has a button to close the box, but I want to force it closed
> once the submit button is pressed and the form validated. Is there a
> way django can close a browser window?

This is a javascript problem.  Thing is that django is completely server side, 
the client knows nothing of django and it's functionality, even when using 
ajax, this is still all javascript on the client side.  Wtih that said 
window.close() in the 'popup' you've opened with the form would work.  
Becareful that you don't do this in the main window, you're not allowed to, it 
only works with a window that has a parent and you opened with javascript. 
Safety first.

Mike

-- 
The truth of a thing is the feel of it, not the think of it.
-- Stanley Kubrick

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



Re: Is Django "leaking memory"?

2011-03-30 Thread Calvin Spealman
Python itself allocates memory in large chunks and can't release them
until all objects in them have been garbage collected. Older versions
of CPython didn't even release this chunks at all.

On Wed, Mar 30, 2011 at 9:48 PM, dlamotte  wrote:
> I've documented what is going on here:
>
> http://stackoverflow.com/questions/5494178/why-doesnt-memory-get-released-to-system-after-large-queries-or-series-of-queri
>
> Basically, the memory doesn't "grow continuously" but it isn't
> released to the system (yes DEBUG = False in settings.py).  What I'm
> seeing is that after executing a series of large querysets, the memory
> never gets released to the system.  I go into it in depth on the
> stackoverflow question.  Is this the behavior to be expected or am I
> encountering a bug in Django?
>
> - Dan
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://techblog.ironfroggy.com/
Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy

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



Re: Force an ajax window to close

2011-03-30 Thread Calvin Spealman
You could add a header to the HTTP response that the JS on the
clientside can see and interpret as "OK, this is ready to close now."
I have done something similar to cause ajax-submitted forms to cause a
redirect in the containing page.

On Wed, Mar 30, 2011 at 10:24 PM, Mike Ramirez  wrote:
> On Wednesday, March 30, 2011 06:36:56 pm CrabbyPete wrote:
>> I have a ajax form using smoothbox and mootools to show a form.
>> Smoothbox has a button to close the box, but I want to force it closed
>> once the submit button is pressed and the form validated. Is there a
>> way django can close a browser window?
>
> This is a javascript problem.  Thing is that django is completely server side,
> the client knows nothing of django and it's functionality, even when using
> ajax, this is still all javascript on the client side.  Wtih that said
> window.close() in the 'popup' you've opened with the form would work.
> Becareful that you don't do this in the main window, you're not allowed to, it
> only works with a window that has a parent and you opened with javascript.
> Safety first.
>
> Mike
>
> --
> The truth of a thing is the feel of it, not the think of it.
>                -- Stanley Kubrick
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://techblog.ironfroggy.com/
Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy

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



  1   2   >