Day
windows 10,
Jigani
https://redis.io/download
Day
i already have it but it is in zip file, when i tried to run it, it opened the git bash,,, tried downloading somethings ,but was unsuccessful,
Day
that was the stable version
Jigani
I use Linux here...so I built it from the source.... You can check this out https://redislabs.com/blog/redis-on-windows-10/
Day
let me do this i ll be back,
Jigani
Okay
Presence
How do I add drf using poetry?
Presence
Any idea?
Hari
How to save unique name in db ?
Jigani
unique=True
Day
@g63nga i have enabled the windows subsystem for linux and also installed the lkali linux terminal, on running the redis-cli, redis is running, but not for my django project,what should i do next,
Jigani
Once the server is up and running.... Try running your app again
Akash
Did you serve you static files manually and use the debug status in your condition statement in the urls.py eg if Debug=True: ??
if settings.DEBUG: from django.conf.urls.static import static from django.contrib.staticfiles.urls import staticfiles_urlpatterns # Serve static and media files from development server urlpatterns += staticfiles_urlpatterns() urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Anonymous
Hello everybody
Anonymous
I need code which is exactly like django admin panel For my project
Presence
What should I use ... Allauth, rest-auth or djoser?
Presence
With simplejwt right?
Mirco
Why not
Presence
Cool
Akash
This is the cause.... It only serves you static files when debug is set to True
So I just remove the if setting.DEBUG condition It was come preset by wagtail cookiecutter not sure why they make it to serve only in dev mode and not production
M
brother, how to take onbject like this in html what should I do, bro? I have tried grouping based on the same value, so I usually use for blabla in blabla, then {{blabla.a}} doesn't work, how do you think?
M
def cek_doc_list(request): no_emp_list = StatusDocument.objects.all().values_list('emp_no', flat=True).distinct() group_by_value = {} for values in no_emp_list: group_by_value[values] = StatusDocument.objects.filter(emp_no=values) print(group_by_value) context = { 'page_title':'Cek Doc', 'group_by_value':group_by_value, } return render (request, 'app_import/cekdoc.html',context )
Sheshadri
Use regroup in template rather than in query
Sheshadri
Also mentioned for larger datasets this may not be the right choice
Anton
Sheshadri can you explain: i try your advice about transferring data between views using HttpResponseRedirect(reverse('view-path-name', kwargs= {dict})), and get Noreversematch again, but i see that at this django get my dict, and go to urlpattern and tried my pattern to get view. And raise some error in iri_to_uri.
Anton
Error is "not found", but i see it in my urlpattern
Sheshadri
Whats your path name ? pastbin.com and let me know urls.py views.py
Anton
i think i need to add my code for better understanding. In urls.py of my project i use: from django.contrib import admin from django.urls import path, include urlpatterns = [ path('', include('app_auth_vk.urls')), path('admin/', admin.site.urls), ]
Sheshadri
pastebin.com *
Anton
and urls.py of my_app is: from django.conf.urls import url from . import views app_name = 'app_auth_vk' urlpatterns = [ url(r'^$', views.redirect_to_auth_form), url(r'login/$', views.login), url(r'get_information/$', views.get_information), url(r'display_information/', views.display_information, name='display-information'), ]
Anton
and my views.py: def get_information(request): current_url = request.build_absolute_uri() # записываем в переменную текущую ссылку code = current_url[55:] user_found = vk_get_inf_logic.auth(code) return reverse('app_auth_vk:display-information', kwargs=user_found) def display_information(request, **kwargs): user_information = kwargs return HttpResponse(user_information)
Anton
sorry for russ coments, they didn't explain something important
Anton
If i use path i get Pagenotfound error
Sheshadri
Can you just send kwargs:{'text':'hello'}
Sheshadri
And see the output
Sheshadri
reverse ('display-information', kwargs = {'text':'hello'}
Sheshadri
)
Anton
Try. No good. Exception value: Reverse for 'display-information' not found. 'display-information' is not a valid view function or pattern name.
Sheshadri
path('display_information/', views.display_information, name='display-information'),
Sheshadri
check this if it works
Sheshadri
change from url to path
Anton
No good. Try two version: 1) Your advice give error view not found 2) add to reverse 'app_auth_vk:display_information' Error: reverse for 'display_information' with keyword arguments not found. 1 pattern(s) tried: ['display_information/$]
Anton
I edit error in second try
Sheshadri
try directly .. my_vals = {"text":"hello"} reponse = display_information(request, **my_vals)
Anonymous
Guys please help me out...is it mandatory to use forms.py for inputting values...I am using a html page for getting user details...and I am not having any forms.py...but I am unable to extend my user model...it gives me error all the time...please help me guys...please suggest me a way to create a custom user model without any forms.py
Sheshadri
if you just need forms then you will need forms.Form, if you need to extend models you will have to use forms.Modelform
Shubham
You can do it without form also... But I'm not very sure about creating user with html form
Anonymous
You can do it without form also... But I'm not very sure about creating user with html form
I was able to create the user but am not able to extend or create custom user model
Sheshadri
after user is created in whatever function you are using try CustomUserModel.objects.create(phone=phoneValue,user=newlyCreatedUserObject)
Lelouch
Where to learn django
Doragonsureiyā
Where to learn django
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
Shubham
https://youtu.be/HshbjK1vDtY
Shubham
Check this tutorial... Might be helpful
Anonymous
I'm struck for many hours on Reverse for 'remove' with keyword arguments '{'pk': ''}' not found. 1 pattern(s) tried: ['remove\\/\\(\\?P(?P<pk>[^/]+)\\\\d\\+\\)\\/\\$$'] I searched on web,yt,so but cannot find solution code:- https://pastebin.com/gFnGVkV7
Sheshadri
names.append(i.first_name) you are just appending name, where is pk of that object?
Sheshadri
No need of append , send the obj object directly to you template and render like this
Sheshadri
{% for i in names %} <a href="{% url 'remove' pk=i.pk %}" class="list-group-item">{{i.first_name}}</a> {% endfor %}
Anonymous
{% for i in names %} <a href="{% url 'remove' pk=i.pk %}" class="list-group-item">{{i.first_name}}</a> {% endfor %}
Its also throwing error When I remove pk page is rendered .. But what I want is when someone clicks on the object it gets deleted...using removeobj function in view
Sheshadri
what error?
Sheshadri
what did you send from views?
Sheshadri
return render(request,"pages/patients.html",context={'names':obj})
Anonymous
a list of objects is displayed
Shihasz
a list of objects is displayed
Your problem is not solved?
Daro
please maybe is a dumb question but, how can i add custom widgets in a form liki this:
Daro
please maybe is a dumb question but, how can i add custom widgets in a form liki this:
class ValeForm(forms.ModelForm): class Meta: model = Vale fields = ['producto', 'cantidad']
Daro
i think is something like: widget='....', but dont know for sure the syntaxis
Anonymous
Try this
Yes..its working but..the objects are not visible now..I'm iterating over them but still