Nikki
But if any user send the mobile number using browser console (F12)
Nikki
How to validate that the user entered mobile
cj
How to validate that the user entered mobile
if you're using a Serializer (I hope you do) you can write the validate_<your_field> function for that
Nikki
Validate mobile number before storing into db
cj
Validate mobile number before storing into db
you can also use validators attribute on the model field definition
Nikki
thanks
Nikki
I will check
cj
try with request.FILES and be sure the form in your HTML file has enctype correctly set
S
If I am logged in as user1 all transactions should do with db1 and if user2 all transactions should be with db2. How can we achieve this? Db router will work? How to configure?
Not possible in Django , you have to use php bcz it point database based on domain,, with Django you have to use Django tenant and have to make you system multi-tenant.
S
It provides automatic db routes using db.connect command
S
Most of the system point database based on domain name,, domain name connects with schema and things works automatically
S
Django uses one db at a time but php can multiple,
cj
Django uses one db at a time but php can multiple,
Django can use multiple DBs at a time too
S
Read a full document bro
Rohan
User based DB?
Rohan
Why would you do that?
S
Main case is security and low cost of server
S
Services like this runs in one instance and one db so overall server cost is less and your data will remain isolated and secure from each other.
S
Don't need to setup new instance and db for new server set up.
S
When you sell your own project to different people/company then this is a good idea to follow
shivam
Django uses one db at a time but php can multiple,
We can use any many dbs we want in django.
S
How ??
S
We can use any many dbs we want in django.
Worked on any project like that ??
shivam
Yes. In our company we have our tech stack on django
shivam
You can define multiple dbs in settings. Py alongside default
shivam
And also give the dB name while running migrations
cj
Worked on any project like that ??
I do, we have like 4 projects here that uses more than 3 DBs to store things for different models of the same app
m0nte cr1st0
I need to help with celery
m0nte cr1st0
https://stackoverflow.com/questions/58629790/how-can-to-run-task-in-5-minutes-after-finish-previous-task-using-celery-beat/
S
How can you define that this request should go to this db only and another one in let's say second db??
m0nte cr1st0
How did you find that function a will take 5 mins ?
It's a parser, written on the selenium
S
Think you should read official document of celery
Raad
I have my app ready and now the time to fill the database by dummy data to test the app. What are the best practices for doing that? Any advices?
Raad
I mean populate the database
Vahe
Hi guys, Does any of you integrated drag and drop functionality in Django? For example I have kanban board and want to have some ajax updates when something is drag and droped from one cell to another. Any ideas?
cj
Are there any existing solutions which I can check?
maybe yes, you have to google, there must be a lot of JS libraries for that, on the Django side read about Django Rest Framework
Vahe
maybe yes, you have to google, there must be a lot of JS libraries for that, on the Django side read about Django Rest Framework
I just don't have any experience with Django Rest. Thinking about making it with Jquery/Ajax, but want to find some examples to base on them. Thanks for suggestions
Cesar
Hello, im working on a django project with normal templates (not api). i have som forms that should be on everypage, is there an easy way to have like a reusable package containing all forms i will be using on several pages?
Cesar
Try template extending
template extending would work on template side, i was talking about views part
Cesar
Read about contexts processors in Django, I think that is what you need.
i think this will work, when i get home will give it a try, Thanks
Anonymous
template extending would work on template side, i was talking about views part
You could create a View with your form in it and simply inherit it into the views u need
Денис
You could even combine decorators without need to subclass views from anything
Денис
but still all of your forms need a place in template. So you possibly need custom template tags also, like {% my_brilliant_form.as_p %}
Денис
as template tags have their own logic implemented, you don't need to change views.
Manuel
good afternoon for yall
Manuel
has any one of you got any way to connect an ldap with django
Manuel
is someone there
Денис
Денис
it's dark night here in Russia, for example
Cesar
has any one of you got any way to connect an ldap with django
Quick search in your *your favorite search engine* will give you libraries like django-auth-ldap ( https://django-auth-ldap.readthedocs.io/en/latest/ )
Anonymous
depends on what do you want to do
Expose a machine learning model?
None
Hello I use https://materializecss.com/modals.html. And I can't provide certain statement of context from view to html. def deny_order(request, order_pk): order = get_object_or_404(Order, pk=order_pk) context = { 'order':order, 'value':'123' } return TemplateResponse(request, 'my_html.html', context). Order displays nice but value returns - missing variable value
cj
Expose a machine learning model?
then, maybe flask is enough, just make an API
raven
anyone know how to serve media files with django gunicorn setup?
Maksim
Nginx
raven
cool
None
I have resolved that, thanks
Sam
I m not able to create my database
Sam
The makemigrations command runs and then when it comes to check for the class type it gives an error
Manuel
what's that error
R
can anyone help me with this: “OperationalError: attempt to write a readonly database”. now the problem is obvious but I am unsure what I am doing wrong to fix it. I have tried chmod, I have tried chown. But either I am using them incorrectly, or there is something else.
R
I am not working in root, I work in my user account. I made a group with root and ‘user’ and a chowned them to be owners of simpleSiteDB.sqlite3
R
I chmoded simpleSiteDB.sqlite3 to be 0755
R
other than that, I’m not sure what else there is to do
R
my site’s directory currently looks like this: drwxr-xr-x 3 root root 4096 Oct 31 15:51 apps drwxr-xr-x 2 root root 4096 Oct 31 15:51 login_registration -rwxr-xr-x 1 root root 816 Oct 5 15:11 manage.py -rw-r--r-- 1 root root 5336 Oct 5 15:11 readme.md -rw-r--r-- 1 root root 46 Oct 5 15:11 requirements.txt -rwxr-xr-x 1 root django 135168 Oct 5 15:11 simpleSiteDB.sqlite3