Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Comments in posts
Im having trouble getting my comments to show in the tickets they save fine to the database and I can see how many comments are on a post but will not post the comments. Models: class Ticket(models.Model): id = models.AutoField(primary_key=True, unique=True, auto_created=True) staffmember = models.ForeignKey('users.Users', verbose_name='Users',on_delete=models.CASCADE, default=True, related_name='ticket') ticketId = models.UUIDField(default=uuid.uuid4, editable=False) ticketName = models.CharField(max_length=200) ticketDescription = models.TextField(max_length=10000) ticketTime = models.DateTimeField(default=timezone.now) role = models.CharField(max_length=40, choices=Roles, default=developer) condition = models.CharField(max_length=40, choices=Condition, default=Opened) priority = models.CharField(max_length=40, choices=priority, default=low) class Comment(models.Model): id = models.AutoField(primary_key=True, unique=True, auto_created=True) IdTicket = models.ForeignKey('ticket.Ticket', verbose_name='Ticket', on_delete=models.CASCADE, related_name='comment') user = models.ForeignKey('users.Users', verbose_name='Users', on_delete=models.CASCADE, related_name='comments') timestamp = models.DateTimeField(default=timezone.now) description = models.CharField(max_length=1000) Views: class EditTicketView(UpdateView, LoginRequiredMixin): model = Ticket post_form_class = EditTicketForms comment_form_class = CommentForm template_name = 'editTicket.html' fields = ['ticketName', 'ticketDescription', 'condition', 'priority', 'role'] success_url = reverse_lazy('dashboard') def CreateCommentView(request, pk): post = get_object_or_404(Ticket, pk=pk) if request.method == "POST": form = CommentForm(request.POST) if form.is_valid(): Comment = form.save(commit=False) Comment.ticketId = post #form.cleaned_data('description') Comment.save() return redirect('viewComment', pk=post.pk) else: form = CommentForm() return render(request, 'Createcomment.html', {'form': form}) Html: I'm trying to display the comments when you click into the ticket im not sure if i am going about it the right way or not as i mentioned the number of comments on a ticket … -
Typeform Security API and Django: Not Verifiying Hash Correctly
I am trying to use Typeform's security for their webhooks. This involves 1) Receiving the signed packets and extracting the signature 2) Getting the body of the requst 3) Creating a hash with a secret key on the payload 4) Matching the hash with the received signature My web framework is Django (Python based). I am following the example at the TypeForm link here: https://developer.typeform.com/webhooks/secure-your-webhooks/. For the life of me, I can't figure out what's going on. I've tried it in both Python and Ruby, and I can't get the hash right. I call a Ruby script from Python to match the output, but they are different and neither work. Does anyone have any insight? I'm starting to think that it might have something to do with the way that Django sends request bodies. Does anyone have any input? Python implementation: import os import hashlib import hmac import base64 import json class Typeform_Verify: # take the request body in and encrypt with string def create_hash(payload): # convert the secret string to bytes file = open("/payload.txt", "w") # write to a payload file for the ruby script to read later file.write(str(payload)) # access the secret string secret = bytearray(os.environ['DT_TYPEFORM_STRING'], encoding="utf-8") file.close() … -
Want ot know the deatils of django server setup?
I AM DOING A startup using DJANGO BACKEND AND I AM TARGETTING 100K WEB TRAFFIC What should I plan ABOUT server BANDWIDTH,MEMORY,STORAGE, ETC. -
Implement Datatables Server side implementation in django
currently I'm trying to implement ServerSide Rendering in Django. I had done it before with PHP but definitely don't have anymore idea doing this with django. So far I got this jquery code for server side processing. $("#tblDatasets").DataTable({ serverSide: true, ajax: { url: "/gat/layers/" + layer.id + "/filter-table/", dataSrc: function (response) { console.log(response); } }, ordering: false, }); and have this data format return by the ajax request I implemented it before like this using Laravel and Mysql and want to implement the same with Django. Thank you for your help. any guidance is appreciated. -
"ProgrammingError: Table doesn't exist" for Many to Many relation
I have a model Part: class Part(models.Model): PartID = models.AutoField(primary_key=True, unique=True) SiteID = models.ForeignKey('Site', on_delete=models.CASCADE, null=True) Comment = models.CharField(max_length=255, blank=True) Subtype = models.ForeignKey('Subtype', on_delete=models.CASCADE, null=True) Location = models.CharField(max_length=255, blank=True) ConnectedTo= models.ManyToManyField('self', null=True) BatchNo = models.CharField(max_length=32, blank=False, null=True) SerialNo = models.CharField(max_length=32,blank=True) Manufacturer = models.CharField(max_length=32, blank=False, null=True) Length = models.FloatField(blank=True, null=True) InspectionPeriod = models.IntegerField(blank=True, null=True) LastInspected = models.DateField(blank=True, null=True) InspectionDue = models.CharField(max_length=255, blank=True) I used to have PartID as an integer field but I thought I'd try using an Autofield as this will auto increment and users don't need to worry about creating a unique ID when creating a Part. I needed to drop the table part_ConnectedTo because it said I was trying to change PartID which the table relied on. So I did that, flushed my DB and made my migrations - everything fine. But then when I run my app I get the error: (1146, "Table 'MyDB.myapp_part_ConnectedTo' doesn't exist") Have I done something wrong in my model definition? Or am I missing a step to create this table? -
How to display only 4 images per row?
Here I am trying to display images row by row and per row images will be 4.But the below code displays the all images in one row. The result I am getting The result I want is {% for gallery in galleries %} <div class="row"> <div class="col-md-3 col-sm-6 col-xs-12"> <a href="{{gallery.images.url}}"> <img src="{{gallery.images.url}}" height="200" width="200"/> </a> <p>{{gallery.album}}</p> {% if forloop.counter|divisibleby:4 %} </div> <div class="col-md-3 col-sm-6 col-xs-12"> {% endif %} </div> </div> {% endfor %} -
How to create the Front End of a website where I can drag and drop everything in django framework?
What I have done : 1. Successfully created a django project. 2. Tested html pages with urls.py What I want to do now : 1. Easily design the home page with drag and drop functionalities like GUI. 2. Link the newly designed page with urls.py So I was looking for a suggestion on how to do that. I have tried bootstrap ,was wondering if there's a better option. -
Django Project on ec2 server giving PermissionError
I recently cloned by django project onto an ec2 server. I'm using gunicorn for the project. When I run gunicorn --bind 0.0.0.0:8000 website.wsgi:application it runs fine and the site launches. However, when I navigate to a page that pulls data from a local csv file, I get the following error: PermissionError: [Errno 13] Permission denied: '//home/ubuntu/Fantasy-Fire/website/optimizer/Predictions.csv' I tried running gunicorn with sudo and strangely I got this error: ImportError: No module named website.wsgi Why would I not have permission to some of the files in the project? -
Set value of a select input to the value of last request in Django form template
Here is my template code <div class="form-group row"> <label for="{{ form.diagnosis.id_for_label }}" class="col-sm-4 col-form-label col-form-label-sm">{{ form.diagnosis.label }}</label> <div class="col-sm-8"> <input type="text" class="form-control form-control-sm{% if form.diagnosis.errors %} is-invalid{% endif %}" id="{{ form.diagnosis.id_for_label }}" name="{{ form.diagnosis.html_name }}" value="{{ form.diagnosis.value }}" required> {% if form.diagnosis.errors %} <div class="invalid-feedback"> {% for error in form.diagnosis.errors %} {{ error }} {% endfor %} </div> {% elif form.diagnosis.help_text %} <small class="form-text text-muted"> {{ form.diagnosis.help_text }} </small> {% endif %} </div> </div> <div class="form-group row"> <label for="{{ form.assigned_employee.id_for_label }}" class="col-sm-4 col-form-label col-form-label-sm">{{ form.assigned_employee.label }}</label> <div class="col-sm-8"> <select class="custom-select custom-select-sm{% if form.assigned_employee.errors %} is-invalid{% endif %}" id="{{ form.assigned_employee.id_for_label }}" name="{{ form.assigned_employee.html_name }}"> {% for id, name in form.fields.assigned_employee.choices %} <option value="{{ id }}"{% if form.assigned_employee.value == id %} selected{% endif %}>{{ name }}</option> {% endfor %} </select> {% if form.assigned_employee.errors %} <div class="invalid-feedback"> {% for error in form.assigned_employee.errors %} {{ error }} {% endfor %} </div> {% elif form.assigned_employee.help_text %} <small class="form-text text-muted"> {{ form.assigned_employee.help_text }} </small> {% endif %} </div> </div> As you can see, I have created the form template manually and would like to keep it that way. I can set the values of previously submitted fields using {{ form.field.value }}. But I can't do the … -
Why firstname and lastname fields are not entering in database but just the email and password in the customUser i created?
I created a customUser from AbstractBaseUser with fields email, firstname, lastname and password which comes inbuilt and userManager from BaseUserManager as you can see below. But only the email and password are getting commited onto the database not lastname and firstname. I use mysql as dbms. model from django.db import models from django.contrib.auth.models import AbstractBaseUser, BaseUserManager # Create your models here. class UserManager(BaseUserManager): def create_user(self, email, firstname, lastname, password=None, is_active=True, is_staff=False, is_admin=False): if not email: raise ValueError("user must have an email") user_obj = self.model( email = self.normalize_email(email) ) user_obj.set_password(password) user_obj.active = is_active user_obj.staff = is_staff user_obj.admin = is_admin user_obj.save(using=self._db) return user_obj def create_staffuser(self, email, firstname, lastname, password=None): user = self.create_user(email, firstname, lastname, password=password, is_staff=True) return user def create_superuser(self, email, firstname, lastname, password=None): user = self.create_user(email, firstname, lastname, password=password, is_staff=True, is_admin=True) return user class customUser(AbstractBaseUser): email = models.EmailField(max_length=225, unique=True) firstname = models.CharField(max_length=225) lastname = models.CharField(max_length=225) active = models.BooleanField(default=True) staff = models.BooleanField(default=False) admin = models.BooleanField(default=False) USERNAME_FIELD = 'email' REQUIRED_FIELDS = [] objects = UserManager() def __str__(self): return self.email def get_full_name(self): return self.email def get_short_name(self): return self.email @property def is_staff(self): return self.staff @property def is_admin(self): return self.admin @property def is_active(self): return self.active I pass the values from my signup template {% extends 'base1.html' … -
Error 404 when calling ajax in dialog onOk
I am facing this issue. Anyone can give me some clues? CKEDITOR.dialog.add('nameDialog', function (editor) { ... onOk: function () { $.ajax({ url: "{% url 'util:upload_doc_to_s3' %}", // url : "http://127.0.0.1:8000/util/upload_doc_to_s3/", type : "POST", data : { fileObj: fileObj, csrfmiddlewaretoken: '{{ csrf_token }}' }, // handle a successful response success : function(json) { console.log('done triggered'); console.log(response) }, // handle a non-successful response error : function(xhr,errmsg,err) { console.log('fail triggered'); }, }); } } In this code, i got invalid url 404 error. I was expecting this url. expecting url: http://localhost:8000/util/upload_doc_to_s3/ However, it become this, http://localhost:8000/util/product_tab/edit/cfd/13/%7B%%20url%20'util:upload_doc_to_s3'%20%20%%7D?callback=jQuery2220038196995506981635_1575017580560 404 (Not Found) In the url, the 'util/product_tab/edit/cfd/13/' is the current path of page. Can someone explain this to me? -
Django React Python Post Request Image Classification
plants_serializer = PlantSerializer(data=request.data) data = request.FILES['plantImage'] path = os.path.abspath('../PlantPharmacy/media/images/ ') path = path.strip() filename = path + str(data) if plants_serializer.is_valid(): plants_serializer.save() result = predict(filename) obj = Plants.objects.get(plantImage = filename) obj.classification = result obj.save() return Response(plants_serializer.data, status=status.HTTP_201_CREATED) else: print('error', plants_serializer.errors) return Response(plants_serializer.errors, status=status.HTTP_400_BAD_REQUEST) Hi! So I'm trying to edit a Django database model entry (setting its "classification" field as result gotten through a prediction function), but when I search for the image (Plants.objects.get(plantImage = filename) it says file does not exist, even though I have saved it. I have a feeling that its because it takes a moment for the database to recognize the file. I am trying to find a way to work around this because I need to return the image classification, but I am unsure to do so or a way to work around it. get a "DoesNotExist( "%s matching query does not exist."" error. -
Using Semantic-UI with Django
I'm a complete beginner in web dev, i've done the complete Django tutorial and then i tried to use Semantic-UI to beautify my web app. After searching different solutions to solve the problem (I've used this guide to install Django). So in my settings.py i wrote these configuration lines : STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') This to "INSTALLED_APPS" : 'django_semantic_ui' And this to "TEMPLATES" --> "'context_processors'" : 'django.template.context_processors.static' Here's a view of my index.html : {% load static %} {% load dsu %} <link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}"> <link rel="stylesheet" href="{{ MEDIA_URL }}css/semantic.css"/> <button class="ui button"> Test </button> {% if latest_question_list %} <ul> {% for question in latest_question_list %} <li><a href="{% url 'polls:detail' question.id %}">{{ question.question_text }}</a></li> {% endfor %} </ul> {% else %} <p>No polls are available.</p> {% endif %} As you can see i just tried to display a simple Semantic-ui button, but the only thing i get is a simple HTML button. Thank you for your attention to these matters. -
How to save data from a ModelForm?
I am new to Django, so I am trying to build a dummy site which contains most of the basic concepts, but when it comes to saving data from a form, I am really struggling. I have watched many videos and following tutorials everything works fine, but they all use different methods with class-based views and all. All I am trying to do is saving some data from a form following the Django documentation. The project at this stage is very simple: a homepage with a dropdown menu inside the navbar labelled 'Person'. From the dropdown, the user can select two links, and namely 'Persons List', and 'Create Person'. Now, I am using function-based views as you can see from views.py from django.shortcuts import render from .models import Person from .forms import CreatePersonForm from django.http import HttpResponse # Create your views here. def home_view(request): return render(request, 'home.html') def persons_list_view(request): persons = Person.objects.all() context = { 'persons': persons } return render(request, 'persons_list.html', context) def create_person_view(request): if request.method == 'POST': form = CreatePersonForm(request.POST) if form.is_valid(): instance = form.save(commit=False) instance.save() return HttpResponse('Working!') else: form = CreatePersonForm() context = {'form': form} return render(request, 'create_person.html', context) From these functions, I am deriving the form to … -
Django Model Form not saving to db
I have a model for car dealers and I am trying to have a form to create them. The form does not save to the db for some reason however it does reach the redirect. No errors are shown either. models.py class Dealer(models.Model): name = models.CharField(max_length=50) phone = models.CharField(max_length=50) website = models.CharField(max_length=100) address = models.CharField(max_length=100) featured_image = models.ImageField(upload_to="dealers/") class Meta: verbose_name_plural = "Dealers" def __str__(self): return self.name views.py def create_dealer_view(request): if request.method == "POST": form = CreateDealerForm(request.POST) if form.is_valid(): dealer = form.save(commit=False) dealer.save() return redirect('main:homepage_view') else: form = CreateDealerForm context = { "title": "Create - Dealer", "form": form, } return render(request=request, template_name="main/create/create_dealer.html", context=context) forms.py class CreateDealerForm(forms.ModelForm): class Meta: model = Dealer fields = ('name', 'phone','website', 'address', 'featured_image',) widgets = { 'name': forms.TextInput(attrs={'class': 'dealer-name-field', 'placeholder': 'Dealer name'}), 'phone': forms.TextInput(attrs={'class': 'dealer-phone-field', 'placeholder': 'Dealer phone'}), 'website': forms.TextInput(attrs={'class': 'dealer-website-field', 'placeholder': 'Dealer website'}), 'address': forms.TextInput(attrs={'class': 'dealer-address-field', 'placeholder': 'Dealer address'}), } create-dealer.html {% block content %} <div class="container text-center"> <form method="POST"> {% csrf_token %} {{ form.name }} {{ form.phone }} {{ form.website }} {{ form.address }} {{ form.featured_image }} <br> <button type="submit" class="btn btn-primary"><i class="fa fa-plus" aria-hidden="true"></i> Create Dealer</button> </form> </div> {% endblock content %} -
"You don't have permission to view or edit anything." even if user has access to model
I know this "error" message is common and there are already posts around this. But did not find a way to fix my issue. I am using the already existing "User", "Group", "UserManager" provided by Django. However, I have a custom authentication backend: class MyAuthentication: # ... # ... def has_perm(self, user_obj, perm, obj=None): permissions = Permission.objects.filter(user=user_obj) if perm in permissions: return True return False My user is an admin NOT a super user. He is part of a group which has all the permissions to view, edit, delete, add my models. He is able to access them by using the URL directly. However, when he tries to connect to the admin page /admin/, he is getting this error message. You don't have permission to view or edit anything I searched for a permission which will give him access to view the lists of models in django documentation, but found nothing. Do I need to add anything to my backend authentication? Add a new perm ? Even advice on where to look at in order to investigate would be very appreciated! -
How do I specify the order of fields in a form? [django-crispy-forms]
We are using Django 2.2 for Speedy Net. We have a contact form and recently it has been using by spammers to send us spam. I decided to add a "no_bots" field to the form where I'm trying to prevent bots from submitting the form successfully. I checked the form and it works, but the problem is we have 2 sites - one one site (Speedy Net) the order of the fields is correct, and on the other site (Speedy Match) the order of the fields is not correct - the "no_bots" field comes before the "message" field but I want it to be the last field. How do I make it last? Our template tag contains just {% crispy form %} and I defined the order of the fields in class Meta: class FeedbackForm(ModelFormWithDefaults): ... no_bots = forms.CharField(label=_('Type the number "17"'), required=True) class Meta: model = Feedback fields = ('sender_name', 'sender_email', 'text', 'no_bots') def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelperWithDefaults() if (self.defaults.get('sender')): del self.fields['sender_name'] del self.fields['sender_email'] del self.fields['no_bots'] self.helper.add_input(Submit('submit', pgettext_lazy(context=self.defaults['sender'].get_gender(), message='Send'))) else: self.fields['sender_name'].required = True self.fields['sender_email'].required = True self.helper.add_layout(Row( Div('sender_name', css_class='col-md-6'), Div('sender_email', css_class='col-md-6'), )) self.helper.add_input(Submit('submit', _('Send'))) def clean_text(self): text = self.cleaned_data.get('text') for not_allowed_string in self._not_allowed_strings: if (not_allowed_string … -
How to make a sticky footer in Boostrap?
I am currently developing a project Django and I want to set up a footer pasted at the bottom of the page (sticky footer). looking for forums, I found a solution that 'does the job' (ie paste the footer at the bottom of page) but has an awkward behavior to know that depending on the size of the screen it masks some buttons (for example, the paging button of a dataTable) it is also embarrassing for my functional tests (selenium) because some tests fail when the butters are masked by the footer (see image in the red box) Is there a bootstrap footer or a way to overcome this problem? /* Sticky footer styles -------------------------------------------------- */ .asteriskField{ display: none; } form .alert ul li{ list-style: none; } form .alert ul { margin:0; padding: 0; } body > div > div.col-6 > div > div > h2 { font-size: 20px; } .footer { position: fixed; bottom: 0; width: 100%; /* Set the fixed height of the footer here */ height: 60px; line-height: 60px; /* Vertically center the text there */ background-color: #f5f5f5; /*background-color: red;*/ } -
How do i display a filtered selection list in django form
My problem is this: I have a list of people that can be selected as people that can attend a meeting. Accounts that are inactive should not be displayed in that list. I want to filter those accounts out of the list of possible users to select This is what the code looks like now: class StudioMeetingNoteAdmin(admin.ModelAdmin): fields = ('this_is_test',) fieldsets = [ ('Tijden', {'fields': ['meeting_start_time', 'meeting_end_time']}), ('Wie is de voorzitter/notulist', {'fields': [('chairman', 'secretary')]}), ('Opkomst', {'fields': [('attending_persons', 'absent_persons')]}), ] inlines = [OpeningAndParticularitiesInline, ActionListPointInline, RemarksPriorMeetingInline, IssuesToAddressInline, OurNextMoveInline, QuestionRoundInline] list_filter = ['meeting_start_time'] search_fields = ['meeting_start_time'] list_display = ('meeting_start_time', 'chairman', 'secretary') The field attending_persons should be filtered, so no inactive user accounts should be shown. I tried replacing 'attending_persons' with a method like they show in the link below, but that causes an error. https://docs.djangoproject.com/en/1.10/ref/contrib/admin/ class AuthorAdmin(admin.ModelAdmin): fields = ('name', 'title', 'view_birth_date') def view_birth_date(self, obj): return obj.birth_date view_birth_date.empty_value_display = '???' You can't do this with a fieldset So my question is: How do i display a filtered list to choose from? Thank you -
How to exclude multiple values of column using Django ORM?
I want to filter mytable & get rows where name does not contain '' or '-' values and for this purpose I have used below query but does not working. mytable.objects.exclude(name = ['','-']).order_by('name').count() returning 2000 all rows and whereas query mytable.objects.exclude(name = '').order_by('name').count() working perfectly and returning filtered 1460 results. Below one is my postgresql query which working perfectly and returning 1450 results excluding name values of ['','-']. select * from mytable where name != '-' and name != '' order by -id I tried to search online but not able to find answer. -
How to exclude data from a queryset in a single query in django according 2 independant fields in another related table in one to many condition
There are 2 models, transaction and payout. There will be one transaction record and 2 payout record. There are 2 flags in the payout record, Status & Referral. I need to get the transaction record which has The payout record Status = True and Referral = False I have tried the following queryset = queryset.exclude(payout_related_name__referral=Fasle, payout_related_name__status=True) This code is excluding the record as per first condition not according to both case combined -
getting error : django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty in django
When i try to run django, i am getting error django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty , there is already SECRET_KEY exist in settings.py file SECRET_KEY = 'g1tmo148kxtw#^obw&apoms%n=&4g+2qi1ssuc$v3(fig-he4u' still i am getting the error, can anyone please help me how to resolve this issue ? -
How Django to Hot Reload Uwsgi every workers Singleton value?
I want to hot reload my server, I have a Singleton Object, I want to change some value and become effective to each workers. I try to use open an api to access my edit, but It only refresh "that" workers singleton, the other is same the old one Is there has anyway can guide me? like @uwsgidecorators.postfork but It just suit for start workers. -
Why My Django Admin Stacked Inline is Not Working
Currently I am Using admin.StackedInline in my DoctorAdmin class But when I Use inlines = [DoctorAdminInlines] in may DoctorAdmin Class it will gives me an error, 'NoneType' object is not subscriptable and Even I am not be able to use my model fields in my list_display Here is my StackedInline Class Which I am Using class DoctorAdminInlines(admin.StackedInline): model = Doctor form = select2_modelform(Doctor) exclude = ('total_online_consultancy','emergency_type','consultation_type','total_visit','age','service_zone',) class Media: if hasattr(settings, 'GOOGLE_MAPS_API_KEY') and settings.GOOGLE_MAPS_API_KEY: css = { 'all': ('/static/admin/css/location_picker.css',), } js = ( mark_safe("https://maps.googleapis.com/maps/api/js?key={}&libraries=places".format(settings.GOOGLE_MAPS_API_KEY)), '/static/admin/js/doctor_location_picker.js', 'http://cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/src/js/bootstrap-datetimepicker.js', '/static/admin/js/dates.js' ) and here is my Doctor Admin in Which I am using this Aboved StackAdminInline class DoctorAdmin(admin.ModelAdmin): class Media: from django.conf import settings media_url = getattr(settings, 'STATIC_URL') css = {'all': (media_url+'custom.css',)} # inlines = [DoctorAdminInlines] form = UserCreationForm list_display = ['doctor', 'email', 'created_at', 'updated_at',] list_filter = ('created_at',) list_display_links = ('doctor','email',) search_fields = ('username',) list_per_page = 10 def save_model(self,request,obj,form,change): from django.conf import settings from django.core.mail import EmailMessage subject = 'New Registration Of Doctor !!' from_email = settings.MAIL_FROM forgot_email_content = """<html><body><p>Hi {customer_name},<p>Your Account is created please use this username: {username} and password: {password} </p> <br /><br />Thanks""" html_message = forgot_email_content.format(customer_name=form.data.get('email'),username=form.data.get('email'),password=form.data.get('password')) message = EmailMessage(subject, html_message, from_email, [form.data.get('email')]) message.content_subtype = "html" message.send() return super(DoctorAdmin,self).save_model(request, obj, form, change) def … -
ModuleNotFoundError: No module named 'employee.urls'
While I'm trying to add a urls configuration in my urls.py file, I'm getting an error like ModuleNotFoundError: No module named 'employee.urls' and OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '' urls.py from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('employee/',include("employee.urls")) ] directory and file path