RKumar
Hi can any one help me to create my app in Django
First you create project then create app
Kudakwashe
can anyone help on deploying django project
Uday
Ya I have but am confused how to align flow like function,api
Bunty chhatri wala..
I am using handelar_400
Check hyperlinks also
Bestin
Hi, Can anyone help me with something. I want to add a button in a form ( in django admin page ) which redirect the user to another page loaded from static template, and after user select something from that page it should redirect back to the original django admin form to complete the rest of the form. Is there any way to do this ?
Bestin
use urls
Is there any other way.. because the url changes to situation like 'add' or 'change'. So....
Mirco
study a bit of database theory before Django
Dev
hi fellas, i have a wallet field which uses a DecimalField for storing btc value wallet = models.DecimalField(decimal_places=8, max_digits=8, blank=True, null=True, default=0) I just realized that when the wallet's value becomes 1.xxxxxx it throws an error
Devo
Here
Dev
since its for financial stuff that's why i decided to use DecimalField
Dev
```Traceback (most recent call last): File "/usr/lib/python3.6/code.py", line 91, in runcode exec(code, self.locals) File "<console>", line 1, in <module> File "/home/mcroni/mybitstoreenv/lib/python3.6/site-packages/django/db/models/query.py", line 752, in update rows = query.get_compiler(self.db).execute_sql(CURSOR) File "/home/mcroni/mybitstoreenv/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1492, in execute_sql cursor = super().execute_sql(result_type) File "/home/mcroni/mybitstoreenv/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1131, in execute_sql sql, params = self.as_sql() File "/home/mcroni/mybitstoreenv/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1458, in as_sql val = field.get_db_prep_save(val, connection=self.connection) File "/home/mcroni/mybitstoreenv/lib/python3.6/site-packages/django/db/models/fields/__init__.py", line 1510, in get_db_prep_save return connection.ops.adapt_decimalfield_value(self.to_python(value), self.max_digits, self.decimal_places) File "/home/mcroni/mybitstoreenv/lib/python3.6/site-packages/django/db/backends/base/operations.py", line 517, in adapt_decimalfield_value return utils.format_number(value, max_digits, decimal_places) File "/home/mcroni/mybitstoreenv/lib/python3.6/site-packages/django/db/backends/utils.py", line 238, in format_number value = value.quantize(decimal.Decimal(1).scaleb(-decimal_places), context=context) decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>] ```
Devo
So here you are trying to post a char value in decimal field
Dev
even if i post a DecimalField it throws the same error
Dev
Profile.objects.filter(username="don").update(wallet=Decimal(1.00000000))
Mirco
Profile.objects.filter(username="don").update(wallet=Decimal(1.00000000))
max digits 8 and decimal place 8 but you have more than eight digits in this example
Dev
even making it a 7 digits causes the same issues
Devo
try to give only Decimal(1)
Dev
once the figure starts with 1 it will throw the error
Mirco
even making it a 7 digits causes the same issues
have u tried with Decimal("1.000") ?
Devo
Here
Dev
Change the max_digits
to what please, bitcoin's conventional decimal places are 8
Mirco
yeah
the same ?
Dev
the same ?
yes please
Devo
wallet = models.DecimalField(decimal_places=8, blank=True, null=True, default=0)
Devo
wallet = models.DecimalField(decimal_places=8, max_digits=25, blank=True, null=True, default=0)
Devo
Or try this
Dev
btw when i try to update using the admin i get this error Ensure that there are no more than 0 digits before the decimal point.
Dev
anything that begins with 1
Dev
lol yeah please
Mirco
lol yeah please
The mantissa must fit in the max_digits; The decimal places should be less than decimal_places; And according to the DecimalValidator : the number of whole digits should not be greater than max_digits - decimal_places; the 3 rules are these ones
Dev
so if i what to have something like 1.xxxxxxxx to 8 decimal places and also support 0.xxxxxxxx to 8 decimal places can u suggest what i should use
Dev
eg. models.DecimalField(decimal_places=x,max_digits=x) ?
Mirco
eg. models.DecimalField(decimal_places=x,max_digits=x) ?
so if BTC has max decimal places to 8 you should set at least 9 as decimal places
Dev
ok
Dev
and maintain the max_digits at 8?
Sid
Please help I deployed my website in a shared hosting but : 1) Site is rendering only two or three static images in the webpage rest of the images aren't rendered (all static images are in same directory) 2) To solve the problem I destroy the python app and redeployed with same steps but now the even the css and js files aren't rendering 3) Not only that django's inbuilt admin panel is also not rendering with default css
Dev
so if BTC has max decimal places to 8 you should set at least 9 as decimal places
cc.Profile.wallet: (fields.E134) 'max_digits' must be greater or equal to 'decimal_places'.
~:$
Good to use CharField in case of DecimalField
What is the reason behind it? You have to call decimal conversion before any calculations and for storing back to database you have to convert to string. Please share your knowledge. Thank you.
Dev
models.DecimalField(max_digits=16, decimal_places=8, default=Decimal(0))
Dev
solved thanks
Dev
i honestly didnt see the reason to use a Char
Sunny
Anyone have django project
Anonymous
Anyone have django project
Which type of project you want?
Sunny
Web application
Sunny
Related project
Sunny
I mean college software management system likes as
Doragonsureiyā
I mean college software management system likes as
Rules: @PythonRules Resources: @PythonRes Offtopic group: @PythonOfftopic
Sunny
Source code and documentation
Sunny
With abstract
Sunny
Any one send me pls
NoOne
template <img style="float:right; max-width:50%;" src="{% url 'ads:ad_picture' ad.id %}" > Browser <img style="float:right; max-width:50%;" src="/ads/ad_picture/12" alt="img" ee5qd8vi6> extra text is added to the img tag and image is not rendering
sam
hello my friends. i want to implement a microservice with django but don't know how to authenticate users from another service. can you help me?
sam
hello my friends. i want to implement a microservice with django but don't know how to authenticate users from another service. can you help me?
i get token by requests from users microservice. how should i protect my routes and restrict user by role?
Doragonsureiyā
no
Why? Seriously... Why? 🤔
sam
Why? Seriously... Why? 🤔
im new to django. i cant undestand that document. 😬
Maxim
im new to django. i cant undestand that document. 😬
how does this justify not even trying to read the table of contents of the official documentation?
sam
i'm reading that right now
Piyush
Can anyone tell me how to override the django allauth template.?
Rakesh
Hello, I need some help guys, I want to connect multiple database with single application dynamically, Meaning If I provide the details of DB like user password db name port etc, from front end it it will connect and I execute the sql query to display the data from that db
Rakesh
Please help me 🙏🙏🙏
Maxim
im new to django. i cant undestand that document. 😬
sorry - I didn't read the second part of your message I can only add that it is quite bold to meddle in such complex topics for a beginner
Doragonsureiyā
Please help me 🙏🙏🙏
Maybe anyone is here, yes, but they are not obliged to read everyone's message here neither to reply to everyone's message, if someone wants to reply to your message, they will do that, just don't try to draw attention to your message writing "anyone?" every 5 minutes, that will lead you to be warned for SPAM/Flood, just be patient or use Google/DuckDuckGo to research about your question instead of wasting time here waiting for people to do your work. Have a nice day 😊
Maxim
that's ok. can you help me or give a link that describes auth middleware implementation?
if you know what it is, then apparently you saw it in the documentation - there are usually examples
Maxim
it just simply says override authenticate()
first you need to decide how to act - there are many options your main problem is that no one except you can do it right so you will have to at least superficially familiarize yourself with all the possibilities, then decide what is supposedly more suitable - but do not rush - this will not necessarily be the final decision - perhaps in trying to implement it you will understand that it is actually not very suitable it's a hard path, but most likely you will have to go through it