Ray of Hope
And load cryspy form tag
Zey
i did
Zey
{% load crispy_forms_filters %}
Ray of Hope
{% load crispy_forms_tags %}
Ray of Hope
And in form, {{ form.field|as_crispy_field }}
Zey
{% load crispy_forms_tags %}
which crispy form version u have
Ashutosh
Hey i have build a django chat application/website . Now i want to make its android application with flutter so for that should i make a common api for both or can someone suggest a better way Is there a way somehow i can integrate the android application with the website so that they can work in a synchronous way
Ujjwal
Hello everyone I want to make an api in which user enters text1 and text2 And as soon as user submits the button my api gives me the response as concatenation of text1 and text2 . Do I need a serialiser for this or I can do without serialiser ?
Владислав
Guys, how do I save the user to a child form from a formset? I don't know much about them with transaction.atomic(): form.instance.created_by = self.request.user self.object = form.save(commit=False) form.save_m2m() if formset.is_valid(): formset.instance.created_by = self.object.created_by #NOT working formset.instance = self.object formset.save()
منتظر
class HabitForm(models.Model): name = models.CharField(max_length=64) habit_before = models.ForeignKey(HabitForm, on_delet=models.CASCADE) habit_after = models.ForeignKey(HabitForm, on_delet=models.CASCADE) NameError: name 'HabitForm' is not defined
Anonymous
I am asking a general question. Is it better to do a prefetch value for a nested querie, in serializer or use 3 for loops nested in my pdf class. or is it better to search like this MyModel.objects.filter(field1__field2=RandomModel)
Anonymous
I know it depends but I am asking i general
Anonymous
It would be a better solution for me to get the object with values(...) but it only returns the id of the object(So is there a way to get the whole object in this way)
Svyatoslav
Hi. I am creating api endpoint for create/get auth token using username and password. When i use APIView, i got error: Forbidden (CSRF cookie not set.): /api/auth/ Decorator csrf_exempt doesnt help. How i can fix this problem? (i try to use generics.ListCreateAPIView and serializers. But serializer cant return custom json)
Alireza
Hi I want get number of products from category How do I do this?
Alireza
Form category No Product
Alireza
Product have many to many fiel (category)
Alireza
Use related name?
W
Hi guys, I am able to render the PagosHead items in the template but when I use the " _set.all" in order to get fields from PagosDetail i've no luck. Hope you can help me! https://paste.ofcode.org/HScd5yci6vjw5LyFKftgAh
W
In line 39 {% for pagosdet in pago.pagosdetail_set.all %}
Hi Alireza, thxs 4 your help... ill try withouth s
W
@alii_mis u rock dude!
W
Yes without s
it worked dude, u definitely rock!
Alireza
I don't know what the rock is
Alireza
My English not is good
Svyatoslav
it worked dude, u definitely rock!
Hi. Do you work with rest framework?
Alireza
Walter did it work without s?
W
Walter did it work without s?
Yes, thats was the problem.
W
🥳
Kashif
Hello guys, I'm learning Django I have a CSV file in the Django server now I want to show it on an HTML page. can you help me that how to show it on the HTML page OR How to read a csv file using pandas in html page?
Vishnu
For auto completion of django syntax(library, import etc. )which extension are available in vs code??
Anonymous
Can anyone tell me how to write db schema for django models???
Kashif
Try : panda.read(file path)
What exactly need to be done is that user upload a csv file, it goes to server. After it, I want to read that csv file using pandas df and show it on web page. Pandas.read() only helped when we have data in our pc.
5P34R
Hello all, Sorry for asking offtopic. Anyone have experience in hugo ? I'm stucked in adding theme
5P34R
Can i ping anyone for help?
Mahesh
I have four images in my database, how to get particular image in HTML page by using Jinja template?
Anonymous
Guy I am fetching details from database into a form... I want to add extra fields and save that form in database.. How do I do that
Anonymous
Is there a way to get the whole object not only the id(pk) with values(...) or values_list(...)
Anonymous
I have four images in my database, how to get particular image in HTML page by using Jinja template?
in views a = Modelname.objects.all() image = request.POST['image']
Anonymous
In template <img src={{a.image.url}}>
Anonymous
Is there a way to get the whole object not only the id(pk) with values(...) or values_list(...)
It would help me because I have to do 3 for loops to get it and It does worry me
Mahesh
In views, def index(request): portfolio = Portfolio.objects.all() ourstory = OurStory.objects.all() image = request.POST['images'] contact = Contact.objects.all() context = { 'port':portfolio, 'our':ourstory, 'contact':contact } return render(request, 'index.html', context)
Mahesh
in models, class OurStory(models.Model): desc = models.TextField() images = models.ImageField(upload_to='images/', height_field=None, width_field=None, max_length=None)
Mahesh
in html, <div id="tab1"> <img src="{{ourstory.image.url}}" alt=""> <p>{{ourstory.desc}}</p> </div>
Rabbits
Django don't see my apps who in the folder settings.py: INSTALLED_APPS: [ 'chat.dialog', 'chat.message' ] chat -> dialog message __init__.py who knows how to fix it?
Rabbits
Do you have init.py in your app folder ?
raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: Cannot import 'dialog'. Check that 'chat.dialog.apps.D ialogConfig.name' is correct. ===> this mistake! dialog\apps.py
Rabbits
Do you have init.py in your app folder ?
from django.apps import AppConfig class DialogConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'dialog'
🏁 🏁 🏁
❗️django doesn't see new css
🏁 🏁 🏁
what to do?
rinaigen
Hello everyone. Where am I wrong?
rinaigen
<script> $(document).ready(function () { $("#id_children").select2({ theme: "classic", ajax: { url: '{% url 'parent_register' %}', dataType: 'json', processResults: function (data) { return { result: $.map(data, function (item) { console.log(item) return {id: item.id, text: item.text}; }) }; } }, minimumInputLength: 1 }); }); </script>
rinaigen
I'm getting in the console like this one: {id: 1, text: "Student"} id: 1 text: "Student"
rinaigen
But it does not display in select2
rinaigen
def parent_register(request): if request.is_ajax(): term = request.GET.get('term') children = Student.objects.all().filter(user__username__icontains=term) print(children.values()) result = [ { "id": 1, "text": "Student" } ] return JsonResponse(result, safe=False)
rinaigen
Here I am trying to send a test data.
rinaigen
I see, that's all working, but just does not display. I don't know why :/
Petr
I need help in calculating quiz score in Django
Petr
Please help me
poffigu
urlpatterns = [ path('', index), path('trend/', trend), path('user/status/', userstatus), ]
poffigu
Hello. help me solve the problem, please. why is the 9th line not intercepting all requests? django 3.2
poffigu
9th line: path('', index),
poffigu
it seems to me that the first route should intercept all requests. the second and third routes should not be processed. but it doesn't. also on request: http: // localhost: 8000 / blablabla / 404 error occurs page not found
Anonymous
Please I need a help with django and django Rest Framework I created an API viewsets in which everything works as expected. But I want to create an html from to upload that that same model but I'm not getting it