Re: can't adapt type 'Decimal'

2010-08-24 Thread Gabriel Farrell
(I tried to post the below in a comment at poupou's site (http://
www.defitek.com/blog/2010/06/29/cant-adapt-type-decimal-error-with-django-apache-postgresql-psycopg2/),
but kept getting errors.)

Just ran into the same problem. In my mod_wsgi config I had:

WSGIDaemonProcess site1 maximum-requests=1
WSGIProcessGroup site1
WSGIScriptAlias /site1 /var/www/site1/django.wsgi

WSGIDaemonProcess site2 maximum-requests=1
WSGIProcessGroup site2
WSGIScriptAlias /site2 /var/www/site2/django.wsgi

I was getting errors with that, but with the "process-group" parameter
things are running fine. Funny that at 
http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives
the only place where "process-group" is mentioned is in the
WSGIImportScript section.


On Jun 28, 5:01 pm, poupou  wrote:
> I confirm that everything is working fine now.
>
> Thank you again.
>
> On 25 juin, 13:12, poupou  wrote:
>
>
>
>
>
>
>
> > Yes I'm running two sites on the same server.  Only difference with
> > you is that I'm running it with virtual host.
>
> > I modifier my Apache config, now it looks like this :
>
> > 
> >   ServerName  site1.com
> >   WSGIDaemonProcess site1
> >   WSGIScriptAlias / /var/www/site1.wsgi process-group=site1
> > application-group=%{GLOBAL}
>
> > 
>
> > 
> >   ServerName  site2.com
> >   WSGIDaemonProcess site2
> >   WSGIScriptAlias / /var/www/site2.wsgi process-group=site2
> > application-group=%{GLOBAL}
>
> > 
>
> > It will take a little to make sure it's working, I will report on this
> > thread if everything is ok.
>
> > Thank you!
>
> > On 25 juin, 10:51, Stuart  wrote:
>
> > > On Jun 25, 8:06 am, poupou  wrote:
>
> > > >   Of the 2 web site that I have, It only happens where I make request
> > > > using the the Q objects.
>
> > > If you have two django sites/projects on the same server 
> > > (e.g.http://myserver/app1andhttp://myserver/app2) and you are using
> > > mod_wsgi, I bet you're having the same problem I was. To fix it,
> > > upgrade to the latest version of mod_wsgi and run it in daemon mode.
> > > See here for 
> > > details:http://groups.google.com/group/satchmo-users/msg/a9b22c236d63c323
>
> > > Hope that helps,
>
> > > --Stuart

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Enable users to input formatted text

2009-12-22 Thread Gabriel Farrell
If you have any trouble with tinymce look at Markdown in
django.contrib.markup, especially with the "safe" extension.  Nice
lightweight solution.


On Mon, Dec 21, 2009 at 6:22 PM, Continuation  wrote:
> django-tinymce looks like is what I need.
>
> Thanks for pointing me to that.
>
> On Dec 21, 5:50 pm, "pjrhar...@gmail.com"  wrote:
>> You've got to decide what you want to allow. If the users are trusted
>> you could allow them to input HTML, then you have to make sure its
>> marked as safe so the HTML is not escaped.[1]
>>
>> Alternatively you could use a markup language that can be converted to
>> HTML.[2]
>>
>> If you just want the newlines, you can convert them to HTML.[3]
>>
>> Finally, theres a variety of different options for rich text editors,
>> for example django-tinymce[4]
>>
>> 1.http://docs.djangoproject.com/en/dev/ref/templates/builtins/#safe
>> 2.http://docs.djangoproject.com/en/dev/ref/contrib/#ref-contrib-markup
>> 3.http://docs.djangoproject.com/en/dev/ref/templates/builtins/#linebreaks
>> 4.http://code.google.com/p/django-tinymce/
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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.




filter and count on multi-table inheritance?

2009-12-18 Thread Gabriel Farrell
I have the following models:

class News(models.Model):
title = models.CharField(max_length=128)
author = models.ForeignKey(User, related_name='news')

class Report(News):
subtitle = models.CharField(max_length=128)
synopsis = models.TextField()

class Post(News):
body = models.TextField()


I have a page where I list authors, and would like to include a count
of Reports and Posts from each one.  Is there a way to filter News for
Report or Post items?  I would like to add to the NewsManager so that
the template could include something as simple as
{{ author.news.report_count }}.

--

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

2007-11-21 Thread Gabriel Farrell

If you are stuck with PHP I recommend Symfony (http://www.symfony-
project.org/). It's the most Django-like PHP framework I've seen.

On Nov 21, 10:24 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> ok! argh... i don't want to use php anymore... :p is there at least a
> django like framework for php someone can recommend?
>
> ...and i came across this now:http://code.djangoproject.com/ticket/2407
> why did someone work on this if django + CGI is quite unusable anyway?
> has anyone tried this and got some performance insights?
>
> On Nov 21, 1:27 pm, "James Bennett" <[EMAIL PROTECTED]> wrote:
>
> > On 11/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > but what is incredibly slow? :) a second until everything is started
> > > up each time? my apps probably would be quite small and there wouldn't
> > > be many apps.
>
> > Thepointis it's not just your apps: Django itself has to be loaded
> > fresh into memory, all the imports have to be dealt with, modules have
> > to be initialized, the per-process application and model caches have
> > to be populated... there's a *ton* of behind-the-scenes work involved
> > in getting a server process up and running with Django, and under CGI
> > you have to do that for every single request you serve.
>
> > If CGI is your only option, you will not be able to achieve acceptable
> > performance for a production site, and you should not be using Django,
> > which is designed for environments where mechanisms exist to persist
> > the code in memory over the life of a server 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Include tag - encoding

2007-11-20 Thread Gabriel Farrell

I don't know details on this, but there have been a lot of
improvements to the Unicode handling in versions since 0.96, so an
obvious suggestion would be to upgrade to the latest Subversion
trunk.  That will most likely solve your problem.

gsf

On Nov 20, 12:09 pm, cwurld <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a block of text that I load into a webpage using an {%
> include  %} tag. I have two versions of the include file. One in
> English, the other in Spanish. I have no problem loading either one.
> However the Spanish characters in the Spanish file are not displayed
> properly.
>
> I tried putting some of the Spanish text directly in the webpage and
> that text was properly displayed. So I am guessing that the include
> tag is getting the content from the file as if it were ascii and not
> utf-8.
>
> I am using version 0.96.
>
> Any suggestions?
>
> Thanks,
> Chuck
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: starting point?

2007-11-20 Thread Gabriel Farrell

Hi Horace,

Depending on your webhost, you will need to use fastcgi or mod-
python.  See http://wiki.dreamhost.com/index.php/Django as an example
-- therein are the steps necessary to get Django running on DreamHost,
a large webhost that supports fastcgi.

Also see http://www.djangoproject.com/documentation/modpython/ and
http://www.djangoproject.com/documentation/fastcgi/.

gsf

On Nov 20, 2:21 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> hi,
>
> i am currently doing the tutorial. i am at the middle of part 3 and
> quickly skimmed through the rest of 3 and 4 already.
>
> so far so good. it works great locally and with django's own simple
> server.
>
> but what i don't understand yet... if i move this to a webhoster,
> where is the starting point then? isn't there some index.cgi needed or
> so? or how will the server know that a certain url is supposed to be
> handled by django?
>
> ~horace
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error message when viewing admin? (ViewDoesNotExist at /admin/)

2007-10-03 Thread Gabriel Farrell

Did you have a view named "startsess" that you subsequently deleted?
Admin is looking for it but not finding it.  You may need to remove it
from django_content_type.  Try dropping that table from your database
and running python manage.py syncdb.

On Oct 3, 12:34 pm, Greg <[EMAIL PROTECTED]> wrote:
> Hello,
> Whenever I login to my admin view the very first thing I see if the
> following error.  It also happens occasionally when I'm going through
> my admin pages.
>
> ViewDoesNotExist at /admin/
> Tried startsess in module mysite.rugs.views. Error was: 'module'
> object has no attribute 'startsess'
> Request Method: GET
> Request URL:http://127.0.0.1:8000/admin/
> Exception Type: ViewDoesNotExist
> Exception Value:Tried startsess in module mysite.rugs.views. Error
> was: 'module' object has no attribute 'startsess'
> Exception Location: c:\Python24\lib\site-packages\django\core
> \urlresolvers.py in _get_callback, line 184
> Python Executable:  c:\Python24\python.exe
> Python Version: 2.4.4
>
> //
>
> Template error
>
> In template c:\python24\lib\site-packages\django\contrib\admin
> \templates\admin\base.html, error at line 28
> Caught an exception while rendering: Tried startsess in module
> mysite.rugs.views. Error was: 'module' object has no attribute
> 'startsess'
> 18  {% if not is_popup %}
> 19  
> 20  
> 21  
> 22  {% block branding %}{% endblock %}
> 23  
> 24  {% if user.is_authenticated and user.is_staff %}
> 25  
> 26  {% trans 'Welcome,' %} {% if user.first_name %}
> {{ user.first_name|escape }}{% else %}{{ user.username }}{% endif %} strong>.
> 27  {% block userlinks %}
> 28  {%
> trans 'Documentation' %}
> 29  / {%
> trans 'Change password' %}
> 30  / {% trans
> 'Log out' %}
> 31  {% endblock %}
> 32  
> 33  {% endif %}
> 34  {% block nav-global %}{% endblock %}
> 35  
> 36  
> 37  {% block breadcrumbs %}{%
> trans 'Home' %}{% if title %} › {{ title|escape }}{% endif
> %}{% endblock %}
> 38  {% endif %}
>
> //
>
> Line 28 is highlighted in the above code.  This code is in red '{% url
> django.contrib.admin.views.doc.doc_index %}' from line 28
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Passing a list of field names to the value() method?

2007-06-21 Thread Gabriel Farrell

On Jun 19, 5:19 pm, RichardH <[EMAIL PROTECTED]> wrote:
> This is probably more of a Python question than django, but django
> provides the context for my problem.
>
> Requirement: I have got a user defined list of field names (e.g.
> field_names=['id','name','description',...]) and I want to pass this
> list to the value() method on a QuerySet thereby returning a subset of
> the model fields (as a dictionary).
>
> Problem: value() takes individual field names as parameters (e.g.
> value('id', 'name,' description'), not a list of field names (e.g.
> value(field_names) ). Is there a simple way of passing the list of
> field names to the value() method or is there an alternative strategy
> for returning the subset of fields from the QuerySet?
>
> Hopefully this is obvious to someone, but it has me stumped.
>
> Richard

Not obvious, and it's stumped me before in various Python projects, so
I decided to search around for it.  Finally found it at
http://mail.python.org/pipermail/python-list/2005-March/312568.html.
That post says, in short, that one can pass a list of values to a
function that expects those values as variable arguments by simply
placing an asterisk before the list (or tuple) in the function input.
For example:

>>> def bob(*args):
... for arg in args:
... print arg
...
>>> sally = ['june', 'andy', 'frank']
>>> bob(sally)
['june', 'andy', 'frank']
>>> bob(*sally)
june
andy
frank
>>>

I tried so many ways around this problem, and I knew Python, by it's
nature, had to have a simple solution.  Glad to have found it.

HTH,
Gabe


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



Re: CheckboxSelectMultiple error: Select a valid choice. That choice is not one of the available choices.

2007-06-18 Thread Gabriel Farrell

On Jun 15, 3:13 pm, Gabriel Farrell <[EMAIL PROTECTED]> wrote:
> I've just replaced the RadioSelect widget with CheckboxSelectMultiple
> for one field in my view.  Here's the relevant code:
>
> self.fields['patron_type'] = forms.ChoiceField(choices=(
> (pt.id, pt.name) for pt in patron_type_choices),
> widget=widgets.CheckboxSelectMultiple())
>
> It shows up fine in the browser, but now I receive the "Select a valid
> choice. That choice is not one of the available choices." error no
> matter which box I check on that field.  Have I missed something?
>
> Gabe

Ah.  Figured it out.  ChoiceField needs to be MultipleChoiceField.
Thanks for the help, everybody! ;)


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



Re: delete obsolete content type entries...

2007-06-18 Thread Gabriel Farrell

On May 7, 4:32 am, Jens Diemer <[EMAIL PROTECTED]> wrote:
> That surprises me. Does nobody have the same problems?
> Still nobody delete a model class?
>
> How to clean up the django tables? With phpMyAdmin?
>

I've just run into a similar issue when I removed an app from a
project.  After some attempt to fix the tables myself, I held my
breath, dropped the tables (auth_permission and django_content_type),
then ran "python manage.py syncdb".  Voila, the tables were re-created
correctly, without the app I had removed.

> --
> Mfg.
>
> Jens Diemer
>
> 
> A django powered CMS:http://www.pylucid.org


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



CheckboxSelectMultiple error: Select a valid choice. That choice is not one of the available choices.

2007-06-15 Thread Gabriel Farrell

I've just replaced the RadioSelect widget with CheckboxSelectMultiple
for one field in my view.  Here's the relevant code:

self.fields['patron_type'] = forms.ChoiceField(choices=(
(pt.id, pt.name) for pt in patron_type_choices),
widget=widgets.CheckboxSelectMultiple())

It shows up fine in the browser, but now I receive the "Select a valid
choice. That choice is not one of the available choices." error no
matter which box I check on that field.  Have I missed something?

Gabe


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