Subquery has too many columns

2017-02-18 Thread Elton Pereira
When I change the *base_manager_name* and try to update the model an
exception is raised <http://pastebin.com/PNs4axGC>.

This is my code:

class ProdutoServicoManager(models.Manager):
def get_queryset(self):
expression = models.Sum(models.F('custounitario__valor') *
models.F('custounitario__quantidade'))
total_expr = models.ExpressionWrapper(expression,
output_field=models.DecimalField())
return super().get_queryset().annotate(custo_producao=total_expr)

class ProdutoServico(Base):
produto = models.BooleanField(default=True)
descricao = models.TextField()
objects = ProdutoServicoManager()

class Meta:
base_manager_name = 'objects'

I thought I had found the answer to this problem in issue 19513
<https://code.djangoproject.com/ticket/19513>, but it was already closed.
Apparently this error reappears when I try to annotate the base_manager.

Should I open a new issue?
-- 

Elton Pereira de Lima

-

Quem nada dúvida, nada descobre.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOxxup03o_ie%2BusbxSMcNozAf8hAiuOy8oaX1F8%3DjP8AoaFBYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Choices in DecimalField - django 1.8.

2015-04-20 Thread Elton Pereira
In the model below, using the Django admin, no matter what value I choose, 
it always displays the default value. But writes the correct value in the 
 database. Am I doing something wrong or is this a bug?

TENSAO_220 = Decimal(220)
TENSAO_110 = Decimal(110)
TENSOES = ((TENSAO_220, '220 volts'),
   (TENSAO_110, '110 volts'))

class Equipamento(models.Model):
nome = models.CharField(max_length=128)
  tensao = models.DecimalField(max_digits=8,
   decimal_places=3,
   choices=TENSOES,
   default=TENSAO_220)

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dae72145-de71-48b2-9fd8-33f010e11ee1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


BinaryField on Django 1.6b4

2013-10-18 Thread Elton Pereira
I created a new project with a class with two fields, one type CharField 
and another type BinaryField. When I access the admin, only the field name 
appears.

My class:

class Arquivo(models.Model):
nome = models.CharField(max_length=255)
arquivo = models.BinaryField()

def __unicode__(self):
return self.nome


Sorry if my english is not good.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/67aac277-c2c3-49ef-b3af-3380866a9d33%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Template syntax erro

2011-04-29 Thread Elton Pereira
When trying to upload or download files that contain non-ascii
caracters raise a TemplateSyntaxError exception with the following
contents:

Django Version: 1.2.5
Exception Type: TemplateSyntaxError
Exception Value:

Caught UnicodeEncodeError while rendering: 'ascii' codec can't encode
characters in position 125-126: ordinal not in range(128)

Exception Location: /usr/local/lib/python2.6/dist-packages/django/
core/files/storage.py in _open, line 137
Python Executable:  /usr/bin/python
Python Version: 2.6.5
Python Path:['/home/protocolo/protocolo', '/home/protocolo', '/home/
protocolo/protocolo', '/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/dist-packages', '/
usr/lib/pymodules/python2.6', '/usr/local/lib/python2.6/dist-
packages', '/usr/lib/openoffice/basis-link/program']
Server time:Sex, 29 Abr 2011 11:56:10 -0300

I have done what is on this page but not solved:
http://docs.djangoproject.com/en/1.2/howto/deployment/modpython/#if-you-get-a-unicodeencodeerror

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.



Error performing rar file download.

2011-04-27 Thread Elton Pereira
When attempting to download a zip file the following error is raised:

192.168.1.39 - - [27/Apr/2011 11:12:35] "GET /media/downloads/betha/
essencial/sybase9/windows32/win32.rar HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/django/core/servers/
basehttp.py", line 674, in __call__
return self.application(environ, start_response)
  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
wsgi.py", line 252, in __call__
response = middleware_method(request, response)
  File "/usr/local/lib/python2.6/dist-packages/django/middleware/
gzip.py", line 35, in process_response
response.content = compress_string(response.content)
  File "/usr/local/lib/python2.6/dist-packages/django/utils/text.py",
line 183, in compress_string
zfile.write(s)
  File "/usr/lib/python2.6/gzip.py", line 197, in write
self.fileobj.write( self.compress.compress(data) )
MemoryError

NOTE: any other file I can download normally, the error only happens
with RAR files.

-- 
You received this message because you are subscribed to the Google 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.