Django docs - how to build json docs with sphinx

2010-02-14 Thread A Melé
I'm trying to use djangodocs: 
http://code.djangoproject.com/browser/djangoproject.com/djangodocs
. I see it requires documentation to be in .fjson format. So I have
tried to build the django docs with sphinx:

sphinx-build -b json . _build/json

But I get this error:
File "/usr/lib/python2.5/site-packages/Sphinx-0.6.4-py2.5.egg/sphinx/
builders/html.py", line 789, in handle_page
self.implementation.dump(ctx, f, 2)
AttributeError: 'module' object has no attribute 'dump'

I can convert the docs to HTML or .pickle files without errors, but
not to fjson. How can I do it?

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-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: Connection limit exceeded for non-superusers

2009-10-11 Thread A Melé

Looking at the postgresql log I can see it's probably the connection
hasn't been closed:

LOG:  unexpected EOF on client connection

Any ideas on this?

Thank you.


On 9 oct, 12:34, A Melé <antonio.m...@gmail.com> wrote:
> I get this when I run the query: SELECT * FROM pg_stat_activity
>
>  datid |  datname  | procpid | usesysid |  usename  |
> current_query          | waiting |          xact_start
> |          query_start          |         backend_start         |
> client_addr | client_port
> ---+---+-+--+---
> +-+-
> +---+---
> +---+-+-
>  17237 | django_es |   29167 |    16608 | django_es |  in
> transaction           | f       | 2009-09-29 15:00:02.04-05 |
> 2009-09-29 15:00:43.979417-05 | 2009-09-29 15:00:02.05414-05
> |             |          -1
>  17237 | django_es |   29168 |    16608 | django_es |  in
> transaction           | f       | 2009-09-29 21:00:02.476379-05 |
> 2009-09-29 21:00:48.102082-05 | 2009-09-29 21:00:02.47496-05
> |             |          -1
>  17237 | django_es |   11474 |    16608 | django_es |  in
> transaction           | f       | 2009-09-30 06:00:02.932235-05 |
> 2009-09-30 06:00:41.53456-05  | 2009-09-30 06:00:02.930783-05
> |             |          -1
>  17237 | django_es |   22825 |    16608 | django_es |  in
> transaction           | f       | 2009-09-30 15:00:01.85973-05  |
> 2009-09-30 15:00:54.566471-05 | 2009-09-30 15:00:01.858281-05
> |             |          -1
>
> and 93 more rows!
>
> On 9 oct, 12:27, A Melé <antonio.m...@gmail.com> wrote:
>
>
>
> > I am using Django with PostgreSQL and everything was ok but in the
> > last weeks I get this error sometimes when loading my sites. I didn't
> > make any changes to the database configuration so I don't know why it
> > doesn't work sometimes. Anybody knows how to solve this? Is Django
> > keeping db connections open somehow?
>
> > Djangobook.com had the same problem (http://code.djangoproject.com/
> > ticket/3653) but I don't know how they solved that.
>
> > TemplateSyntaxError at /
> > Caught an exception while rendering: FATAL:  connectionlimitexceeded
> > for non-superusers
>
> > Original Traceback (most recent call last):
> >   File "/usr/lib/python2.5/site-packages/django/template/debug.py",
> > line 71, in render_node
> >     result = node.render(context)
> >   File "/usr/lib/python2.5/site-packages/django/template/
> > defaulttags.py", line 126, in render
> >     len_values = len(values)
> >   File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> > line 81, in __len__
> >     self._result_cache = list(self.iterator())
> >   File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> > line 238, in iterator
> >     for row in self.query.results_iter():
> >   File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> > query.py", line 287, in results_iter
> >     for rows in self.execute_sql(MULTI):
> >   File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> > query.py", line 2368, in execute_sql
> >     cursor = self.connection.cursor()
> >   File "/usr/lib/python2.5/site-packages/django/db/backends/
> > __init__.py", line 81, in cursor
> >     cursor = self._cursor()
> >   File "/usr/lib/python2.5/site-packages/django/db/backends/postgresql/
> > base.py", line 116, in _cursor
> >     self.connection= Database.connect(conn_string, **settings_dict
> > ['DATABASE_OPTIONS'])
> > OperationalError: FATAL:  connectionlimitexceededfor non-superusers
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Connection limit exceeded for non-superusers

2009-10-09 Thread A Melé

I get this when I run the query: SELECT * FROM pg_stat_activity

 datid |  datname  | procpid | usesysid |  usename  |
current_query  | waiting |  xact_start
|  query_start  | backend_start |
client_addr | client_port
---+---+-+--+---
+-+-
+---+---
+---+-+-
 17237 | django_es |   29167 |16608 | django_es |  in
transaction   | f   | 2009-09-29 15:00:02.04-05 |
2009-09-29 15:00:43.979417-05 | 2009-09-29 15:00:02.05414-05
| |  -1
 17237 | django_es |   29168 |16608 | django_es |  in
transaction   | f   | 2009-09-29 21:00:02.476379-05 |
2009-09-29 21:00:48.102082-05 | 2009-09-29 21:00:02.47496-05
| |  -1
 17237 | django_es |   11474 |16608 | django_es |  in
transaction   | f   | 2009-09-30 06:00:02.932235-05 |
2009-09-30 06:00:41.53456-05  | 2009-09-30 06:00:02.930783-05
| |  -1
 17237 | django_es |   22825 |16608 | django_es |  in
transaction   | f   | 2009-09-30 15:00:01.85973-05  |
2009-09-30 15:00:54.566471-05 | 2009-09-30 15:00:01.858281-05
| |  -1

and 93 more rows!


On 9 oct, 12:27, A Melé <antonio.m...@gmail.com> wrote:
> I am using Django with PostgreSQL and everything was ok but in the
> last weeks I get this error sometimes when loading my sites. I didn't
> make any changes to the database configuration so I don't know why it
> doesn't work sometimes. Anybody knows how to solve this? Is Django
> keeping db connections open somehow?
>
> Djangobook.com had the same problem (http://code.djangoproject.com/
> ticket/3653) but I don't know how they solved that.
>
> TemplateSyntaxError at /
> Caught an exception while rendering: FATAL:  connection limit exceeded
> for non-superusers
>
> Original Traceback (most recent call last):
>   File "/usr/lib/python2.5/site-packages/django/template/debug.py",
> line 71, in render_node
>     result = node.render(context)
>   File "/usr/lib/python2.5/site-packages/django/template/
> defaulttags.py", line 126, in render
>     len_values = len(values)
>   File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> line 81, in __len__
>     self._result_cache = list(self.iterator())
>   File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> line 238, in iterator
>     for row in self.query.results_iter():
>   File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> query.py", line 287, in results_iter
>     for rows in self.execute_sql(MULTI):
>   File "/usr/lib/python2.5/site-packages/django/db/models/sql/
> query.py", line 2368, in execute_sql
>     cursor = self.connection.cursor()
>   File "/usr/lib/python2.5/site-packages/django/db/backends/
> __init__.py", line 81, in cursor
>     cursor = self._cursor()
>   File "/usr/lib/python2.5/site-packages/django/db/backends/postgresql/
> base.py", line 116, in _cursor
>     self.connection = Database.connect(conn_string, **settings_dict
> ['DATABASE_OPTIONS'])
> OperationalError: FATAL:  connection limit exceeded for non-superusers
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Connection limit exceeded for non-superusers

2009-10-09 Thread A Melé

I am using Django with PostgreSQL and everything was ok but in the
last weeks I get this error sometimes when loading my sites. I didn't
make any changes to the database configuration so I don't know why it
doesn't work sometimes. Anybody knows how to solve this? Is Django
keeping db connections open somehow?

Djangobook.com had the same problem (http://code.djangoproject.com/
ticket/3653) but I don't know how they solved that.

TemplateSyntaxError at /
Caught an exception while rendering: FATAL:  connection limit exceeded
for non-superusers

Original Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/django/template/debug.py",
line 71, in render_node
result = node.render(context)
  File "/usr/lib/python2.5/site-packages/django/template/
defaulttags.py", line 126, in render
len_values = len(values)
  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
line 81, in __len__
self._result_cache = list(self.iterator())
  File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
line 238, in iterator
for row in self.query.results_iter():
  File "/usr/lib/python2.5/site-packages/django/db/models/sql/
query.py", line 287, in results_iter
for rows in self.execute_sql(MULTI):
  File "/usr/lib/python2.5/site-packages/django/db/models/sql/
query.py", line 2368, in execute_sql
cursor = self.connection.cursor()
  File "/usr/lib/python2.5/site-packages/django/db/backends/
__init__.py", line 81, in cursor
cursor = self._cursor()
  File "/usr/lib/python2.5/site-packages/django/db/backends/postgresql/
base.py", line 116, in _cursor
self.connection = Database.connect(conn_string, **settings_dict
['DATABASE_OPTIONS'])
OperationalError: FATAL:  connection limit exceeded for non-superusers
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Accent-insensitive queryset filter

2009-08-20 Thread A Melé

PostgreSQL. It seems that it is accent-sensitive by default.

On 20 ago, 03:57, Karen Tracey <kmtra...@gmail.com> wrote:
> On Wed, Aug 19, 2009 at 6:47 PM, A Melé <antonio.m...@gmail.com> wrote:
>
> > Is there any way to perform an accent insensitive match when you are
> > filtering a queryset? I'm looking for something like iexact (http://
> > docs.djangoproject.com/en/dev/ref/models/querysets/#iexact) but accent-
> > insensitive. Is there any simple way to do it?
>
> What database? MySQL's default collation does this, offhand I don't know how
> others behave.
>
> Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Accent-insensitive queryset filter

2009-08-19 Thread A Melé

Is there any way to perform an accent insensitive match when you are
filtering a queryset? I'm looking for something like iexact (http://
docs.djangoproject.com/en/dev/ref/models/querysets/#iexact) but accent-
insensitive. Is there any simple way to do it?

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: Sending a list of items by email

2009-03-03 Thread A Melé

Alfonso,

If you ar using text e-mail you can just use: ', '.join(order_list) or
'\n'.join(order_list)

Another way, is using a string (nice for sending HTML e-mails):

order_list = CustomerBasket.objects.all()
customer = UserProfile.objects.get(user=user).customer
body = ''

for item in order_list:
body += '%s: %s' % (item.attribute1,
item.attribute2)

email = EmailMessage(
'New Customer Order: %s ' % customer,
body, to = ['email']
)
email.send()

I hope that helps you.

A Melé
http://django.es


On 3 mar, 12:52, Alfonso <allanhender...@gmail.com> wrote:
> Thinking this should be easy but not sure of the correct path to
> success!
>
> Got a simple filter queryset that pulls order products from a db:
>
> order_list = CustomerBasket.objects.all()
> customer = UserProfile.objects.get(user=user).customer
> email = EmailMessage(
>         'New Customer Order: %s ' % customer,
>         '%s' % order_list, to = ['email']
> )
> email.send()
>
> So when running the  above I get this in the sent email:
>
> [, , ]
>
> At least it's sending the email :-)  My question is, what's a
> straightforward way to iterate through the items in 'order list' and
> print them nicely in the email body.
>
> 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
-~--~~~~--~~--~--~---



Adding new attributes to objects in a query_set in custom Manager

2009-03-03 Thread A Melé

I tried to add a custom attribute to the objects in the query_set of a
custom Manager before returning the query_set but it seems not to
work:

class SongManager(models.Manager):
def expire(self):
from boto.s3.connection import S3Connection
c = S3Connection()
for song in self.get_query_set():
song.new_attribute = c.generate_url(expires_in=1,
key=song.mp3.name, method="GET")
return self.get_query_set()

In the template {{ song.new_attribute }} returns nothing at all. Any
ideas how to do this?

Thank you.

A Melé
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: ImageField, width_field, height_field not working

2009-02-03 Thread A Melé

It seems that after rev. 9766 ImageFieldFile's save() method (where it
sets values for height_field and width_field) is bypassed when saving
the file (at least with the admin). I use FieldFiles that inherit from
ImageFieldFile (for example in django-thumbs code (thanks for
reporting the issue, Andrew)) and I override the ImageFieldFile's save
() method with custom code. That code doesn't get executed when saving
the file with the admin when using rev.9766 and later revisions.

Regards,
Antonio Melé
http://django.es/

On 24 ene, 03:21, Andrew Ingram <a...@andrewingram.net> wrote:
> Malcolm Tredinnick wrote:
> > So the next thing is to narrow down which commit. You know a good commit
> > and you know a bad one. Now pick something halfway in between and try
> > that. Continue with binary searching. It won't take many repetitions to
> > get to the precise commit.
>
> > Regards,
> > Malcolm
>
> I've narrowed it down to revision 9766:
>
> "Fixed #10044: You can now assign directly to file fields
> (`instance.filefield = somefile`)."
>
> http://code.djangoproject.com/ticket/10044
>
> It's late now, but I'll update the ticket tommorrow if nobody else has
> by then.
>
> Regards,
> Andrew Ingram
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Multiple images in form

2009-01-22 Thread A Melé

DragonSlayre,

django-thumbs fields act exactly the same way as any ImageField (the
inherit from ImageFIeld), so they can be blank and null. That
shouldn't be a problem.

Regards,

Antonio Melé
http://django.es/blog/


On 20 ene, 19:21, DragonSlayre <lssay...@gmail.com> wrote:
> Yeah, I had to add a related_name to my ForeignKeys e.g:
>     first_photo = models.ForeignKey(Image, blank=True, null=True,
> related_name="first photo")
>
> The problem now is that with foreign keys, it generates a drop down
> list to select the images - whereas, I want a browse type text box to
> choose an image. - is there anyway to tell the foreignkey field to
> render the items pointed to by the foreign key, rather than just
> render a drop down list?
>
> On Jan 21, 3:14 am, "Karen Tracey" <kmtra...@gmail.com> wrote:
>
> > On Tue, Jan 20, 2009 at 2:28 AM, DragonSlayre <lssay...@gmail.com> wrote:
> > > [snip details of problem]
>
> > > This gives me loads of errors - i'm pretty sure it's because of the
> > > ForeignKeys.
>
> > Without trying it, I'm guessing you got four errors.  If they are the errors
> > I think they are, the error message actually tries pretty hard to point you
> > in the right direction of fixing them.  Did you try following the advice in
> > the error message?  If you do not understand the error message, it would
> > help if you included it with your question as well as what it is you don't
> > understand in what it is trying to say, which would help people try to frame
> > an answer to address whatever misunderstanding is causing the confusion.  As
> > it is I'm just guessing that if you read and follow the advice in the error
> > messages you can make the errors go away pretty easily.
>
> > Karen
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Upcoming on-line Spanish translation sprint: Friday, Jan. 9, 2009

2009-01-07 Thread A Melé

>From Friday, Jan. 9 to Sunday, Jan. 11, 2009 the Spanish Django
community is going to hold an on-line translation sprint. The main
purpose of this sprint is to translate the most important parts of the
Django documentation into Spanish. After that the Spanish
documentation will be available in the Spanish community site http://django.es
and it will be merged into trunk when Jacob adds support for merging
translated documentation: 
http://groups.google.com/group/django-developers/browse_thread/thread/a904a8e302d9e915

All details for translating any document into Spanish are described
here: http://django.es/blog/traducir-la-documentacion-de-django-al-espanol/

Join us! :)


Thank you. Regards,

Antonio Melé


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: FileSystemStorage content vs PIL Image - **Initial solution**

2009-01-05 Thread A Melé

Donn, take a look at django-thumbs source code, it integrates PIL and
SotrageBackend: 
http://code.google.com/p/django-thumbs/source/browse/trunk/thumbs.py
I hope the code helps you.


Regards,

Antonio Melé
http://django.es/blog/


On 5 ene, 13:30, Donn <donn.in...@gmail.com> wrote:
> On Monday, 05 January 2009 14:00:16 Eric Abrahamsen wrote:
>
> > content.write(o.getvalue())
> > super(CustomImageStorage,self).save(name, content)
>
> That gives:
> 'InMemoryUploadedFile' object has no attribute '_mode'
> Exception
> Location:       /usr/lib/python2.5/site-packages/django/core/files/base.py in
> _get_mode, line 39
>
> I recall getting this mode error and went past it to my eventual solution. But
> I'd like to know if it's kosher or crazy.
>
> \d
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



appointments in admin, possible?

2006-08-31 Thread Antonio Melé

Lets see if someone has already dealt with this problem and can help
me:
I want to administer appointments in admin. I have two classes:

===
class Client(models.Model):
   name = models.CharField(maxlength=30)
   company = models.CharField(maxlength=50)

class Appointment(models.Model):
   client = models.ForeignKey(Client,raw_id_admin=True)
   when = models.DateField(core=True)
   hour = models.TimeField(core=True)
===

There is a ManyToOne relationship: I can make many appointments with
every client and each appointment belongs only to one client. The
problem is I cannot make an appointment with a client the same date and
same time I've planned another appointment before. So I've got 2
troubles:

- When creating a new appointment showing only available dates/times
for selection.
(perhaps with AJAX when selecting a date showing only available times
for that date? but... how?)

- In the appointments list view showing available days for directly
adding an appointment that day (something like a timetable?)

Has anyone dealt with appointments in django admin? how?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---