Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to NOT include another Django template by default while keeping the tag in the template?
I have the following in settings/base.py SOME_TEMPLATE = os.getenv("SOME_TEMPLATE", "something/template.html") TEMPLATES = [ { # i skip .... "OPTIONS": { "context_processors": [ # i skip... # for the project-specific context "core.context_processors.settings_values", ], }, }, ] then in core/context_processors.py from django.conf import settings def settings_values(request): """ Returns settings context variable. """ # pylint: disable=unused-argument return { "SOME_TEMPLATE": settings.SOME_TEMPLATE, } in the actual template {% include SOME_TEMPLATE %} Without changing or removing {% include SOME_TEMPLATE %} what can I do such that by default, the template is not included? Preferably at the settings level? I was thinking of using if tag but i felt it would be more verbose. Is there a way to be less verbose and still achieve the same outcome? -
how to install mysqlclient python library in linux?
I have a Django project and I want to deploy it on a server.But I'm unable to connect mysql. I have tried different alternatives but I can't fixed this problem.(I have kali linux operating system) This is the error I am receiving when installing mysqlclient: pip install mysqlclient==2.0.0 1 ⨯ Collecting mysqlclient==2.0.0 Downloading mysqlclient-2.0.0.tar.gz (87 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.9/87.9 kB 1.4 MB/s eta 0:00:00 Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [13 lines of output] /bin/sh: 1: mysql_config: not found /bin/sh: 1: mariadb_config: not found /bin/sh: 1: mysql_config: not found Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/tmp/pip-install-go97vzkz/mysqlclient_85ab5f5ba17f42dcba9e2b66191c32e1/setup.py", line 15, in <module> metadata, options = get_config() File "/tmp/pip-install-go97vzkz/mysqlclient_85ab5f5ba17f42dcba9e2b66191c32e1/setup_posix.py", line 65, in get_config libs = mysql_config("libs") File "/tmp/pip-install-go97vzkz/mysqlclient_85ab5f5ba17f42dcba9e2b66191c32e1/setup_posix.py", line 31, in mysql_config raise OSError("{} not found".format(_mysql_config_path)) OSError: mysql_config not found [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for … -
DRF generate html to pdf
Im trying to generate pdf from given html file but get_template function is not working i guess. from io import BytesIO from django.template.loader import get_template from xhtml2pdf import pisa def render_to_pdf(context_dict={}): try: template = get_template('invoice.html') html = template.render(context_dict) result = BytesIO() pdf = pisa.pisaDocument(BytesIO(html.encode("ISO-8859-1")), result) if not pdf.err: return result.getvalue() return None except Exception as e: print('ERROR', e) The Except block returns None. -
Deploying Django on AWS removes characters from static file links
Pictures taken from my browser view source page: Localhost as server: AWS as server: I don't know why it would do this, the page shows up fine when I run locally but on AWS it is not loading any static resources. -
How to Send simple variable/Data to Django model field with pure Javascript/Ajax?
#I want to insert an integer to django class Field but when I click POST it fails # In more spesific there is a problem to send a post request to django server. When i click on the post Button i get the following error on the Terminal. I tried by changing the variables, Functions etc... File "/home/nick/Desktop/new_venv/lib/python3.8/site-packages/django/utils/datastructures.py", line 86, in getitem raise MultiValueDictKeyError(key) django.utils.datastructures.MultiValueDictKeyError: 'age' [08/Dec/2022 11:21:03] "POST /post/ HTTP/1.1" 500 72563` This is Ajax Script in plain Javascript/Ajax including the buttons and the Id's``` `Includes HTML Code + the script `<button id="get">Send GET Request</button><br> <button id="post">Send POST Request</button> <script> var csrftoken = '{{ csrf_token }}' document.getElementById('get').onclick = () => { const requestObj = new XMLHttpRequest() requestObj.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { console.log(this.responseText) } } requestObj.open("GET", '/get/') requestObj.send() } ` `document.getElementById('post').onclick = () => { const requestObj = new XMLHttpRequest() requestObj.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { console.log(this.responseText) } } requestObj.open("POST", '/post/') requestObj.setRequestHeader("X-CSRFToken", csrftoken) // const formdata = new FormData() // formdata.append('name', 'John') // formdata.append('age', '17') // requestObj.send(formdata) var age = 16; requestObj.send(age) }`` `</script>` `the Views.py File ` These are the routes functions … -
can i deploay django project use "Geodjango" in digitalocean "app"?
I want to build an app based mainly on maps, and I want to use GeoDjango, but I'm a bit worried about hosting, does it need devops? can i host it in digitalocean app ? -
ModuleNotFoundError: No module named 'authentication.wsgi'
I am trying to deploy my django project on production server but getting failure error while setting up the gunicorn. Any kind of help would be appreciated. Thanks in advance. Below is the command I am running getting the error gunicorn --bind 0.0.0.0:8000 authentication.wsgi authentication is the name of application Below is the error log [2022-12-08 14:52:29 +0530] [79282] [INFO] Starting gunicorn 20.1.0 [2022-12-08 14:52:29 +0530] [79282] [INFO] Listening at: http://0.0.0.0:8000 (79282) [2022-12-08 14:52:29 +0530] [79282] [INFO] Using worker: sync [2022-12-08 14:52:29 +0530] [79284] [INFO] Booting worker with pid: 79284 [2022-12-08 14:52:29 +0530] [79284] [ERROR] Exception in worker process Traceback (most recent call last): File "/home/web/.local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker worker.init_process() File "/home/web/.local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 134, in init_process self.load_wsgi() File "/home/web/.local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi self.wsgi = self.app.wsgi() File "/home/web/.local/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/home/web/.local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 58, in load return self.load_wsgiapp() File "/home/web/.local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp return util.import_app(self.app_uri) File "/home/web/.local/lib/python3.8/site-packages/gunicorn/util.py", line 359, in import_app mod = importlib.import_module(module) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked **ModuleNotFoundError: No module named 'authentication.wsgi'** [2022-12-08 14:52:29 +0530] … -
A model field for storing an ordered list of ForeignKeys with duplicates
I have two models A and B, and B would like to keep an ordered list of As that can contain duplicates. class A(models.Model): ... class B(models.Model): As = models.OrderedOneToManyWithDuplicatesField(A) Where OrderedOneToManyWithDuplicatesField is mythical. I imagine that it might be a ManyToManyField with a custom through model that keeps a and ordering key, but am not sure if and how that would support the same A appearing more than ones in a given B.As. class A(models.Model): ... class B(models.Model): As = models.ManyToManyField(A, through=A_List) class A_List(models.Model): A = models.ForeignKey(A) B = models.ForeignKey(B) index = models.PositiveIntegerField() I guess I haven't found any documentation clearly stating this yet, nor made time to test it (which I will do), and I am wondering if anyone has experience to share in the interim. I guess the question boils down to whether A_list can can contain multiple rows that have the same A and B but a different index. Which in turn may boil down to: How Django keys that model (if it has an independent AutoField primary key, implicit or explicit) for example. That is, A and B are not together a unique key. Whether the manager(s) have any built-in premises about through table uniqueness … -
How do i save multiple files and prevent multiple entry to database
I am trying to save multiple files to a database. The problem however is that whenever I upload, two entries are created. Here is an example of what i am saying and models.py COLLECTION=( ("FICTION", "Fiction"), ("NON-FICTION", "Non-Fiction"), ("AUTOBIOGRAPHY", "Autobiography"), ("BIOGRAPHY", "Biography"), ) def validate_book_extension(value): import os from django.core.exceptions import ValidationError ext = os.path.splitext(value.name)[1] # [0] returns path+filename valid_extensions = [".pdf", ".epub"] if not ext.lower() in valid_extensions: raise ValidationError("Unsupported file extension.") class Books(models.Model): """ This is for models.py """ book_title = models.CharField(max_length=255, default="", primary_key=True) collection = models.CharField(max_length=255, choices=COLLECTION, default="") # book_author = models.CharField(max_length=255, default="") # publication_year = models.CharField(max_length=4, default="") # isbn = models.CharField(default="", max_length=25) book = models.FileField(default="", upload_to="media/books", validators=[validate_book_extension], verbose_name="book Name") class Meta: verbose_name_plural = "Books" def __str__(self): return self.book_title forms.py class Book(forms.ModelForm): class Meta: model = Books exclude = ["book_title"] widgets = { "book_title":forms.TextInput(attrs={"placeholder":"How"}), "book":forms.ClearableFileInput(attrs={"multiple":True}) } views.py def books(request): form = Book() if request.method == "POST": form = Book(request.POST, request.FILES) files = request.FILES.getlist("book") if form.is_valid(): for f in files: names = str(f) name = names.strip(".pdf") file = Books(book=f, book_title=name) file.save() form.save() return redirect(index) else: form = Book() return render(request, "books.html", {"form":form}) So basically, what i want to achieve is to be able to save a file without creating multiple … -
Django check if object in post method have specific value
I'm using DRF and have object with ManyToMany field. I'd like to check if object that user sent on server contains any pk in that field. Then i want to set boolean field to true in linked object to that ManyToMany. Models: class Parent(models.Model): child_link = models.ManyToManyField(child, related_name="child") class Child(models.Model): in_use = models.BooleanField(default=False) Views: class ParentView(viewsets.ModelViewSet): serializer_class = ParentSerializer authentication_classes = (SessionAuthentication, ) def get_queryset(self): user = self.request.user return Parent.objects.filter(user=user) class ChildView(viewsets.ModelViewSet): serializer_class = ChildSerializer authentication_classes = (SessionAuthentication, ) def get_queryset(self): user = self.request.user return Child.objects.filter(user=user) Serializers: class ParentSerializer(serializers.ModelSerializer): class Meta: model = Parent fields = __all__ class ChildSerializer(serializers.ModelSerializer): class Meta: model = Child fields = __all__ -
Export an html to PDF in Django application with charts
I have a Django application, and I want to provide 'export to pdf' functionality on all pages, (Note: all pages have images). I saw multiple tutorials on the topic, there are two ways: either write your pdf on your own or provide an HTML file path and context dictionary (which is difficult for me to provide). I need something like the following: button -> some_url -> some_view_function -> get all content from requesting page -> show the pdf content to the user in a separate window so the user can save it. -
Can't access images via web with Azure storage and Django
I want to access the path of the image/blog in the browser, I am using Django rest API and the package Azure storage, I tried to make the container storage public, but still had no luck in accessing the image, what could be wrong? This is an example of the image I want to access, it's there in the storage but can't access it : https://guiomentor-staging.azurewebsites.net/media/blog_images/images_3.jpeg -
How to send an Javascript object to be processed on a Django Backend
I had asked this question but I found out it was a bit complicated. I have simplified the question here. I am doing payment processing with a javascript API. I get the results, but I want to send it to a Django backend to be processed. I am not too familiar with this Javascript/Django interaction, hence my issue. The following are the files. Subscription.py It's a simple page that lets users choose their subscription. @csrf_exempt @login_required(login_url='login') def subscription(request): user = request.user user_organization = OrganizationUser.objects.get(user=user) company = Company.objects.filter(name = user_organization.organization.name).first() today = datetime.date.today() form = CompanyForm(request.POST) subscription = Subscription.objects.all() if user_organization.is_admin == True: context = {'user_organization': user_organization, 'form': form, 'subscription': subscription, 'company': company, 'today': today,} return render(request, 'registration/subscription.html', context) else: return HttpResponse('You are not authorised to view this page') Here is the corresponding Subscription.html {% block content %} <div class="columns is-centered"> <div class="column is-5 box"> {% if company.paid_till < today %} <form action="" method="POST" enctype="multipart/form-data"> {% csrf_token %} <div class="content"> <h1 class="title is-4"> <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> Account is not active </h1> Your company <strong>{{user_organization.organization}}</strong> is not active. Please renew the subscription.<br> </div> {% else %} <p class="label">We have great subcription options for you. Choose from our list either for monthly … -
Can't get information from codeforces API in Django
in my project, I need to show the name of the contest site. I can't hardcode the name as I have to load the name & details of various websites as per user need. I need to show the Contest site name, contest name, contest date & time(found in UNIX format in the API which has to be converted), contest URL (which is in the list of return items but not showing while I open the API) I am so new in Django and working for the first time with API I wrote the function in views.py def homepage(request): response = pip._vendor.requests.get('https://codeforces.com/api/contest.list').json() return render(request,'home.html',response) and in HTML I did this to get the name of all contests <div class="box"> {% for i in response %} {{i.name}} {% endfor %} </div> -
Error while working with two databases in Django: sqlite3.IntegrityError: NOT NULL constraint failed: wagtailcore_page.draft_title
I'm working on a Django Project with Wagtail which uses two databases. The first one is the standard sql lite database for all django models (called db_tool.sqlite3), the other one is also sql lite but for a wagtail integration (called db.sqlite3). I wanted to migrate to the db_tool.sqlite3 with the following command python manage.py make migrations python manage.py migrate --database db_tool but now I get the following error message regarding wagtail, which I never got before. django.db.utils.IntegrityError: NOT NULL constraint failed: wagtailcore_page.draft_title First of all: I don't understand this, because I named the db_tool in particular and I wonder, why the wagtail integration raises an error when I try to migrate to db_tool. Second: I see no particular field at my wagtail-pages called draft_title and I don't have any draft page at the moment. Third: the error message also relates to a migration file of wagtail that can be found in the side-packages (see below). So maybe this is the root of the error, but I don't understand the correlation to the other error message, because since now it worked fine and I changed nothing exept of some content of my wagtail pages. File "C:\Users\pubr\.conda\envs\iqps_web\lib\site-packages\wagtail\core\migrations\0001_squashed_0016_change_page_url_path_to_text_field.py", line 23, in initial_data root … -
How can I add an Image to a Django Custom User Model (AbstractUser)?
I am trying to add 'image' to a class that extends AbstractUser. I would like to know how I could use fetch api to make a post request (vuejs) so that it calls on an views.py api and specifically uploads an image for a user. I understand how this would work when it comes to frontend but I do not know what my django views.py api would do assuming I only want it to take a file object and just add to the appropriate user. I have followed the below tutorial, however, they assume DRF is being used as opposed to an api simply made in views.py. This is why I am unsure about what my api will need to do with the image object I pass over using formData https://www.youtube.com/watch?v=4tpMG6btI1Q I have seen the below SO post but it does not directly address what my views.py api would do. That is, will it just store an image in a certain format? A URL? Add Profile picture to Django Custom User model(AbstractUser) class CUser(AbstractUser): image = models.ImageField(upload_to='uploads/', blank=True, null=True) def __str__(self): return f"{self.first_name}" -
how to Don't repeat div into for loop in django template
i have questions and answers into for loop in django template that repeats itself from dictionary, and a button that i don't want to be repeated into the for loop, i searched everywhere on documentation but i found nothing, an exemple : {% for question in questions %} {{question}} {% for reps in questions %} {{reps}} {% endfor %} <div><input type="button" value="Next question"></div> {% endfor %} i want to don't repeat the input button into the for loop -
Django when I upload a image is not saved
I'm trying to create an auction system with django. But when I create a new item for the auction, the image is not saved, but the rest of the item does. But the media folder isn't created. SETTINGS.PY MEDIA_URL = "/media/" MEDIA_ROOT = os.path.join(BASE_DIR, "media") URLS.PY urlpatterns = [ path("admin/", admin.site.urls), path("", include("core.urls")), path("users/", include("users.urls")), path("users/", include("django.contrib.auth.urls")), path("auction/", include("auction.urls")), ] if settings.DEBUG: """ With that Django's development server is capable of serving media files. """ urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) MODELS.PY class Auction(models.Model): object = models.CharField(max_length=50) description = models.CharField(max_length=256, default="") image = models.ImageField(upload_to="media/", null=True, blank=True) open_date = models.DateTimeField(auto_now_add=True) close_date = models.DateTimeField() total_bet = models.IntegerField(default=0) open_price = models.FloatField( default=0, ) close_price = models.FloatField(default=0) winner = models.CharField(max_length=256, default="") active = models.BooleanField(default=True) json_details_file = models.TextField(default="") tx = models.CharField(max_length=256, default="") def __str__(self): return self.object FORMS.PY class ItemForm(forms.ModelForm): class Meta: model = Auction fields = ["object", "description", "image", "close_date", "open_price"] widgets = { "close_date": DateTimeInput(attrs={"placeholder": "YYYY-MM-DD HH:MM"}) } VIEW.PY @login_required(login_url="login") def new_item(request): """ A function that will create a new item for te auction """ if request.method == "POST": form = ItemForm(request.POST, request.FILES) if form.is_valid(): form.save() messages.success(request, "Item create") return redirect("homepage") else: form = ItemForm() return render(request, "auction/new_item.html", {"form": form}) new_item.html {% extends "base.html" %} {% … -
Get average of multiple ratings values from different model instances (Django)
I'm working on this web-app that lets a project manager rate a vendor after finishing a task/job. Here is the models.py content: class Rating(models.Model): RATE_CHOICES = [ (1, 'Below Expectation greater than 0.02'), (2, 'Meet Expectaion 0.02'), (3, 'Exceed Expectaions less than 0.02'), ] reviewer = models.ForeignKey(CustomUser, related_name="evaluator", on_delete=models.CASCADE, null=True, blank=True) reviewee = models.ForeignKey(Vendor, null=True, blank=True, related_name="evaluated_vendor", on_delete=models.CASCADE) job = models.ForeignKey(Job, on_delete=models.CASCADE, null=True, blank=True, related_name='jobrate') date = models.DateTimeField(auto_now_add=True) text = models.TextField(max_length=200, blank=True) rate = models.PositiveSmallIntegerField(choices=RATE_CHOICES) class Job(models.Model): title = models.CharField(null=True, blank=True, max_length=100) project_manager = models.ForeignKey(CustomUser, on_delete = models.CASCADE, related_name="assigned_by") startDate = models.DateField(blank=True, null=True) deadlineDate = models.DateField(blank=True, null=True) status = models.CharField(choices=STATUS, default='In Preparation', max_length=100) evaluated = models.BooleanField(default=False) #Related Fields purchaseOrder = models.ForeignKey(PurchaseOrder, blank=True, null=True, on_delete=models.CASCADE) project = models.ForeignKey(Project, blank=True, null=True, on_delete=models.CASCADE, related_name="Main_Project") assigned_to = models.ForeignKey(Vendor, blank=True, null=True, on_delete=models.CASCADE, related_name="Job_owner") class Vendor(models.Model): #Basic Fields. vendorName = models.CharField(null=True, blank=True, max_length=200) addressLine1 = models.CharField(null=True, blank=True, max_length=200) country = models.CharField(blank=True, choices=COUNTRY_CHOICES, max_length=100) postalCode = models.CharField(null=True, blank=True, max_length=10) phoneNumber = models.CharField(null=True, blank=True, max_length=100) emailAddress = models.CharField(null=True, blank=True, max_length=100) taxNumber = models.CharField(null=True, blank=True, max_length=100) mother_language = models.CharField(blank=True, choices=LANGUAGE_CHOICES, max_length=300) Here is my view.py: @login_required def vendors(request): context = {} vendors = Vendor.objects.all() context['vendors'] = vendors if request.method == 'GET': form = VendorForm() context['form'] = form return render(request, … -
Storing different types of data in a single django database column
I have a problem that I can't quite fix, I have a table built on the basis of a model: class MessageData(models.Model): messageID = models.IntegerField() fieldID = models.IntegerField() value = models.CharField(max_length=60) class Meta: verbose_name = 'MessageData' verbose_name_plural = 'MessagesData' I need to somehow, when creating a request, in some posts, in the value field, transfer the file and then save it to the media folder, and in some posts, the text is simply taken from the textarea, Meybe someone knows a simple method to implement this without adding new fields to the model? The data i get from this template using this method: def clientPage(request, link_code): if request.method == 'POST': files = request.FILES req = request.POST.copy() print(files) print(req) {% block content %} <div class="card bg-dark"> <div class="card-header"> <h5 class="text-light">From associate: {{ message }}</h5> </div> <form method="post" enctype="multipart/form-data"> {% csrf_token %} <fieldset> <div class="card-body"> <div class="form-group"> <label for="subjectInput" class="form-label mt-4 text-light">Subject</label> <input class="form-control" id="subjectInput" placeholder="Enter subject" name="subject"> </div> <div class="form-group"> <label for="Textarea" class="form-label mt-4 text-light">Text Area</label> <textarea class="form-control" id="Textarea" rows="3" name="textArea"></textarea> </div> <div class="form-group"> <label for="formFileMultiple" class="form-label">Multiple files input</label> <input class="form-control" type="file" id="formFileMultiple" name="file" multiple/> </div> </div> <div class="card-footer"> <button class="btn btn-success" type="submit">Send Data</button> </div> </fieldset> </form> </div> {% endblock %} -
How to disable transaction in Django Admin?
I used @transaction.non_atomic_requests for the overridden save() in Person model as shown below: # "store/models.py" from django.db import models from django.db import transaction class Person(models.Model): name = models.CharField(max_length=30) @transaction.non_atomic_requests # Here def save(self, *args, **kwargs): super().save(*args, **kwargs) And, I also used @transaction.non_atomic_requests for the overridden save_model() in Person admin as shown below: # "store/admin.py" from django.contrib import admin from .models import Person from django.db import transaction @admin.register(Person) class PersonAdmin(admin.ModelAdmin): @transaction.non_atomic_requests # Here def save_model(self, request, obj, form, change): obj.save() But, when adding data as shown below: Transaction is used as shown below. *I used PostgreSQL and these logs below are the queries of PostgreSQL and you can check On PostgreSQL, how to log queries with transaction queries such as "BEGIN" and "COMMIT": And also, when changing data as shown below: Transaction is also used as shown below: So, how can I disable transaction in Django Admin? -
how to add data to a list of dictionary
a = list(request.POST.getlist('users')) b = get_participants['participants'] output=[] for i in b: for k in a: if k in i: print(k) c={ "participants" : k, "attendance" : "Present" } # output.append(c) else: c={ "participants" : i, "attendance" : "Absent" } output.append(c) print(output) This is my code I have to add participants with respect to their attendance . In "a" Im getting list of participants those are present. In "b" Im getting all participants My logic wasnt going right plz correct me. a = list(request.POST.getlist('users')) b = get_participants['participants'] output=[] for i in b: for k in a: if k in i: print(k) c={ "participants" : k, "attendance" : "Present" } # output.append(c) else: c={ "participants" : i, "attendance" : "Absent" } output.append(c) print(output) I have tried this Output: [{'participants': 'rajesh.gupta@atmstech.in', 'attendance': 'Present'}, {'participants': 'rajesh.gupta@atmstech.in', 'attendance': 'Absent'}, {'participants': 'pranay.gharge@atmstech.in', 'attendance': 'Absent'}, {'participants': 'pranay.gharge@atmstech.in', 'attendance': 'Present'}] expected output: [{'participants': 'rajesh@gamil.in', 'attendance': 'Present'}, {'participants': 'pranay@gmail.in', 'attendance': 'Present'}] -
Django imagefield repeat
I added an index.html carousel for my django project. When I try to pull the database from django admin, there are a lot of pictures and it repeats one picture? [enter image description here](https://i.stack.imgur.com/CJXFa.png) [enter image description here](https://i.stack.imgur.com/p7OKh.png) [enter image description here](https://i.stack.imgur.com/gjTcy.png) Can you tell me where is the problem? -
Can a mobile application backend be built using Django & python?
Me and my friend are trying to create a mobile application. We'll be using flutter in the frontend. There are some doubts we've regarding the backend of the application. Can we create the backend using Django and python? We're planning to access the backend with the Api's. Did some googling where some said it is not possible to build because Django is a web framework also were some said it can be done if we're using it with Api. Our Stack: Frontend: Flutter Backend: (Python-Django) or (Nodejs-Express) Database: MongoDB NOTE: I want to keep my backend as clean as possible as in don't want to keep extra things which I will not be using in my project! -
Match student's time with TA's time slot to make a scheduling table
I'm trying to make a scheduling system for TAs and students at my school. The logic is every TA has an open period (from start_time to end_time on some days of the week, and 15-minute slots during that period. (I figured out how to output that in HTML already.) Every student also has a time they want to meet with an available TA whose time slot match with the student's time on the same day of the week. I'm having trouble with how to match student's time with TA's time slot and put student's name beside TA's time slot. Can anyone help, please? Thanks!! Here's my models, views.py, HTML, and web output.