423 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
2
votes
2
answers
3k
views
Django: AttributeError: module 'collections' has no attribute 'Iterator' [duplicate]
Using django-admin startproject trydjango gives error:
AttributeError: module 'collections' has no attribute 'Iterator'
even though I have Django installed and could see a list of commands by doing ...
0
votes
0
answers
56
views
use csv file and plot data django2
I have a simple app that import csv file and make plot but without having any error message it doesn't show plot
It's part of my module:
...
def plot_data(self):
df = pd.read_csv("file.csv&...
0
votes
1
answer
496
views
can we modify value in django queryset using Django "F" expression . Query optimisation
now = datetime.utcnow().replace(tzinfo=utc)
.annotate(
age=F(int((now - 'ended_at').total_seconds() / (60 * 60)))
I want to add logic like above in Django query.
basically i want to ...
0
votes
0
answers
426
views
JSON fields serializer errors in Django rest framework
when I do input data then I want to check the data key is valid or not by Django rest API JSON serialize field.
I have a JSON serializer in serializers.py like as
class EmployBasicInfoSerializers(...
0
votes
1
answer
547
views
How to raise multiple ValidationError on Django Rest API?
Suppose I have three serializers in function and I want to check the validation. If any errors occur in the condition it Response error message at a time
My function:
def employ_create(request):
...
1
vote
1
answer
3k
views
How to break "for loop" in Django template
My code is:
{% for key, value in section.items %}
{% for key_t, value_t in title.items %}
{% if value_t.section_id == key|add:"0" %}
<li class="nav-...
0
votes
0
answers
1k
views
How to fix QuerySet' object has no attribute 'userrole_set' in django?
When I Adds the specified model objects to the related object set. Like as
My view.py:
role = UserRole.objects.get(id=user_role_id)
s = SbTitle.objects.filter(user_role=1)
d = s.userrole_set.add(role) ...
0
votes
0
answers
125
views
Why model formset don't save in django
I have a formset and I am trying to save it back. But, when I try to check if employ_academic_forms.is_valid() and save, validation always fails even if nothing in the formset has been changed. I am ...
0
votes
2
answers
3k
views
How can add "templates " and "statics" folder in Django 3.1
setting.py
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
#TEMPLATES_DIR = path.join(BASE_DIR, '...
0
votes
1
answer
747
views
import OAuth2Authentication ImportError: No module named 'oauth2_provider.ext'
I'm trying to login by Facebook in my python projcet .it keeps telling me that ImportError: No module named 'oauth2_provider.ext' whenever I migrate it using terminal
my installed using pip freeze :
...
0
votes
1
answer
46
views
How to update relation field in override save
How to update relation OneToOneField field in override save
update working in object.create() but not working in .save()
def save(self, *args, **kwargs):
self.wallet.wallet_inventory = 50
...
0
votes
0
answers
41
views
URL redirect issue in python using Django framework
I am working on Python using the Django framework. During setting URLs for my web application, I am facing some problems. I have redirect code return HttpResponseRedirect('/{}-meters-to-{}/'.format(...
0
votes
1
answer
183
views
How do I get accurate events to display after clicking a calendar date?
I am trying to get the events for any date that a user clicks on the calendar.
When you click a date, say 8/15, the date is sent to the server as a string (yyyy-mm-dd) via ajax and updates a div on ...
0
votes
2
answers
2k
views
Get parent by its children in Django Queryset
I have this model:
Department(models.Model):
title = models.CharField(max_length=128)
reference = models.ForeignKey('self', related_name='reference')
As you see, each object of this model ...
1
vote
1
answer
1k
views
How to get the SMTP server response code in Django?
Goal:
Hi! How can I get the SMTP response codes through Django, similar to return values given from the smtplib module??? I want to use Django's api instead of having to use that, and I see nothing ...