Shihasz
Daro
Anonymous
{% for i in obj %}
<a href="{% url 'remove' pk=i.pk %}" class="list-group-item">{{i.first_name}}</a>
{% endfor %}
Shihasz
Sheshadri
Daro
is there any way to implement how a form is rendered to html???
Anonymous
Anonymous
Shihasz
Didnt get u
You are totally confusing urself u have passed {'names':obj} as context to template. So template can access 'names' variable only that holds objects
Anonymous
Anton
Sheshadri dude, i find out, that reverse for my app working if i don't use kwargs argument in reverse(). But if i'm use it, than Noreversematch calls
Moon
Anonymous
Shihasz
Anton
Hey guys, can you help me? When i transfer dict to kwargs in reverse func (reverse('view-path-name', kwargs={'text':'hello'})) i get error 'Noreversematch, can't find view', but if i delete kwargs all is working. Who have ideas why?
Future
Hello everyone I'm doing API registration using restauth and get this error "CRC Failed: CSRF token missing or incorrect."tell me why
Future
did everything as on https://django-rest-auth.readthedocs.io/en/latest/installation.html#registration-optional
Shihasz
Anonymous
`def removeObj(pk):
object = get_object_or_404(Patient,pk)
object.delete()`
Anonymous
like this ?
Shihasz
def removeObj(request, pk):
object = get_object_or_404(Patient,pk)
object.delete()
Luis
Hello! I'm trying to do my first Django project and I think that I need to do my sqlite database in memory in order to insert a lot of data in a few seconds.
If I configure the database with:
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
All works fine, but I'm tried to put:
'NAME': 'file::memory:'
And syncdb works properly, after that the tables are not accesibles or not exist.
Any help please??
cj
cj
also why do you want a inmemory database?, Django does it automatically for running tests if your primary DB is sqlite3, but that's for running tests only, not for "production" things
Luis
The full command is: >python manage.py migrate --run-syncdb.
Django version 3.04
Luis
It is because I need to work with the data but persistence does not matter. Performance is more important.
Shihasz
cj
Anonymous
Luis
Shihasz
https://pastebin.com/gFnGVkV7
In patient model , 'user' field is referring to primary key of the user. So use user=request.user.pk in filter method u have used to retrieve objects
Anonymous
Anonymous
Anonymous
I have a "Course" model for courses, what is the best way to get users to get courses after purchase?
I am creating a platform for courses, and I arrived at the part where I have to make the user have access to the course after purchase, we will leave all other subjects as a means of payment etc out of the subject.
I just want to know what is the best way to give the user access to the course.
Should I just create an FK and add the user to the list after purchase? Or should I tweak something to do with Django groups and permissions?
Aravinda
from django.views.generic import DeleteView
Class PersonDeleteView(DeleteView):
template_name = "carljohnson.html"
queryset = Person.objects.all()
can we delete without using DeleteView?
Mirco
Aravinda
Mirco
DeleteView is there to help u don't reinvent the wheel and write less code
Mirco
Aravinda
Ok😇
Mirco
But you have to consider relations too
For example if Person has a PROTECTED relation instead of CASCADE or SET NULL , that delete will raise an exception
Mirco
You have to delete carefully
Aravinda
__init__
How to solve "Incorrect type: Expected pk value, received str."
__init__
Where I try to save multiple object at once in rest framework
Anders (izzno / gooood) 🇳🇴
Interested in python development? This is something you should not miss.
https://realpython.com/free-courses-march-2020
Anders (izzno / gooood) 🇳🇴
(Not commercial, free content)
Mirco
Ghorz
Ghorz
Ghorz
Anders (izzno / gooood) 🇳🇴
Anonymous
Hey guys how to get instagram news feed in django
Anonymous
To my website in a simple way
©aptain
Hey guys how to get instagram news feed in django
I don't know if I anyone is allowed to give link but to help you I am pasting it maybe helpful to you
https://www.digitalocean.com/community/tutorials/django-authentication-with-facebook-instagram-and-linkedin
https://django-social-widgets.readthedocs.io/en/latest/
Anonymous
Anyone have python django in visual studio tutorials...?
Anonymous
`def removeObj(request,userid):
object = Patient.objects.filter(user=userid)
object.delete()
return render(request,"pages/patients.html")` All my objects are getting deleted with this code I think its because a user has same user id , what parameter should I use so that my objects dont get deleted
Sheshadri
Why are you using userid ? You should be using id of the patient object
Sheshadri
change your path to path("remove/<int:pk>",removeObj,name="remove"),
Sheshadri
path("remove/<int:pk>/",removeObj,name="remove"),
Anonymous
Sheshadri
def removeObj(request, pk):
object = Patient.objects.get(pk=pk)
object.delete()
Sheshadri
def removeObj(request, pk):
obj = Patient.objects.get(pk=pk)
obj.delete()
Sheshadri
object maybe a reserved keyword
Aneesh
{%url 'index'%} not working properly
Aneesh
Please help