Bought
I'm developing a project that is quiz. In models i have a class Quiz with a field code, and to prevent a problems with a quizzes's codes, i created a class Code. How can i check that code is available?
Д
Bought
It's like in Kahoot.
Bought
Users use code to join a game.
Bought
one-to-one
Д
so there can be precisely one code per one quiz always
Д
if I know the code, there is a quiz waiting. if I start a quiz, I will have a code
Bought
It's not safe
Д
but that's what your Data Model suggests
Д
we don't care how you use it yet, whether there is logins etc. or not
Д
but there is probably so that if I have the code "UWU-ROLLOTASTIC" and that takes me to a My Little Pony -quiz, once that's Done, then I can use the "UWU-ROLLOTASTIC" code again to go do some other Quiz
Д
but as long as the My Little Pony quiz is still there, UWU-ROLLOTASTIC <=> My Little Pony
Bought
There are only SIX digits in code
Д
doesn't matter. the same principle applies regardless
Д
okay so
Bought
Okay, thanks.
Д
I'm trying to say this simply
Д
because for me this is already a solved problem but clearly we need to work
Д
you're going to need to make sure there is only one valid Code per Quiz
Д
sigh that's what you asked for didn't you
Bought
Ok, your idea is pretty cool
Д
you're going to need a relationship that binds together Quizzes and Codes
Д
then if a Quiz already has a code, or a code is already in use, then it can't be added to that relation again
Д
like, you pair them up on some kind of list
Д
then when the Quiz ends, you can delete that code, and that Quiz from that list
Д
but when somebody tries to start a new Quiz or use a new Code, you have to check against that list whether it's legal or not
Д
you can create a new Class for that
Д
something like class RunningQuiz
Enes
Д
@sanzh_py got it?
Bought
Yep, thanks
Д
Yep, thanks
your Quizzes don't even need the Code as a foreignkey
Д
only your RunningQuiz list does
Д
class RunningQuiz(model):
quiz = ForeignKey(Quiz)
code = ForeignKey(Code)
something like this
Д
if you really want the codes to be a Model (I don't know why they would need to be)
Sheraliyevich
django.core.exceptions.ImproperlyConfigured: 'django.db.backends.postgresql' isn't an available database backend or couldn't be imported. Check the above exception. To use one of the built-in backends, use 'django.db.backends.XXX', where XXX is one of:
'mysql', 'oracle', 'sqlite3'
help me please
how can i fix the error
Lugano
https://dpaste.org/UHaX
i came accross this error,can anyone help me fix it?
Akashi_web
Hello everyone, please tell me on django cms can I make an online store ?
p
Enes
Fylex
Hi, has anyone used the django-googledrive-storage library to connect to google drive, saving and viewing files.
I have already implemented OAuth 2.0 Playground and I have the clien_secrets.json from the google api. but i got your mistake.
Service account info was not in the expected format, missing fields client_email, token_uri.
Can someone help me.
Mallika kambala
Does anybody in this group knows how to execute python project using django
Vikash
Mallika kambala
No I don't know about it I have source code zip file
Vikash
Using pip install django in cmd
Vikash
if there is a requirments.txt file available then use pip install - r requirements.txt for download all dependency for regarding project
Happy days
I render the app b's HTML page from app a. But when I press the submit button, it searching the function in app a. How do we call the app b's function?
Vikash
check your funtion views.py file redirect the form after submit or not
☪️ جنت الفردوس
Is there any library in python(django) for contert docx to pdf
#docx_to_pdf
Bought
Hi everyone.
In model Quiz i have a field code, and in func "generate_code":
if code in instance.objects.all().values(code):
return generate_code(instance)
Is it correct? field code is a positive small integer field
Icecold Sensei
Д
Bought
How to write tests? I've seen this, but still don't know purpose of this
Icecold Sensei
Is there any library in python(django) for contert docx to pdf
#docx_to_pdf
from docx2pdf import convert
 # Converting docx present in the same folder
# as the python file
convert("django.docx")
# Converting docx specifying both the input
# and output paths
convert("django\GFG_1.docx", "Other_Folder\Mine.pdf")
# Notice that the output filename need not be
# the same as the docx
# Bulk Conversion
convert("django\")
Anonymous
Bought
But, what will happen if i won't use tests(just use a runserver?)
Icecold Sensei
Д
Bought
Icecold Sensei
I use Linux
Libre office changes docx files to odt, you can reconvert it by simply changing the odt to .docx
Д
Ok, gonna learn tests
testing is theoretically easy but it requires a lot of experience so that's why I'm telling you to start practicing
Bought
Can you recommend where i can learn tests, thanks
Bought
Д
Krushna
While running command:
heroku run python manage.py migrate
Getting following error:
SECRET_KEY not found. Declare it as envvar or define a default value.
(Using python-decouple to get SECRET_KEY and it worked in localhost but after deploying it to Heroku getting this.)
Any suggestion?
Д
Krushna
Д
Baqer
Hi guys
I want to know that Unique_together field use for what ? And when should i use it ?
Imdadhussain
Which act as composite. And it is used Whenever you want more than one field to have unique relation