class, but not from the parent class.
Mikkel
torsdag den 27. december 2018 kl. 20.59.43 UTC+1 skrev Mikkel Kromann:
>
>
> Hello.
>
> I have a parent Meta class and some child classes.
> I would like to read the decimal_places attribute from DecimalField of my
> child ins
Hello.
I have a parent Meta class and some child classes.
I would like to read the decimal_places attribute from DecimalField of my
child instances using a function in my parent class.
I am able to read the attribute from inside my child classes, but I cant
crack how to read from a function in
In case anyone else ends up here, I've found that it's very sensitive to
how you specify the Decimal, so in my example Decimal('20.00') worked but
Decimal('20') and Decimal(20) did not.
On Monday, April 20, 2015 at 6:44:30 PM UTC+1, eltonplima wrote:
>
> In the model below, using the Django admi
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'),
It works! You are great Collin! Thank you very much!
El domingo, 16 de noviembre de 2014 18:51:43 UTC+1, elcaiaimar escribió:
>
> Hello everybody, I've a problem with DecimalField at Forms. I've a long
> form in my template and I want to left some fields in blank. I've
your
> advice!
>
> Thank you very much!
>
>
> El domingo, 16 de noviembre de 2014 18:51:43 UTC+1, elcaiaimar escribió:
>>
>> Hello everybody, I've a problem with DecimalField at Forms. I've a long
>> form in my template and I want to left some f
ybody, I've a problem with DecimalField at Forms. I've a long
> form in my template and I want to left some fields in blank. I've declared
> these fields with
> *required=False*, but when I submit the form I receive this error: '*This
> value must be a decimal
seccionmayor=seccionmayor, seccionmenor=seccionmenor,
> numacometidas=numacometidas,
> origen=origen, observaciones=observaciones, geom=pnt)
>
> xy.save()
>
> I've tried to put default=None or default=Decimal('0.00') in my mod
y.save()
I've tried to put default=None or default=Decimal('0.00') in my models.py
but it continues without working. I don't know what can I do
Thank you very much
El domingo, 16 de noviembre de 2014 18:51:43 UTC+1, elcaiaimar escribió:
>
> Hello everybody, I've a
TC+1, elcaiaimar escribió:
>
> Hello everybody, I've a problem with DecimalField at Forms. I've a long
> form in my template and I want to left some fields in blank. I've declared
> these fields with
> *required=False*, but when I submit the form I receive this erro
You'd better have a look at the raw database SQL. I think syncdb won't change
the null attr of this column if it is not set in the first time. So the
possible solutions are 1) change the column in db manually 2) use a migration
tool like south. Hope this can help you.
--
You received this mess
I think you'd better have a look at the raw db sql. I remember that the syncdb
won't change the null attr. of a column if it's not set when initialized. So
two possible solutions: 1) set the db manually 2) use a tool like south to do a
migration. Hope I can help you.
--
You received this messa
aimar wrote:
> Hello everybody, I've a problem with DecimalField at Forms. I've a long
> form in my template and I want to left some fields in blank. I've declared
> these fields with
> *required=False*, but when I submit the form I receive this error: '*This
> va
Hello everybody, I've a problem with DecimalField at Forms. I've a long
form in my template and I want to left some fields in blank. I've declared
these fields with
*required=False*, but when I submit the form I receive this error: '*This
value must be a decimal numb
Hello,
How to display the DecimalField without the E (scientific) notation in the
django admin?
Here is my field:
models.DecimalField(max_digits=12, decimal_places=8, null=True)
Here is what I see in the admin:
0E-8.# on the table
0E-8 # in the form
t only
> admin), if I switch to sqlite3 backend then it works perfectly
>
Decimal("0E-8") == Decimal(0) == Decimal(0.0)
If you do not want the python representation of your field to be a
Decimal, do not use DecimalField, use FloatField.
https://docs.djangoproject.com/en/1
fectly
On Thursday, January 9, 2014 3:37:38 AM UTC-5, Timothy W. Cook wrote:
>
>
> On Wed, Jan 8, 2014 at 10:42 PM, Dennis Lee Bieber
>
> > wrote:
>
>
>> If Django's "DecimalField" is NOT use Python's Decimal type, I'd
>> be
>
On Wed, Jan 8, 2014 at 10:42 PM, Dennis Lee Bieber wrote:
> If Django's "DecimalField" is NOT use Python's Decimal type, I'd be
>
concerned... Python's Decimal is NOT a "float".
>
> However, the conversion of a Decimal to/from P
On Thursday, January 9, 2014 7:37:43 AM UTC+11, Timothy W. Cook wrote:
>
>
> On Wed, Jan 8, 2014 at 6:07 PM, Erik Cederstrand
>
> > wrote:
>
>> Den 08/01/2014 kl. 17.56 skrev Daniel Roseman
>>
>> >:
>>
>
> >
>> But to post the solution to the issue, just for completeness.
>>
>
> Yes, Djan
On Wed, Jan 8, 2014 at 6:07 PM, Erik Cederstrand
wrote:
> Den 08/01/2014 kl. 17.56 skrev Daniel Roseman :
> >
>
> Greatly embarrassed, and thanks for clarifying. Will be more careful when
> answering next time :-)
>
> Erik
>
>
Well, Erik. I appreciate you answering even if it wasn't 100% accurate
prisingly) the `decimal` module. As the
> documentation for that module explains, decimals do provide precise
> floating-point arithmetic, and are therefore suitable for representing things
> like currencies. Databases usually also provide a similar datatype, which
> Django's De
(not surprisingly) the `decimal` module. As the
> documentation for that module explains, decimals do provide precise
> floating-point arithmetic, and are therefore suitable for representing
> things like currencies. Databases usually also provide a similar datatype,
> which Django's
t before writing it out to the file (an XML schema)
> so it really isn't a big deal, just surprising.
>
> Ah, the “decimal” in DecimalField only refers to how you are supposed to
> enter the values in a form. Python itself only has float and that’s what
> Django uses internal
t surprising.
Ah, the “decimal” in DecimalField only refers to how you are supposed to enter
the values in a form. Python itself only has float and that’s what Django uses
internally. Decimal vs. scientific notation is just a matter of how you choose
to format the output when converting the float to a
On Wed, Jan 8, 2014 at 1:44 PM, Erik Cederstrand
wrote:
> Den 08/01/2014 kl. 16.18 skrev Timothy W. Cook :
>
>
> > So, why doesn't it just store a zero?
>
> Underneath a DecimalField there is a Python float type, and some
> equivalent float type in your
is
> concept."), null=True, blank=True)
>
> Via the admin interface when I enter a 0 (zero) and save the object I get
> 0E-10 as the value. I am using PostgreSQL 9.1 for persistence.
>
> So, why doesn't it just store a zero?
Underneath a DecimalField there is
I have several decimal fields defined in the model like this:
min_inclusive = models.DecimalField(_('minimum inclusive'), max_digits=19,
decimal_places=10, help_text=_("Enter the minimum (inclusive) value for
this concept."), null=True, blank=True)
Via the admin interface when I enter a 0 (zero)
Tom,
Thanks for the quick response and explanation. Using adodbapi is not an
option in the environment we run in, but I am checking with the
django_pyodbc developers to see why decimal values are converted to float
prior to saving to the database.
On Sunday, December 8, 2013 11:16:56 AM UTC-
On 2013-12-08, at 7:18 AM, Derrick Jackson wrote:
> Thanks Vernon and Michael.
>
> I've done a little more research and at first I thought the problem was in
> django_pyodbc. However, running the following "%0.2f" % 3
> from the python console and it yields '2
Thanks Vernon and Michael.
I've done a little more research and at first I thought the problem was in
django_pyodbc. However, running the following "%0.2f" % 3
from the python console and it yields '2.00' and I don't
understand why the digit prior to the decimal
Derrick:
I just added your failing test pattern to the unit test for adodbapi, and
it works correctly. Therefore I would conclude that the problem is in
django-pyodbc, not in SQL Server itself.
Micheal and I maintain the other SQL server backend, sqlserver_ado, so I am
afraid that we can't be
Hi Michael,
I'm using django-pyodbc 0.10
On Friday, December 6, 2013 8:42:00 AM UTC-5, Michael Manfre wrote:
>
> Which database backend are you using to connect to SQL Server?
>
> Regards,
> Michael Manfre
>
> On Friday, December 6, 2013 6:45:30 AM UTC-5, Derrick Jackson wrote:
>>
>> Hello all,
>
Which database backend are you using to connect to SQL Server?
Regards,
Michael Manfre
On Friday, December 6, 2013 6:45:30 AM UTC-5, Derrick Jackson wrote:
>
> Hello all,
>
> I have a strange occurrence I'd like to share to see if any of you have
> run into the same thing. I am using Django 1.5
Hello all,
I have a strange occurrence I'd like to share to see if any of you have run
into the same thing. I am using Django 1.5.4, SQL Server 2008, and have
the following field definition in one of my models:
gift_value = models.DecimalField(max_digits=20, decimal_places=2,
verbose_name='Gift
Thanks Tom. This did the trick. Much appreciated.
On Sunday, August 25, 2013 5:47:00 AM UTC-4, Derrick Jackson wrote:
>
> Hi All,
>
> My Model has a DecimalField:
>
> amount = models.DecimalField(max_digits=19, decimal_places=2,
> verbose_name='Amount')
>
n %s
digits before the decimal point.')
The problem arises because the documentation seems incorrect for 1.5
(and trunk):
"""
The max_value and min_value error messages may contain
%(limit_value)s, which will be substituted by the appropriate limit.
"""
htt
imal_places key is being ignored. Has anyone seen this before?
> BTW, I am using Django 1.5.2
>
> On Sunday, August 25, 2013 5:47:00 AM UTC-4, Derrick Jackson wrote:
>>
>> Hi All,
>>
>> My Model has a DecimalField:
>>
>> amount = models.Decimal
using Django 1.5.2
On Sunday, August 25, 2013 5:47:00 AM UTC-4, Derrick Jackson wrote:
>
> Hi All,
>
> My Model has a DecimalField:
>
> amount = models.DecimalField(max_digits=19, decimal_places=2,
> verbose_name='Amount')
>
> My ModelForm has the
You're creating an entirely new DecimalField, rather than altering the error
messages of your existing field.
I think what you want is:
class YourForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(YourForm, self).__init__(*args, **kwargs)
self.fields[&q
Hi All,
My Model has a DecimalField:
amount = models.DecimalField(max_digits=19, decimal_places=2,
verbose_name='Amount')
My ModelForm has the following:
self.fields['amount'] = forms.DecimalField(error_messages={
'required': 'Amount is required
Possibly related to localisation. See:
https://groups.google.com/forum/?fromgroups#!topic/django-users/evJ7jg-YhdM
https://docs.djangoproject.com/en/dev/topics/i18n/formatting/
On Sunday, 19 May 2013 01:37:22 UTC+2, Pedro J. Aramburu wrote:
>
> I've been reviewing the code of *models.DecimalFiel
I've been reviewing the code of *models.DecimalField* and *
forms.DecimalField* because trailing zeros after the decimal point are
being removed in my forms. I didn't find anything suggesting that it's done
there, instead they are handled properly according to my needs. Although
the proper handl
What other integer fields are there in your model ?
On Thu, Sep 27, 2012 at 2:35 PM, Sergey Fursov wrote:
> As I see from the stack, error produced by book.save() in File
> "/var/opt/igp_acfs/acfs/bookproducts_manager.py", line 118 but in you
> code I can't this line of code. Do you really sh
As I see from the stack, error produced by book.save() in File
"/var/opt/igp_acfs/acfs/bookproducts_manager.py", line 118 but in you code
I can't this line of code. Do you really show the code, that related to
error
2012/9/27 Laxmikant Gurnalkar
> Hi ,
>
>While storing decimal values to da
Hi ,
While storing decimal values to database I have following error.
Exception in storeFormatMetadataTraceback (most recent call last):
File "/var/opt/igp_acfs/acfs/bookproducts_manager.py", line 118, in
storePricing
book.save()
File "/var/opt/igp_acfs/acfs/models.py", line 529, in s
/github.com/divio/django-shop/blob/master/shop/admin/mixins.py
>
> For your "2.1" problem, set decimal_places to 2 DecimalField.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django
: https://github.com/divio/django-shop/pull/146#issuecomment-4720340
and
here https://github.com/divio/django-shop/blob/master/shop/admin/mixins.py
For your "2.1" problem, set decimal_places to 2 DecimalField.
--
You received this message because you are subscribed to the Google Group
On 3/05/2012 2:30pm, orschiro wrote:
Anybody?
On May 2, 11:07 am, orschiro wrote:
I want to represent a price in my model in the form of 0,00. This is
the part of my model.
price = models.DecimalField(max_digits=5, decimal_places=2,
default=Decimal('0.00'))
However, prices such as 2.10 are s
Anybody?
On May 2, 11:07 am, orschiro wrote:
> I want to represent a price in my model in the form of 0,00. This is
> the part of my model.
>
> price = models.DecimalField(max_digits=5, decimal_places=2,
> default=Decimal('0.00'))
>
> However, prices such as 2.10 are still represented as 2.1.
>
>
I want to represent a price in my model in the form of 0,00. This is
the part of my model.
price = models.DecimalField(max_digits=5, decimal_places=2,
default=Decimal('0.00'))
However, prices such as 2.10 are still represented as 2.1.
The second issue would be to replace the . with a ,. However
Hi all
I know this is a bit of a corner case, but I was slightly surprised by
the behaviour of DecimalField with the value -0.0. Given the model:
class Word(models.Model):
word = models.CharField(max_length=50, unique=True)
number = models.DecimalField(max_digits=8, decimal_places=5
Dear Ian,
Am 04.04.2011 22:27, schrieb Ian:
Yes, this appears to be a bug. If you would, please create a ticket
for it in the Django Trac so that we don't forget about it.
Gladly:
http://code.djangoproject.com/ticket/15766
Best regards,
Carsten
--
Cafu - the open-source Game and Graphi
On Apr 4, 12:05 pm, Carsten Fuchs wrote:
> Is this a bug in Django?
> If not, is there a better solution to the problem than using
> isinstance() in every place where I have to compare DecimalField values?
> (I'm still quite new to Python, and might be overlooking something
&
Dear Django list,
using Django 1.3 with Python 2.6.5 on Ubuntu 10.04 and mod_wsgi, with
Oracle database, I've just experienced a case where the use of
select_related() changes the result type of a DecimalField in a related
object from decimal.Decimal to float (which in turn brea
Or change it to a CharField and do the string-to-decimal conversion
yourself. Javier's solution is better, though.
Franklin
On Tue, Jul 20, 2010 at 10:33 AM, Javier Guerra Giraldez
wrote:
> On Tue, Jul 20, 2010 at 9:10 AM, reduxdj wrote:
>> Users on my site can't type dollar signs without a for
Example, no, but you could create a custom field, based on the DecimalField,
which a custom validator that checks for and removes a leading dollar sign.
I think that django snippets has a good chance of having examples of "currency"
fields, and if not, Satchmo has one. Perhaps they do
On Tue, Jul 20, 2010 at 9:10 AM, reduxdj wrote:
> Users on my site can't type dollar signs without a form error showing.
> I'd rather allow them
> to type a dollar sign then clean it away after the fact? Can i see an
> example for this procedure please.
just put the $ sign on the field's label, t
Hi,
Users on my site can't type dollar signs without a form error showing.
I'd rather allow them
to type a dollar sign then clean it away after the fact? Can i see an
example for this procedure please.
Thanks,
Patrick
--
You received this message because you are subscribed to the Google Groups
I'm using Django 1.2.1 and it doesn't work any longer ;)
Just switched back to Django 1.2 and it works. But I think that's not
a solution.
Regards
Simon
On 6 Jul., 15:21, saboter wrote:
> I used the workaround in project that runs under django 1.2 and it
> looks good in admin even after repeated
er why the DateTimeField is localized by default and the
> DecimalField is not.
>
> Regards
> Simon
>
> On 5 Jul., 19:33, saboter wrote:
>
>
>
> > I have mixed models with admin in my example. Sorry.
>
> > It should be like this:
>
> > ### models.py
>
DateTimeField is localized by default and the
DecimalField is not.
Regards
Simon
On 5 Jul., 19:33, saboter wrote:
> I have mixed models with admin in my example. Sorry.
>
> It should be like this:
>
> ### models.py
> [...]
> class JobForm(ModelForm):
> def __init
gt; localized by default ...
>
> > On 4 Jul., 11:03, Simon Westphahl wrote:
>
> > > For clarification: The output in the admin list view is properly
> > > localized. Only the input doesn't work.
> > > I'm using Django 1.2.1 and a almost vanilla Dj
tphahl wrote:
>
>
>
> > For clarification: The output in the admin list view is properly
> > localized. Only the input doesn't work.
> > I'm using Django 1.2.1 and a almost vanilla Django project only with
> > this one test app installed.
>
> > On 3
ut in the admin list view is properly
> localized. Only the input doesn't work.
> I'm using Django 1.2.1 and a almost vanilla Django project only with
> this one test app installed.
>
> On 3 Jul., 22:07, Simon Westphahl wrote:
>
>
>
> > Hi,
>
> > I
plement a localized "DecimalField" but it doesn't seem to
> work. When entering a decimal number with a German decimal seperator
> ( , ) the admin interface tells me to "Enter a number". Is there some
> setting/middleware/etc. I overlooked?
>
> My "settings.
Hi,
I tried to implement a localized "DecimalField" but it doesn't seem to
work. When entering a decimal number with a German decimal seperator
( , ) the admin interface tells me to "Enter a number". Is there some
setting/middleware/etc. I overlooked?
My "se
decimal_places digits to
> the right of the decimal point, so you can only have up to five on the
> left.) Here you are trying to store a number that has six digits to the left
> of the decimal point, which won't fit in the DecimalField you have
> specified.
>
> Traceback (most r
Here you are trying to store a number that has six digits to the left
of the decimal point, which won't fit in the DecimalField you have
specified.
Traceback (most recent call last):
>
[traceback snipped]
> File "/usr/lib/python2.4/decimal.py", line 2267, in _raise_er
Hello Karen,
Thanks for your reply, i checked the code from the ticket and it was
indeed already changed in the current version.
The specs of the system i',m using are;
Python 2.4.3
Django 1.1.1 final
Database Postgresql
Interface postgresql_psycopg2
The problem i'm having is with the following
On Tue, May 11, 2010 at 9:49 AM, mendes.rich...@gmail.com <
mendes...@gmail.com> wrote:
> On our production server we are running the last official release
> 1.1.1,
> When i started uploading big decimal values i ran into trouble and
> came across a ticket which described the error.
>
> This was t
Hello Django Users,
On our production server we are running the last official release
1.1.1,
When i started uploading big decimal values i ran into trouble and
came across a ticket which described the error.
This was ticket 10692 and it was solved.
Unfortunately i couldn't track down which files
I am using DecimalField in django table for pricing. It works fine
sometimes but sometimes it throws an Pickle error (PicklingError:
Can't pickle : it's not the same object as decimal.Decimal).
I am importing decimal module in views also.
Have anyone encountered this issue? Can anyo
Hi there,
I need another decimalField / floatField format (',' instaed of '.')
I've found this:
http://groups.google.com/group/django-users/browse_thread/thread/9ff4db80932d334f
But I ask myself if there isn't a simpler method for such a common task.
(Like
So, I have a decimalfield that can be 3 different values. In my view,
I pass in a dictionary of values that contains the appropriate decimal
values as keys.
{% for item in booklist %}
{% for key, value in numvec.items %}
{{item.number}}
{% ifequals item.number value %}
{{value}}
{% endifequals
Hello,
I have the following field in my Order class:
payment = models.DecimalField("Payment Amount", max_digits=6,
decimal_places=2, blank=True, null=True)
As as example let's say I create a new Order and don't put anything in
the payment field. For some reason when I'm viewing Orders in the
Li
Do you know Satchmo's currency filter?
http://www.satchmoproject.com/trac/browser/trunk/satchmo/shop/templatetags/currency_filter.py?rev=195
Regards,
Mitja
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django u
On Sun, 2007-07-01 at 21:06 -0700, Ceschiatti wrote:
> Hi.
>
> Is it possible to change the DecimalField format so that it uses ","
> instead of "." for the decimal part separation?
Not at the moment, no.
Eventually we will format (and validate form input) base
Hi.
Is it possible to change the DecimalField format so that it uses ","
instead of "." for the decimal part separation?
[]s
Ceschiatti
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
&quo
OK, I wasn't really sure how to do this correctly, but I just filed
ticket #4486 ( http://code.djangoproject.com/ticket/4486 ) --
hopefully in a useful form!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django u
On 6/6/07, ringemup <[EMAIL PROTECTED]> wrote:
>
> > 1) This sounds like it could be a bug. If your model defines 2 decimal
> > places, my initial reaction is that the form should show 2 decimal
> > places by default.
>
> Well, I figured that with currency being such a common use, if it were
> a b
> 1) This sounds like it could be a bug. If your model defines 2 decimal
> places, my initial reaction is that the form should show 2 decimal
> places by default.
Well, I figured that with currency being such a common use, if it were
a bug it would already have been found and squashed. But mayb
On 6/6/07, ringemup <[EMAIL PROTECTED]> wrote:
>
> Hello again --
>
> I'm creating a form using form_for_model. The model in question has a
> decimal field with 2 decimal places. The form, however, is displaying
> the field with one decimal place. I've googled and poked through the
> tests, but
Hello again --
I'm creating a form using form_for_model. The model in question has a
decimal field with 2 decimal places. The form, however, is displaying
the field with one decimal place. I've googled and poked through the
tests, but I can't figure out how to override this without creating an
83 matches
Mail list logo