Suraj
Need urgent help, facing issues with authentication... please
Doragonsureiyā
Doragonsureiyā
I defined everything but it's not able to authenticate user or admin in the login page. But from admin console login is happening
Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain:
- what you're doing
- what you're expecting
- what you're using
- where you're running the script
- what Python version you're using
- what packages and their versions you're using
- and the most important thing: show the code YOU wrote (read rule 5️⃣ for that)
and more details, that way your chances to get help will increase
Suraj
I have created a basic authentication system using django, running in vscode, 3.10.2
Without pictures, how can I show my code
Doragonsureiyā
Suraj
Ok, I'm trying now
Suraj
https://linkode.org/#aGFPnBkrADbI5qtf0pk5G7
Suraj
views.py
Д
Suraj
Please suggest how to solve this issue
Suraj
Suraj
Д
No such errors
well figure out what function is not doing what it's supposed to
Д
how the hell am I supposed to debug that from here
Suraj
Okay
Николай
👋hi. Help pls.
I need create a new field in a queryset, and I calculate this field in my custom function. I need put values from several fields of object in function, calculate and return in a new field.
I can't make annotate work with my custom function 😭
Georgiy
Okay
Response pls if you find the solution. Im new to this and it is interesting
Suraj
o
I have one problem any one can help me
Doragonsureiyā
I have one problem any one can help me
Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain:
- what you're doing
- what you're expecting
- what you're using
- where you're running the script
- what Python version you're using
- what packages and their versions you're using
- and the most important thing: show the code YOU wrote (read rule 5️⃣ for that)
and more details, that way your chances to get help will increase
Georgiy
kam
How to share django-pytest database state (e.g. share created testing db objects) during the test and share between different test files?
scope = 'session' autouse =True not working for other test files
Suraj
https://linkode.org/#I8M9j9WtlAh0GqQUtyM9Z4
Д
Suraj
My issue got resolved, it was an issue with the post method because it was in main and not in form
Suraj
I would like to thank people who responded and tried to help me
Д
kam
Д
I mean I'm writing unittest.TestCases but then running them with pytest. I think that might be what's meant by using pytest?
Д
Д
I just gave you a proposal on how to share the DB between multiple modules\submodules — also I'm not 100% sure if you SHOULD be doing that
Д
you want to share the setup\teardown code that - but not necessarily the DB since the DB is state and state shouldn't really be kept between tests
kam
Д
Ali
guys
i deployed my project on python anywhere
but when i tried to open it
this error is shown("no such table ...")
even though there is a table
Ali
what can i do?
Д
Д
do you want me to predict what the problem is
Д
the problem is: production has different names for Tables than dev OR the migrations were never properly run
Suraj
What's the reason - both worked-please check the code in the link-
Suraj
https://linkode.org/#vPOfrxC5vl4XAW01FsmrA
Ali
protip: follow the error message
File "/home/syy/env/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 477, in execute
return Database.Cursor.execute(self, query, params)
Ali
i am using sqlite
Ali
can this be the problem?
Saadi
Hello!
I have a react registration and Login form. Without using django rest framework, how i can make class based views in django to register user and login.
Anyone have source code on this or any good solution?
Vikash
Saadi https://learndjango.com/tutorials/django-signup-tutorial
Charly
Tao
I've been operating on a data.json file as my "database" and am now trying to import it into a real database. I *think* the best way of doing that is with the native JSONField type but am returning errors with the following code:
import json
from importlib import resources
with resources.open_text("little_bits_of_buddha", "data.json") as json_file:
data = json.load(json_file)
from django.db import models
class Collection(models.Model):
models.JSONField(data)
which returns RuntimeError: Model class __main__.Collection doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
I do have my app named main in settings.py:
INSTALLED_APPS = [
"main.apps.MainConfig",
What am I doing wrong?
Saadi
W3
IntegrityError at /reading/add-info/
null value in column "user_id" violates not-null constraint
DETAIL: Failing row contains (20, title, hello, 2022-04-07 18:03:25+00, apt, null). HELP ME PLEASE
Andrej
Andrej
The user_id is not set.
W3
W3
Anonymous
Guys, can I have multiple Primary Keys and multiple Foreign Keys?
Charly
Fan / Ac
Yes
In sql a table can only have one primary key
Charly
Georgiy
Guys, can I have multiple Primary Keys and multiple Foreign Keys?
Primary key is a thing that makes unique certain record in your table. Relational database should have 1 PK in table. Im not sure how it works in django but you can even create compositive pk, which takes some attributes (not one) in order to make a record unique
Anonymous
A
Anonymous
Guys, when doing global templates structure, is it the right way to attach the templates folder in settings.py?:
DIRS = [BASE_DIR / "templates"]
Rafaela
anyone wanna code with me? too bored to code alone :(
Santosh Reddy
pikachu
hello,I have a django JSONField(django.db.models) model, that has some data like this [{'k':[1,2]},{'k':[2,3]}], how can i search 2 in data use django orm ?
Doragonsureiyā
EDEN
How to change db sqllite to postgres
Doragonsureiyā
How to change db sqllite to postgres
These single steps will help you a lot:
Step 1️⃣: Open a browser
Step 2️⃣: Write down https://google.com or https://duck.com and press Enter
Step 3️⃣: In the search box, write down the same words you asked here
Step 4️⃣: Read the first results
NNB
How to change db sqllite to postgres
Same place ,comment the dB sqllite, add postgress parameters (assuming you have the dB before hand) make sure the port is postgress .
All this is available on Google
EDEN