Д
I change the field to uniqe and duplicate values are not saved. I wanted to see if there is another solution?
if a field is Unique, it means it's Unique in the whole Relation for the whole DB. that means no two users can ever share that value. if your field can have 3 values, that means there can be a total of 3 entries in that Relation — unless you make it somehow restricted to Unique by also something else
Д
No
where is that code coming from
Д
No
your original question was so non-specific that it's impossible to answer.
Д
you have an import error. Ok. then what?
Rohit
your original question was so non-specific that it's impossible to answer.
This is already made project by someone and my task to do it working
Mohammad
is this solution 100% correct?
100% No but its work and duplicated value not saved. But I want to do something so that the value of that field does not show again until it is saved in database
Rohit
did they leave you instructions
No, they only gave me the project folder
Д
No, they only gave me the project folder
maybe you need to run an older version of python or some libraries
Rohit
Hmm
Д
No, they only gave me the project folder
did it come with a file called requirements.txt
Rohit
No
Rohit
He also forgot about project because this project made in 2020-21
Д
He also forgot about project because this project made in 2020-21
you need to duplicate the setup they used to have it working with. there have been many new versions of many things since then. do you know the precise environment where they were running it in?
Rohit
Yes i think i have to install older version of sklearn
Д
Yes
you can write pip freeze and you will get the precise list of all the packages WITH version numbers — you can then pip freeze >> requirements.txt redirect (Copy) that into a file called requirements.txt to your new environment and re-install the same precise versions with pip install -r requirements.txt
Д
But i have to run this command on the system where the project is running perfectly
well, the pip freeze will give you every single packet that has ever been installed in the environment, whether it's relevant or not
Д
so if there are packets that are not important, just remove them
Д
or remove the version number from there.
Rohit
Okay got it I'll try
Rohit
Thank you 😊
Д
Okay got it I'll try
many packets have been upgraded for a good reason too so you might not want to install the old versions but some have to be the old ones, so
Rohit
import sklearn.neighbors.typedefs ModuleNotFoundError: No module named 'sklearn.neighbors.typedefs' Can you please solve this error in django?
I remove the word typedefs and error is not showing but i got new error conn = _connect(dsn, connection_factory=connection_factory, **kwasync) psycopg2.OperationalError: connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061) Is the server running on that host and accepting TCP/IP connections? connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (0x0000274D/10061) Is the server running on that host and accepting TCP/IP connections?
Д
there is no PostgreSQL database running on your localhost.
Д
basically your settings.py needs to be changed for django to not connect there, or you need to setup a database with those parameters. easier to revert to the default.
Д
In settings.py there is database with all parameters
yes; that's the thing that's causing the error. it's trying to connect to a non-existent database.
Rohit
Then i have to create new database?
Д
Then i have to create new database?
that would be enough if you had the system running. you also need to install the database system. it's easier to let django do that for you, by letting it manage an SQLite database.
Rohit
Can i use the old database?
swapna
Hi,I am trying to read an excel file from a folder.This folder contains few other folders.And showing error "badzipfile: file is not a zip file" Appreciate any help to resolve this.
Д
Can i use the old database?
okay first you need to decide what kind of DB you will be even running
Д
That is i know
just replace the DATABASE with DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'mydatabase', } } for now
Д
give it the same name as in your code
Rohit
Same error
Д
Not working
shouldn't be. - not precisely the same at least
Rohit
Can you please help me using anydesk ? It will great help for me
Д
Not working
anyway, you have to apply what local working knowledge you have. I don't even know what file that is coming from, or what kind of architecture your system has. that's a DB connection error and psycopg2 is a DB driver
Д
sorry no, I'm not doing remote stuff
Rohit
Ok
Rohit
I am trying to solve this error last 15 days that's why i told you 😅
Д
if you can't figure out how to configure your database with Django, maybe you shouldn't be doing this
Д
that's like Step 1
Rohit
this is a NEW error
There are many error in project and it is solve and arrive
Rohit
Thank you
iNeedHighMove
Hello guys I have 2 models model Track(models.Model): name = models.CharField(.....) ...... model PlayList(models.Model): songs = models.ManyToMany(Track) ...... How can I get Track objects from an specific Playlist?
Prosto
if your server is on the other side of the world, even that could cause it
we both in EU. For now after exploring all of this i will try to change bd from postgresql(which is installed on same instance) to SQLite. will kill postgress process totally. There is also apache solr, as a search indexer on same instance)) I was start thinking its about 1 core for all of this, but when site loading cpu is on 20% max... Kinda dont know really what else can I do
Ahmed
Guys excuse me why django is hard to learn
Cabrel Tchomte
How hard? 🤔
Cabrel Tchomte
Be more Clair
Ahmed
Ok
Ahmed
Many files and many folders and many import
Cabrel Tchomte
Many files in Django, did you other Framawork? Like Laravel for example ? 🤔
Д
Bad tutorials or teaching will make it difficult
Ahmed
How guys ? guide me
Ahmed
Give me tutorials good please
Doragonsureiyā
Give me tutorials good please
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
αмiʀ⁦⁦⁦⁦
Guys excuse me why django is hard to learn
If you know python and know oop so well It's actually so much easy So much
Anonymous
Guys, which is better Relational or Non-relational databases? Which one do you use?
Luis
Hello guys, im trying to pass request parameter to a method, but keeps saying that im missing the request argument: def add(request): if request.method == "POST": return redirect('/')
Luis
im passing the parameter using the url patter
Luis
path('', payments.views.index.IndexView.add(HttpRequest.method))
Luis
im not sure how to pass the request parameter
Luis
is it?
Luis
show the full code of your class
def add(request): if request.method == "POST": form = TransactionForm(request.POST) if form.is_valid(): try: form.save() return redirect('/') except: pass