Anonymous
solved
_dvd
I need to set some constraints on my model concerning more fields at once. I've read from the docs that there's Model.clean() function for that purpose. But from what I've understood, that isn't called when performing save() method. It' is used only in the form validation. Since I'm using django only for backend and I have no forms, would Model.clean() be in any way useful to my purpose? The alternative is to use CheckConstraint, but they're a little cumbersome when they involves more than one field
Shubham
Anonymous
Hello, I am creating a sms sender application where the users are given two options to choose Free and premium. If a user chooses Free then he is allowed to send only 5 SMS, but as for the premium members, there is no such restrictions (unlimited).
So, in models.py I am accepting fields such as phn numbers. I am trying to save the phone numbers as phn no 1, phn no 2.... but as the numbers are unlimited how to save that in the model? Actually I am trying to parse the user input and save it as fields in models.py How is it possible?
Another question is that, I am trying to design my template in a way, after input a number there will be a plus button to add another number. How to handle that data in views.py.
Hope, I am able to describe my problem clearly. If not, please ask me to clear it.
Compro
Anonymous
Hi I am using django framework and while running the app I am getting error did you activate your virtual environment?Please resolve this query.
Anonymous
show the pic of the error
Sh
Hello guys.
I have a model and on that model I have changed the coloumn to number = IntegerFIled(unique=true,primary_key=true) when I migate it gives me error:
django.db.utils.ProgrammingError: column "id" of relation "branch" does not exist
Deepak
TemplateDoesNotExist at /
accounts/base.html
Deepak
templates inside the app
Deepak
i dont know why is it error
Deepak
templates->accounts->base.html
Nayan
Anyone can help me with django filter , i want to filter foreign key from different model ?
Anonymous
templates inside the app
As far as I know your templates should not be in the app rather they should be outside where all your app folders are located
Ex:
If your project is xyz
xyz
| App 1
| App 2
| Templates
|| App 1
|||whatever.html
|| App 2
| Xyz
||Settings.py
Qwerty
How do I run python script in Django shell using exec()
Deepak
no its in app
Qwerty
Deepak
project is mysite and app name is site. templates are in site
Anonymous
Deepak
do i need to mention app name inside the installed apps
Deepak
because last time i did not mention the app name then it was working fine
Anonymous
Deepak
damn...
Deepak
yeah it is
Deepak
oops
Anonymous
Your TEMPLATES list in setting what does the 'DIRS' contain?
Deepak
how to pass js in html. let's say there is two file one is js and other is Html. I want to pass an event in href tag that href tag route to the CSS.
Deepak
Anonymous
Deepak
😂
Shreehari
Has anyone built a chat application with backend as drf and react native in the frontend or if you have any reference please share it.
~~~
How to change timezone?
Mirco
~~~
settings
Changed...i changed the timezone but not working...did i need to do any other changes...
McLean
guys help on this error
McLean
Dir exists:False
file don't exist ,run as root
Traceback (most recent call last):
File "main.py", line 31, in <module>
main()
File "main.py", line 27, in main
checkpath(pathname)
File "main.py", line 22, in checkpath
shutil.copy(src ,'/etc')
File "/usr/lib/python3.8/shutil.py", line 415, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/usr/lib/python3.8/shutil.py", line 261, in copyfile
with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
IsADirectoryError: [Errno 21] Is a directory: '/home/mclean/Documents/code/C.O.D.E/src'
McLean
code👇👇👇👇👇👇👇
McLean
#!/usr/bin/env python
import os
from os import path
import shutil
import os.path
def main():
print ("Dir exists:"+str(path.exists('/etc/C.O.D.E/src/codetool')))
#file_name = path.exists('/etc/C.O.D.E/src/codetool/manage.py')
dir_name = path.exists('/etc/C.O.D.E/src/codetool')
if dir_name == False:
print ("file don't exist ,run as root")
def checkpath(pathname):
if path.exists(pathname):
src = path.realpath(pathname)
#head, tail = path.split(src)
#dst = src + ".py"
shutil.copy(src ,'/etc')
pathname = os.getcwd()
checkpath(pathname)
if name== "main":
main()
if path.exists('/etc/codetool')== True:
os.system('os.chdir("/etc/C.0.D.E/src/codetool/manage.py")')
os.system('python3 /etc/codetool/manage.py runserver')
AM
Is it possible to restrict download of a video in a website like hotstar, without using 3rd party. If yes how to do it in django
Joshua
http://djangoafrica.com/topic/view/building-resilience-with-robots-in-a-post-covid-industrial-world/
New Django Forum Content: Building resilience with robots in a post-Covid industrial world. Check it out!
Alberto
"User already exist" Custom Django Authentication Backend - Stack Overflow
https://stackoverflow.com/questions/63135433/user-already-exist-custom-django-authentication-backend?r=SearchResults
Anonymous
hi guy's
i have using with django channels
when i runing server i getting this error :
ModuleNotFoundError: No module named 'asgiref.sync'
I tried to install it but got this error :
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://pypi.org/simple/asgiref-sync/
Darth✧
AM
^_^
Hi everyone.
I’m building a django blog but after coding the urls.py for the details page. First post item returns an error that the current path detail/1/ didn’t match any of these
Anonymous
There will be a problem on your views
AKASH
Detail error
Anonymous
how to make favourite post in django please help any buddy
AKASH
Use javascript
AKASH
And cookies
AKASH
To store data
Maxim
Prantik
Can anyone suggest a free bakery website template link?
Anonymous
Jamil
Hey guys, I understand that ModelViewset comes with actions already inbuilt, but what is the difference between genericviewset vs viewset itself?
Anonymous
django drf
Anonymous
i m. getting unsupported media type error
Anonymous
when trying to upload file
Дауран
Check your urls file
Дауран
And view
Дауран
You had better use ninja shablon
^_^
Дауран
I'm used to that version
sarang
and also check whthere u add those id in views too
5P34R
Any better platform to learn django channels??
Priyanshu
Guys I need to build a web app
like this site www.doubtnut.com
it is an E-Learning site in which there will be video solutions for any questions for students up to class 12th.
But I don't know Django only know Python, Html and I need to build this by 31st Jul is this possible somehow or should I give up?
Commodity
Is there a way to implement webrtc in django?
Commodity
5P34R
Commodity
Commodity
You can checkout this video
Commodity
It's pretty good