Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
MultiValueDictKeyError at /addtocart/ 'ordered_name'
I'm trying to run an add to cart functionality, but i get this error when i click; MultiValueDictKeyError at /addtocart/ 'ordered_name' this is my code def addtocart(request): ordered_name = request.POST['ordered_name'] price = request.POST['price'] image = request.POST['image'] put_item = OrderedItem(ordered_name=ordered_name, price=price, image=image) put_item.save() return redirect('cart') class OrderedItem(models.Model): ordered_name = models.CharField(max_length=50) price = models.FloatField() image = models.ImageField(upload_to='pics') -
JWT authentication using Django if user email and password is stored in cassandra remote database
I am working on sign-up and sign-in services for my application. The user data (firstName, email, password and phone) is stored in remote cassandra database (not in django default SQLite DB). Now I want to use JWT to secure my services and for that I saw online help for various JWT django-rest-framework packages but for all of that it requires that user data (email and password) should be on local django server. I tried to create custom user class using AbstractBaseUser but it is not working. Any suggestions on how I can authenticate django application using data stored in remote DB. -
Django : Select Multiple products from a Model
I'm new in Django, i'm working on an Inventory management project, I have a model called Products which contains some products, and i want to make a 'Return list' of products to a specific Supplier (i have this model also containing suppliers infos) , i need a form that i can type a product's name, it appears, then add it with specific quantity and so on,and finally save it to database as pdf file or csv , please help Thanks -
How to only let user transfer funds from wallet which belongs to his account in django?
models.py from django.db import models from django.contrib.auth.models import User from djmoney.models.fields import MoneyField # Create your models here. class Account(models.Model): # ACCOUNT_TYPES = ( # ('PERSONAL', 'PERSONAL'), # ('BUSINESS', 'BUSINESS') # ) account_owner = models.OneToOneField(User, on_delete=models.CASCADE, null=True) account_number = models.CharField(max_length=15, unique=True) # account_type = models.CharField(max_length=17, choices=ACCOUNT_TYPES) balance = models.DecimalField(max_digits=5, decimal_places=3) date_created = models.DateTimeField(auto_now_add=True) def __str__(self): return self.account_number class Transaction(models.Model): account_owner = models.OneToOneField(User, on_delete=models.CharField, null=True) from_account = models.CharField(max_length=15) to_account = models.CharField(max_length=15) amount = models.DecimalField(max_digits=5, decimal_places=3) timestamp = models.DateTimeField(auto_now_add=True) def __str__(self): return str(self.amount) views.py @login_required def transfer(request): if request.method == "POST": form = forms.TransactionForm(request.POST) if form.is_valid(): sender = models.Account.objects.get(account_number=request.POST.get('from_account')) if sender.balance > decimal.Decimal(request.POST.get('amount')): trans = form.save() trans.account_owner = request.user # debit the sender account sender.balance -= decimal.Decimal(request.POST.get('amount')) sender.save() # credit receiver account receiver = models.Account.objects.get(account_number=request.POST.get('to_account')) receiver.balance += decimal.Decimal(request.POST.get('amount')) receiver.save() return render(request, "wallet.html") else: form = forms.TransactionForm() return render(request, "wallet.html", {'form': form}) Hi, I am having trouble with this, transferring funds from one account to another is working great but I only want the user's account number to be able to transfer who is logged in...not this that I can input anyone's account number and transfer from one account to another...I just want to make sure the account number belongs to the user … -
If condition in django templates not working
I have tried the if condition based on the value defined in the django template {% if randomgen == 2 %} {% randomgen %}1 {% else %} {% randomgen %} 2 {% endif %} the randomgen is defined to pick in random between 1 and 2 and the value is being displayed correctly in tag but irrespective of the value it always going to else condition -
How does two function or two class call each other in python
I need to use a class attribute value (myClass.name) in a function (myFunction) and inside the class the function is also invoked which is defined earlier or next to the class. I placed the class first and the function last and vice versa. (test.py is the file name) I'm trying to use a function inside django model filed. I'm surprised Why I can't find solution like such a common thing (at least i think, it should be common). kindly help me to solve this Problem. Here First function than class: def myFunction(): myName = myClass.name return myName class myClass: name = 'rafi sarker' hello = 'Welcome'+ myFunction() myFunction() Erro in this case: Traceback (most recent call last): File "test.py", line 5, in <module> class myClass: File "test.py", line 7, in myClass hello = 'Welcome'+ myFunction() File "test.py", line 2, in myFunction myName = myClass.name NameError: name 'myClass' is not defined Here Class first, function last: class myClass: name = 'rafi sarker' hello = 'Welcome'+ myFunction() def myFunction(): myName = myClass.name return myName myFunction() Error in this case: Traceback (most recent call last): File "test.py", line 2, in <module> class myClass: File "test.py", line 4, in myClass hello = 'Welcome'+ myFunction() … -
How can I resolve Django class serializer assertion Error
Trying to work with Django Rest Framework when I run the code I get an error on Error message: Class MovieSerializer missing "Meta.model" attribute Here are my Serializers below class MovieSerializer(serializers.ModelSerializer): class Meta: models = Movie fields = ('id', 'title', 'description') class RatingSerializer(serializers.ModelSerializer): class Meta: models = Rating fields = ('id', 'movie', 'stars', 'user') I legit do not know where the error could be -
How do I build a Django model that retrieves some fields from an API?
Question How can I build a Model that that stores one field in the database, and then retrieves other fields from an API behind-the-scenes when necessary? Details: I'm trying to build a Model called Interviewer that stores an ID in the database, and then retrieves name from an external API. I want to avoid storing a copy of name in my app's database. My first attempt was to create a custom Model Manager called InterviewManager that overrides get_queryset() in order to set name on the results like so: class InterviewerManager(models.Manager): def get_queryset(self): query_set = super().get_queryset() for result in query_set: result.name = 'Mary' return query_set class Interviewer(models.Model): # ID provided by API, stored in database id = models.IntegerField(primary_key=True, null=False) # Fields provided by API, not in database name = 'UNSET' # Custom model manager interviewers = InterviewerManager() However, it seems like the hardcoded value of Mary is only present if the QuerySet is not chained with subsequent calls. I'm not sure why. For example, in the django shell: >>> list(Interviewer.interviewers.all())[0].name 'Mary' # Good :) >>> Interviewer.interviewers.all().filter(id=1).first().name 'UNSET' # Bad :( My current workaround is to build a cache layer inside of InterviewManager that the model accesses like so: class InterviewerManager(models.Manager): def … -
how display formset error validation massege
i'm trying to display error massege in my inlineformset , i have contact and phone number in my parent and in my child (formset) i have several fields , each one has its own error massege , but the problem is that they only appear if i have a massege error in either contact or phone number in my parent's field even if in my parent's field has no error and in my child fields have several error still nothing appear and the form will be save this is my CreateView def get_context_data(self,*args,**kwargs): data = super().get_context_data(*args,**kwargs) if self.request.POST: data['formset'] = MyInlineFormSet(self.request.POST) else: data['formset'] = MyInlineFormSet() return data def form_valid(self,form): context = self.get_context_data() formset = context['formset'] with transaction.atomic(): form.instance.author = self.request.user self.object = form.save() if formset.is_valid() and form.is_valid() and formset.cleaned_data!={}: formset.instance = self.object formset.save() return super().form_valid(form) my template <form method="POST">{% csrf_token %} {{formset.management_form}} <p> {{form.name| add_class:'col-12 text-center d-inline text-center'}} {% if form.name.errors %} <div class="error mx-auto"> {{form.name.errors}} </div> {% endif %} <div class="col-12 p-0 border-top border-light "> <table class="customeTable col-12 table-responsive-sm info text-center table1 mx-auto mb-2 "> <tbody class="tbody tb1 "> {% for content in formset.forms %} <tr class="p-0 col-12"> <td class=""> {{content.title| add_class:'col-12 text-center'}} {% if content.title.errors %} <div class="error … -
Django 3 Pass Get The Selected Value Dropdown select option
Django dropdown option selected. Get data in template and select option. My code is. views.py def home(request): compType = Type.objects.all() comptype = request.GET.get('comp_type') context = { 'compType': compType } return render(request, 'compapp/dashboard.html', context) search.html <div class="form-group"> <label>Type</label> <select class="form-control select2" name="comp_type" style="width: 100%;"> <!-- <option disabled="true" selected >Company Type</option> --> {% for i in compType %} <option value="{{ i }}" {% if request.GET.items == i %}selected{% endif %}>{{ i }}</option> {% endfor %} </select> -
Generating foreign based query sets
I currently have three models which is Service, Customers and Orders as shown below class Customer(models.Model): user = models.OneToOneField(User,on_delete=models.CASCADE) name = models.CharField(max_length=200, null=True) def __str__(self): return self.user.email class Services(models.Model): name = models.CharField(max_length=200, null=True) price = models.FloatField(null=True) class Order(models.Model): customer = models.ForeignKey(Customer, null=True, on_delete = models.SET_NULL) service = models.ForeignKey(Service, null=True, on_delete = models.SET_NULL) As shown, the Order model has foreign keys from the Customer and Service models. When I construct a query set from Service and Customer. Service.objects.all() Or Customer.objects.all() How can I receive the same results from accessing the query sets based on the orders model? Currently I am creating query set as shown below Order.objects.all().values('service') And Order.objects.all().values('customer') However I am not quite receiving the same results if I were to do as Service.objects.all() Or Customer.objects.all() How can I have a query set based on the order model to receive the results from query set from the Service and Customer as shown above? -
Django check if Checkbox is selected before submit
i have a little struggle with my checkbox in Django. So the main Problem is how can i check if at least one Button is selected before submit. My idea is like, if no Button is selected but you press submit, then it pops up a little notification with "Please selecte at least one button". cheers for your your help. the 4 buttons: <form method="post" action="{% url 'qrseite' %}"> {% csrf_token %} <input type="checkbox" id="colaControl" name="getranke" value="cola"/> <label for="colaControl"><div class="cola" style="border-radius: 10px;"> <img src="{% static 'img/cola_img.png' %}" width="155" height="auto"> </div></label> <input type="checkbox" id="spriteControl" name="getranke" value="sprite"/> <label for="spriteControl"><div class="sprite" style="border-radius: 10px;"> <img src="{% static 'img/sprite_img.png' %}" width="120" height="auto"> </div></label> <div style="clear:both;"></div> <input type="checkbox" id="fantaControl" name="getranke" value="fanta"/> <label for="fantaControl"><div class="fanta" style="border-radius: 10px;"> <img src="{% static 'img/fanta_img.png' %}" width="110" height="auto"> </div></label> <input type="checkbox" id="pepsiControl" name="getranke" value="pepsi"/> <label for="pepsiControl"><div class="pepsi" style="border-radius: 10px;"> <img src="{% static 'img/pepsi_img.png' %}" width="120" height="auto"> </div></label> <div style="clear:both;"></div> <input type="submit" id="submitControl"> <label for="submitControl"><div class="accept_Button" style="border-radius: 10px;"> Bestätigung <img src="{% static 'img/qrcode_img.png' %}" width="50" height="auto" style="margin-top: "> </div></a> </label> </form> -
Object of type type is not JSON serializable in django
Getting this error when calling get all: Exception Type: TypeError Exception Value: Object of type type is not JSON serializable Exception Location: /usr/lib/python3.7/json/encoder.py in default, line 179 Python Executable: /usr/bin/python My models: class Source(models.Model): name = models.CharField(max_length=50) class SourceDefinition(models.Model): source = models.ForeignKey(Source, on_delete=models.DO_NOTHING) o_id = models.IntegerField a_group = models.CharField(max_length=50) creator = models.CharField(max_length=100) config = JSONField(default=dict) My serializers: class SourceSerializer(serializers.ModelSerializer): class Meta: model = Source fields = ['name'] class SourceDefinitionSerializer(serializers.ModelSerializer): source = SourceSerializer(read_only=True, many=False) class Meta: model = SourceDefinition fields = ['source', 'o_id', 'a_group', 'creator', 'config'] My view I'm accessing: class SourceDefinitionList(generics.ListCreateAPIView): queryset = SourceDefinition.objects.all() serializer_class = SourceDefinitionSerializer What am I missing? It's something to do with the serializer.. I'm trying to access the endpoint for SourceDefinition not Source -
Django taggit - Django-autocomplete-light set up error
I am trying to set up django-autocomplete light for my django-taggit. But I am getting an error: in filter_choices_to_render self.choices.queryset = self.choices.queryset.filter( AttributeError: 'list' object has no attribute 'queryset' In my autocomplete_light_registery.py in my app called home I have: import autocomplete_light from taggit.models import Tag autocomplete_light.register(Tag) in my home/views.py I have: class PostAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): if not self.request.user.is_authenticated(): return Tag.objects.none() qs = Tag.objects.all() if self.q: qs = qs.filter(name__istartswith=self.q) return qs and in my home/forms.py I have: class PostForm(forms.ModelForm): class Meta: model = Post fields = ('title','content','tags',) widgets = { 'tags': autocomplete.ModelSelect2(url='home:post-autocomplete') } I tried to follow the documentation but I do not know what seems to be the issue. -
create object and bulk upload data into django model
New to django.. I have a webrequest from where I am able to get the response back in json format. I created the view where I mapped the fields manually to each object and then used .save method by looping through the records. Example: for item in response: dataload = My_model( person_name = get("person_name",None) ) dataload.save() however this is taking a lot of time, since my data has many columns and rows around(100k)..Hence I wanted to create the object and then do a bulk load.. Example: for item in response: dataobj = my_model.objects.create( person_name = get("person_name",None) ) _models += (dataobj,) my_model.objects.bulk_create(_models) however this is giving me an error "ORA-00001: unique constraint violated" and I believe this is due to the autogenerated id not getting created in the bulk upload process.. Can any expert please help me to fix this and load data faster to the django model. Thank you -
Add a manger to FlatPage model in Django
I'd like to extend the FlatPage model in Django so that I can implement searching within its field. That's what I've done: models.py: from django.db.models import Q from django.contrib.flatpages.models import FlatPage class FlatPageManager(models.Manager): def search(self, query=None): qs = self.get_queryset() if query is not None: or_lookup = (Q(title__icontains=query) | Q(content__icontains=query) ) qs = qs.filter(or_lookup).distinct() return qs class MyFlatPage(FlatPage): objects = FlatPageManager() views.py: class SearchView(ListView): [...] def get_context_data(self, *args, **kwargs): context['query'] = self.request.GET.get('q') return context def get_queryset(self): request = self.request query = request.GET.get('q', None) if query is not None: flatpage_results = MyFlatPage.objects.search(query) qs = sorted(queryset_chain, key=lambda instance: instance.pk, reverse=True) return qs The above search method works for other models I have, so it should also work for MyFlatPage. Nevertheless, I get no results coming from that query. Am I missing something? -
Image is not coming up properly
I'm working on a little e-commerce site. when I post a product from my site, the image(picture) doesn't show but when I post from the admin panel, the image shows so I don't why. I need help on this please. This is the code. The code below is from the model.py class OrderedItem(models.Model): name = models.CharField(max_length=50) price = models.FloatField() image = models.ImageField(upload_to='pics') def __str__(self): return self.name The code below is from the views.py def additem(request): if request.method == 'POST': stock_name = request.POST['stock_name'] stock_price = request.POST['stock_price'] stock_image = request.POST['stock_image'] new_item = Stock(stock_name=stock_name, stock_price=stock_price, stock_image=stock_image) new_item.save() return redirect('/') else: return render(request, 'post.html') the code below is from the html page <form action="{% url 'additem' %}" method="post"> {% csrf_token %} <div class="form-group"> <input type="text" name="stock_name" id="" placeholder="stock_name"> </div> <div class="form-group"> <input type="text" name="stock_price" id="" placeholder="stock_price"> </div> <div class="form-group"> <input type="file" name="stock_image"> </div> <div class="form-group"> <input type="submit" value="Additem" class="btn btn-primary btn-lg"> </div> </form> -
Reset password link on Django website not working
I have a django website. It has sign up and login functionality for users. It's currently hosted on digital ocean. I am using the gmail smtp server to send mails from the contact form and for reset password. But the reset link sent in the email is not working. When I'm running the localhost, the link works but not when hosted on digitalocean. What could be wrong? Here is my urls.py file's code: from django.contrib import admin from django.urls import path, include from django.conf.urls import url from profiles import views from django.conf import settings from django.conf.urls.static import static from django.contrib.auth import views as auth_views from django.shortcuts import render from detail.views import user_login as login_view from detail.views import user_logout as logout_view def administrator(request): return render(request, 'admin_index.html') urlpatterns = [ path('admin/', admin.site.urls), path('', include('profiles.urls')), path('administrator/', administrator), path('', include('detail.urls')), path('accounts/', include('django.contrib.auth.urls')), path('login', login_view, name='user_login'), # Password reset links (ref: https://github.com/django/django/blob/master/django/contrib/auth/views.py) # ------------------- password change paths ------------- path('password_change/done/', auth_views.PasswordChangeDoneView.as_view(template_name='registration/password_change_done.html'), name='password_change_complete'), path('password_change/', auth_views.PasswordChangeView.as_view(template_name='registration/password_change.html'), name='password_change'), # ------------------- password reset paths ------------- path('password_reset/done/', auth_views.PasswordResetCompleteView.as_view(template_name='registration/password_reset_done.html'), name='password_reset_done'), path('reset/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(template_name='registration/password_reset_confirm.html'), name='password_reset_confirm'), path('password_reset/', auth_views.PasswordResetView.as_view(template_name='registration/password_reset_form.html'), name='password_reset'), path('reset/done/', auth_views.PasswordResetCompleteView.as_view(template_name='registration/password_reset_complete.html'), name='password_reset_complete'), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) The password change part also works fine. Thanks -
LookupError: App 'Hierarchy' doesn't have a 'CustomUser' model
I've been following the Django documentation to create a custom user model. Here is the main error - LookupError: App 'Hierarchy' doesn't have a 'CustomUser' model. I have defined it in my models.py from django.db import models from django.contrib.auth.models import (AbstractBaseUser, BaseUserManager) from django.contrib.auth.admin import UserAdmin class CustomUser(AbstractBaseUser): #I proceeded to create the User details here I also added it correctly as the AUTH_USER_MODEL using - AUTH_USER_MODEL = 'Hierarchy.CustomUser' -
AttributeError: 'NoneType' object has no attribute 'answer' when try to get the latest record with Q filter
>>> from rabbit.models import TrackBot >>> from django.db.models import Q >>> latest_send = TrackBot.objects.filter(~Q(sender=110069554021986) & Q(is_postback=True)) >>> latest_send <QuerySet [<TrackBot: 4d0f034b-f067-4c83-a0f1-92624439c880>]> >>> latest_send.sender Traceback (most recent call last): File "<console>", line 1, in <module> AttributeError: 'QuerySet' object has no attribute 'sender' >>> How to get the field value ? -
Cant retrieve form data with ajax post request in django
I am trying to retrieve form data {orderId, email} in views.py from a ajax post request. I have used the csrf_token. But the variables get None in httpResponse. Below is the views.py code: @csrf_exempt def track(request): if request.method == 'POST': orderId = request.POST.get('order_id') email = request.POST.get('email') return HttpResponse(f"{orderId} and {email}") Below is the ajax post request: $('#trackerForm').submit(function(event){ event.preventDefault(); $('#items').empty(); var formData = { 'order_id': $('input[name=order_id]').val(), 'email': $('input[name=email]').val(), 'csrfmiddlewaretoken': $('input[name=csrfmiddlewaretoken]').val(), encode: true }; $.ajax({ type: 'POST', url: '/shop/track/', data: 'formData' }) .done(function(data){ console.log(formData); console.log(data); }) }); I am getting the output of console.log(formData). But I am not getting the out of console.log(data) {the response from views.py} it shows on console screen as " None and None" , which means orderId and email have values None. Please respond to it. It will be a great help. -
Django how to use variable in paramiko function
I've designed django app which is getting variable from user and save it to db sqllite according to session id. My purpose is i want to get this variable and use it in paramiko ssh functions.How can i achieve this also if we think that more than one user will be connected? I made it with global variable but as i know its not recommended.In that case how can i be sure if i used right session-id data? def submit(request): global vlan_Name Session_ID=request.session.session_key vlan_Name = Variable_Settings.objects.get(Session_ID="xxxxxxxx") if request.method == "POST": SSH_FW_Send() return redirect("/final") def SSH_FW_Send(): remote.send("conf t\n") remote.send("name " + vlan_Name +"\n") -
Django modelformset_factory - how to save multiple records with javascript
I have two buttons "Add" and "remove" they are working fine, i can add and remove forms but the problem is when it comes to submit the forms that i have added it only save the first row in the database. Can any one help please! Here are my codes! view.py def create_purchase(request): OrderItemFormset = modelformset_factory(OrderItem, form=OrderItemForm) formset = OrderItemFormset(queryset=OrderItem.objects.none()) if request.method == "POST": form1 = OrderDetailForm(request.POST or None) formset = OrderItemFormset(request.POST, request.FILES, prefix='orderitem') if form1.is_valid() and formset.is_valid(): orderdetail = form1.save() items = formset.save(commit=False) for item in items: item.order_no = orderdetail item.save() messages.success(request, 'Successfully Saved!', 'alert-success') return redirect('v_purchase') else: context = { 'form1':form1, 'formset':formset } return render(request, 'managepurchase/create_purchase.html', context) else: form1 = OrderDetailForm() formset = OrderItemFormset(queryset=OrderItem.objects.none(), prefix='orderitem') context = { 'form1':form1, 'formset':formset } return render(request, 'managepurchase/create_purchase.html', context) Template <table id="id_forms_table" border="0" cellpadding="10" cellspacing="0" style="width:100%"> <thead> <tr> <th scope="col" class="text-info">Product</th> <th scope="col" class="text-info">Quantity</th> <th scope="col" class="text-info">Buying Price</th> <th scope="col" class="text-info">Amount</th> <th scope="col" class="text-info"></th> </tr> </thead> <tbody> {{ formset.management_form }} {% for form in formset %} <tr id="{{ form.prefix }}-row" class="dynamic-form"> <td>{{ form.product }}</td> <td>{{ form.quantity }}</td> <td>{{ form.buying_price }}</td> <td>{{ form.amount }}</td> <td> <a id="remove-{{ form.prefix }}-row" href="javascript:void(0)" class="delete-row btn btn-info btn-sm" style="color:white"><i class="fas fa-minus"></i></a> </td> </tr> {% endfor %} <tr> … -
How to pass context from views.py to templates
I would like to make a like-dislike function for a post. The codes below work well for the PostDetail(ListView) but not working for the blog/home.html at all. May I know how to fix that? Also, I have made the self.total_likes.count() in the model of Post but I don't know how to pass it to the templates with numerous attempts. This is the views.py: def like_post(request): # post like post = get_object_or_404(Post, id=request.POST.get('post_id')) is_liked = False if post.likes.filter(id=request.user.id).exists(): post.likes.remove(request.user) is_liked = False else: post.likes.add(request.user) is_liked = True return HttpResponseRedirect(post.get_absolute_url()) This is also in the views.py: def home(request): post = get_object_or_404(Post, id=request.POST.get('post_id')) if post.likes.filter(id=request.user.id).exists(): is_liked = True context = { 'posts': Post.objects.all(), 'is_liked': is_liked, 'total_likes': post.total_likes(), } return render(request, 'blog/home.html', context=context) class PostListView(ListView): model = Post template_name = 'blog/home.html' # <app>/<model>_<viewtype>.html context_object_name = 'posts' ordering = ['-date_posted'] paginate_by = 5 class PostDetailView(DetailView): model = Post is_liked = False def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) post = context['post'] if post.likes.filter(id=self.request.user.id).exists(): context['is_liked'] = True return context This is the models.py: class Post(models.Model): title = models.CharField(max_length=100) content = models.TextField() date_posted = models.DateTimeField(default=timezone.now) author = models.ForeignKey(User, on_delete=models.CASCADE) likes = models.ManyToManyField(User, related_name='likes', blank=True) def __str__(self): return self.title def total_likes(self): return self.likes.count() def get_absolute_url(self): return reverse('post-detail', kwargs={'pk': self.pk}) … -
Difference between Django postgres JSON field vs. noSQL
I have a Django-React stack using REST API as the bridge. Ideally, my frontend can adopt a fairly deeply nested JSON structure for storing user inputs. My questions are: What is the main difference between applying a JSONfield in Django Postgres, VS. having to construct a separate noSQL database via e.g. Djongo? I believe the first option works properly incl. API, queries etc. (after prelim. testing). I then became confused about WHY we even need a noSQL database in the first place (within the Django context of course), or at least all the fuss about Djongo/Mongoengine etc. I would have just gone with the first option as it apparently works fine, but I'd still like to clarify the concept in case I missed out any potential catastrophic behaviour... Sorry in advance if this seems ignorant, as I am completely new to web dev. Thanks!