Sheshadri
I guys can you help me... i am sending data through ajax from my template using get method and also i seen the data in console but can’t receive the data in views
in your views .. use get or post depending on your ajax type: def get(self, request): # <view logic> return HttpResponse('result')
L
Hey everyone, let's say I'm a teacher and I have a checklist for all my students to finish (read chapter 1 of book A, read chapter 1&2 of book B, and so). It should look the same for all students, but once it's finished, the individual student should be able to click on an html/css checkbox. So every students only see as checked the checboxes they've checked themselves. I've already figured out that, if I implement these tasks in a table named let's say 'Task', there should be a column that says who already finished such task (let's call it 'finished_by'), therefore there should be a many-to-many relationship linked to the django User table (which in exchange will need a 'tasks_completed' column which of course is automatically made by django when we use the 'model.ManyToMantField()' in our Task model). That's how far I've figured things out. Can anyone help me with possible next steps? Thanks in advance.
Sweetie
i guess when user accesses your webpage redirect them to login page and make index view @login_required
This way I have to do login_redquired decorator on all my views individually otherwise user can view pages by entering the link directly Since all my views should need login I am looking for a simple solution with adding decorators for each view.
Muflone
Check your quotes
gamer_boy
hi guys i am facing problem in POST method it showing me " MultiValueDictKeyError at /quiz/2/11/ 'choice'"
gamer_boy
this is my view def question_detail(request,question_id,quiz_id): q = Quiz.objects.get(pk=quiz_id) que = q.question_set.get(pk=question_id) count = q.question_set.count() selected_choice = que.answer_set.get(pk=request.POST['choice']) if selected_choice is True: try: come = que.rank came = come + 1 later_question = q.question_set.get(rank=came) except: came = come later_question = q.question_set.get(rank=came) return render(request, 'app/question_detail.html', {'que': que, 'later_question': later_question, 'count': count}) else: return redirect('quiz/')
gamer_boy
please help
Murad
Hi guys! Tell me who knows, I have 3 models - "User", "Project" and "Statement". * The project has a connection with the user, that is, when the user logs in through his profile and creates the project, this project is immediately attached to it. It is already there. * When a new project was created, a table(Statement) for goods should be created, which in turn should be tied to a new project. ? But the loss is how the new "Statement(table)" can be tied to this project, given the fact that they are being processed separately. How is this best done? (Links: User <- Project <- Statement)
Nitish
i am writing a custom model to use phone number as a username when i am registering get_user_model it is giving an error TyepError: 'function' object is not iterable
Nitish
please help me
Nitish
i am writing a custom model to use phone number as a username when i am registering get_user_model it is giving an error TyepError: 'function' object is not iterable please help me
Nitish
here is my code please check
Felipe
Hey guys, it's possible to have a queryset order by one column and with a sub order by another column? Like places in a country. I want to order them by state and inside each state order by city
Anonymous
https://www.youtube.com/channel/UCxxPBCkto7W8MX6TMctgLqw
Anonymous
They have some helpful error solutions it helped me
Felipe
Am not sure but such thing could be archieved by calling order_by() twice on the queryset
Thx, I found this answer and I'm doing some tests. I think it will work
Felipe
https://stackoverflow.com/questions/51483763/django-order-by-multiple-fields-and-with-prioritisation/51483793
Nadir
Hi, i need to connect two existing mysql db to one app. With one default db there's no problem but i can't connect another. Can someone help me? Thanx
Anonymous
hii anybody add slug field in these project files it is awarded 5$ filename is thesite.rar it can generate number of url
Anonymous
Best way to embed youtube where user can insert from admin
Doragonsureiyā
Best way to embed youtube where user can insert from admin
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 firsts results
Anonymous
No I know how to do it Urlfield() But I have some confusion
Leonardo
https://pastebin.com/beAKVv7V
Leonardo
someone know how to solve this?
Leonardo
im trying to make a put followed by post, but i can't even get the instance
Leonardo
in my other project this works fine
SG
How to display foreign key value in django admin site ?
Mirco
How to display foreign key value in django admin site ?
Django does it automatically if you add a str into your model
Daro
hi am using django with w3.css, but the effect of highlight the input when selected(that is default on w3.css) does not work
Daro
any ideas?
Gil
any ideas?
Specify is your own frontend, or django admin? Think that css is about browser task
SG
Django does it automatically if you add a str into your model
I see that but in both model i need to show different values so
Gil
own frontend
For django part, only check if its correcty loaded in browser, have you check inspector if css is download from nework? no errors... Out of loading this file, is not django work, nor this channel interest
Anonymous
There is someway to restrict access to all urls belong to some app
Ali
trying to add environment var to my code and os.environ.get('PASS') keeps returning none python3.6 on linux(centos7)
Ali
better to python channel, maybe not executed correctly
export PASS=password and am getting it by os.environ.get('PASS')
Ivan
Hi guys. I have problems with date localization in Django Rest Framework https://dpaste.org/BzSL Why field updated_at return April instead Апрель? P.S. Sory for my bad english.
Ivan
yes, i can paste full config.
Ivan
Added middleware in setting.py?
https://dpaste.org/9GqP
Salohiddin Yoqubov
How can I fix this?
Salohiddin Yoqubov
After i called Templatetags https://dpaste.org/QYXy How to fix?
Damron
Hi! I wanna to include google map rendering to admin page by using change_form_template in ModelAdmin: {% extends 'admin/change_form.html' %} {% block field_sets %} {% for fieldset in adminform %} {% include "admin/includes/fieldset.html" %} {% endfor %} <div id="map"></div> <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBwm4q2hasHV5pnexuZMdy5RvIwmb6Kr20&callback=initMap"> </script> {% endblock %} If I'd like to append smth like vutton - t works But doesnt want to render, there are no errors in JS console
Anonymous
Hi everyone, do you know how to create plugins in django cms?
Александр
Hello everyone - How can i split output? For example - in array i Have 10 items, but want show them 4 per row {% for cur_video_dict in videos %} <td><p> some__info </p></td> {% endfor %}
Anonymous
Django - iterate number in for loop of a template - Stack Overflow https://stackoverflow.com/questions/11481499/django-iterate-number-in-for-loop-of-a-template
Александр
👆
Thanks!
Anonymous
😊
Anonymous
Hello everyone) I need help with Django sessions, I don't quite understand the algorithm for interacting with a site user under standard settings (the standard settings are specified in middleware and installed apps, nothing more). There is a table in Postgresql, where the information processed during the post request from the user is saved, and the DB also has a django.sessions table, where the user's session is saved. Here are the questions: whether any data is sent to the user and stored for further identification under the standard settings described above, and if so, how to implement the scheme: comparison of the saved cookies (or any other data) with the session in the database and if they match-give him the processed information from the database, which he sent in the post request above (that is, here as I understand it is necessary to somehow confuse the session with the fields of the model with the saved data). Thank you in advance for your help!
Yash
I am building a web app using django, opencv and reactJs. I want to capture video using openCV and display it to the frontend. Anyone knows how can it be done?
Roman
Hi guys
Roman
What auth system does django user use by default? ( So I can use the auth for calling some endpoints from a script)
Poring
Bello, django form save datetime distinción to now
Poring
?
Vinayak
I am building a web app using django, opencv and reactJs. I want to capture video using openCV and display it to the frontend. Anyone knows how can it be done?
If you use opencv in views.py application can only by your system. Better to use canvas and javascript native api to capture the image
Anonymous
Hello guys, I've two questions - what is better FBV or CBV? Opinions about that, what option is more flexible, customizable, anything 🤷🏻‍♂ - I have one app, with many views, is OK, separate it in multiple files? And then include each file in urls.py
Junaid Khan
Can any body suggest me good source of making e-commerce website with login logout
joy
Can any body suggest me good source of making e-commerce website with login logout
Corey Schaefer django series register,login,logout video can help. Source: YouTube
Adonis
Class based views has inbuilt functions which can be overriding If you want serious flexibility, use fbv
serious flexibility ? What you mean by that please ? personnaly i prefere CBV the only bottleneck for is the fact it has a lot of code (for various Mixins, and parents classes)
Adonis
you can do that in CBV as you want also... with method like get_context_data() for example. btw it's a choice like any other one😊
Anonymous
Hello guys. i am doing project on django + react + rest api. and the question is, how to create multiple page on react?
Anonymous
Do you know some tutorials on this? Django+react!
Anonymous
Not with htmls, i need frontend through backend api
Ernest
https://www.youtube.com/channel/UCRM1gWNTDx0SHIqUJygD-kQ
Anonymous
Hi, anyone know how to link google maps to geodjango?
sky
how to show data to front end generated by a python function
Doragonsureiyā
how to show data to front end generated by a python function
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 firsts results