Muflone
do you have an application called employee?
Muflone
don't confuse models with applications
S Sidharth
aravind
I need to integrate a qr code scaner in web application and scanig should be done by mobike camera
Felipe
python manage.py makemigrations employee
Do you have an app called employee and want to create a migration only for this app? Normally you can run only python manage.py makemigrations
Julio
Hi people, anyone knows how i can block a field in a model if another field is true?
Julio
or block the entire entry
Rajesh
I want to create employees module with crud operation
Rajesh
do you have an application called employee?
I'm little confused with app and module
Rajesh
Like other framework like php we can define controller model and view for a module like employees
Muflone
I'm little confused with app and module
a django project is made of apps each app has many models which are the tables for the data migrations are created for each model but the command to create them is python manage.py makemigrations (for all apps) or python manage.py makemigrations appname (for only the app called appname)
Muflone
each app lives in a folder
Fedor
Hi there! I have some problems with urls in DRF. I have two models: Dialog and Message. Message model has a ManyToOne relation to Dialog model. And i'm trying to organize urls like this way: api/dialogs/DIALOG_ID/messages/ api/dialogs/DIALOG_ID/messages/MESSAGE_ID I want to get all messages associated with dialog. How to do it?
Fedor
Viewsets
Amen
have you used routers
Amen
DRF DefaultRouter helps orgaize your endpoints
Fedor
I'm should check routers docs?
Amen
yea go through it
Amen
from rest_framework.routers import DefaultRouter router = DefaultRouter() router.register(r'message', MessageModelViewSet, basename='message-api')
Anonymous
I'm using postgres sql for deploying on heroku its giving error ,I searched on web but no resourse ` Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?`
Mirco
I'm using postgres sql for deploying on heroku its giving error ,I searched on web but no resourse ` Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?`
Looks like you don't have postgres add on up and running and I bet you have misconfigured settings about connecting to the right postgres address on Heroku
Anonymous
the add on is automatically added
Mirco
the add on is automatically added
Really ? I've always added by myself 😁 I don't remember it's automatic Anyway I think the real issue is about settings
cj
https://pastebin.com/xnQznmeX
DEBUG = True and SECRET_KEY hardcoded, nice 😈
cj
what is you website address again?
Mirco
😂
Anonymous
DEBUG = True and SECRET_KEY hardcoded, nice 😈
I read moz doc , I know its not a good practice but I just want to get it deployed and then make changes
Mirco
even I didn't knew but when I opened app it was there,what in setting ?
Anyway you need to handle better DATABASES Use the environment variable also for development
cj
I read moz doc , I know its not a good practice but I just want to get it deployed and then make changes
first, follow good practices, later you can think on deploying it (or not) 🤷🏻‍♂️
Mirco
And change the postgres url accordingly In Heroku is already set
cj
think on it about a blocker, if you're not following good practices, you should be forbidden on deploying anything
cj
Its my first time,I'll take care next time
no no no, no next time, do it right here, right now first fix your bad code, make sure to follow up good practices, then later we can talk about on helping you to deploy it (or not)
Anonymous
yess!! by next time I meant this
cj
yess!! by next time I meant this
ok, now start reading about 12-factor app and how to improve your Django settings following that
Ghorz
#tips Django modelform is helpful but for better form experience, I'll advice using pure html5 and JS to handle form at the front end.
cj
#tips Django modelform is helpful but for better form experience, I'll advice using pure html5 and JS to handle form at the front end.
I'll advise to use ModelForm and complement it with some JS/CSS at the front end to not re-invent the wheel 🤷🏻‍♂️ neither re-write by hand most of the code that Django gives you
cj
https://docs.djangoproject.com/en/3.0/topics/forms/formsets/
Ghorz
Ok
cj
Ok
didn't you know about them? 🤔
Ghorz
I do
Ghorz
I am more productive using JS at frontend
Ghorz
Especially when there is need to manipulate DOM by adding/deleting form input rows
cj
I am more productive using JS at frontend
if you're making a totally isolated front-end app (as a client) and Django for APIs, then yes... if you're using Django templates I don't see the point to rewrite and reinvent what Django gives you, just complementing it with some JS/CSS, no need to re-write everything 🤷🏻‍♂️
cj
Especially when there is need to manipulate DOM by adding/deleting form input rows
there comes the Formsets with a little help of JS, yes, but a little help, not to re-write all the <form> by hand
Anonymous
Hey there! Can anyone help me with latex in sympy and rendering the value in template?
Vlad
I can't get my static files to come up. I've tried various settings and directory configurations and so on, but they just turn up as 404s.
Muflone
I can't get my static files to come up. I've tried various settings and directory configurations and so on, but they just turn up as 404s.
Static files are not served by Django, there's nothing to configure in Django to make them work. You have to setup your webserver (Apache, nginx, caddy) to get them
Anonymous
after using set config its giving more ? more ? ... cannot exit this
Eng. FoDy
hi, please I want to show image without used '/media/' , my code is <img href="/media/{{user.photo}}">
Rainur
Hello! I am a student. I independently studied django, HTML, CSS, JS and now I want to take on orders for website development. Please tell me where to get orders?
Root
Hello i want to get 2 database data In html javascript
Root
How its possible
悪魔
Not Found: /news/Untitled.png django is searching my pictures in wrong direction. How can i fix it? Template looks like this: <h1>{{ n.title }}</h1> <h4>{{ n.date_published }}</h4> <img src="{{ n.picture }}">
Anonymous
I'm running into this error while deploying on heroku
Anonymous
`OperationalError at /login/ could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? `
Anonymous
I searched but nothing solved my problem
cj
I'm running into this error while deploying on heroku
haven't we talked about that earlier?
Anonymous
haven't we talked about that earlier?
I tried everything on web 😣
cj
I tried everything on web 😣
show your settings.py file, if you haven't fixed it, we won't help you
Anonymous
Okok
cj
https://pastebin.com/xnQznmeX
so you didn't read about 12-factor app, did you?
Anonymous
Yes form its website