Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Python manage.py runserver gives error of raise ImportError('win32 only') ImportError: win32 only, using python 3.9, OS Ubuntu 18.04
I'm new to Django, creating my first project. everything was working fine and suddenly got an error of ImportError('win32 only') ImportError: win32. Searched a lot online but didn't find a solution. try to install pip install pywin32, got an error ERROR: Could not find a version that satisfies the requirement pywin32 (from versions: none) ERROR: No matching distribution found for pywin32 try to install pypiwin32, got error as below, Collecting pypiwin32 Using cached pypiwin32-223-py3-none-any.whl (1.7 kB) Using cached pypiwin32-219.zip (4.8 MB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [7 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/tmp/pip-install-e3895f2v/pypiwin32_a7f6ac392d7c456a8f054610add7c850/setup.py", line 121 print "Building pywin32", pywin32_version ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Building pywin32", pywin32_version)? [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 details. Nothing working and do not know how to solve … -
download to csv the result of a search in Django
I am trying to download a CSV from the result of a search. I have the following views: First is the search view def binder_search(request): if request.method == "POST": searched = request.POST['searched'] binders_searched = Binders.objects.filter(Q(description__contains=searched) | Q(step__name__contains=searched) | Q(status__name__contains=searched)) return render(request, "binder_search.html", {'searched': searched, 'binders_searched': binders_searched}) else: return render(request, "binder_search.html", {}) Then is the csv. This view creates the list of all items in the database. What I am trying to do is get the search result from the above view, and then create the csv file. I would end up with a CSV file that has only the search result in it. def binders_csv(request): response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment; filename=binders_result.csv' # create a csv writer writer = csv.writer(response) # designate the model binders = Binders.objects.all() # add column at the heading of csv file writer.writerow(['Item Code', 'Description', 'Item Type', 'Current Step', 'Current Status', 'Last change by']) # loop thru and output for binder in binders: writer.writerow([binder.itemcode, binder.description, binder.itemtype, binder.step, binder.status, binder.user]) return response I look around at different solutions, but none actually debugged me. Any idea how to do this? -
python request.post raise unexpected eof while reading
i was upgraded recent version pyopenssl package in django project after that request.post raise eof while reading error import requests headers = { 'Content-Type': 'application/json', 'someheader': 'SOMEVALUE', } json_value = { 'value1': 'value1', 'value2': 'value2', } url = 'https://url.s.o/m/e/u/r/l/' res = requests.post(url, json=json_value, headers=headers) this code raise error [('SSL routines', '', 'unexpected eof while reading')] i use python 3.6 Django==2.1.2 pyopenssl==22.0.0 requests==2.27.1 openssl==1.1.1f how can i solve it? -
Generating thumbnail manually and uploading it in S3 bucket
My web app is image-centric and when a user uploads an image (any size), I need to create a thumbnail and store so that I can use the thumbnail and not the original image. I use AWS S3 bucket, boto3, django-storages. The file upload works flawlessly, my issue is when I generate a thumbnail and upload to the S3 bucket with different file name (it does not throw error, but I cannot see any thumbnail images generated or stored) This is my settings.py Media root MEDIA_ROOT = os.path.join(BASE_DIR, 'media') AWS Specific settings (I did not override MEDIA_ROOT) AWS_ACCESS_KEY_ID = os.getenv('AWS_ACCESS_KEY_ID') AWS_SECRET_ACCESS_KEY = os.getenv('AWS_SECRET_ACCESS_KEY') AWS_S3_REGION_NAME = os.getenv('AWS_S3_REGION_NAME') AWS_QUERYSTRING_AUTH = False AWS_STORAGE_BUCKET_NAME = os.getenv('AWS_STORAGE_BUCKET_NAME') AWS_DEFAULT_ACL = os.getenv('AWS_DEFAULT_ACL') AWS_S3_CUSTOM_DOMAIN = f'{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com' AWS_S3_OBJECT_PARAMETERS = {'CacheControl': 'max-age=86400'} AWS_S3_FILE_OVERWRITE=False # s3 static settings STATIC_LOCATION = 'static' STATIC_ROOT = f'https://{AWS_S3_CUSTOM_DOMAIN}/{STATIC_LOCATION}/' STATIC_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/{STATIC_LOCATION}/' CKEDITOR_BASEPATH = f'https://{AWS_S3_CUSTOM_DOMAIN}/{STATIC_LOCATION}/ckeditor/ckeditor/' STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' # s3 public media settings PUBLIC_MEDIA_LOCATION = 'media' MEDIA_URL = f'https://{AWS_S3_CUSTOM_DOMAIN}/{PUBLIC_MEDIA_LOCATION}/' #MEDIA_ROOT = f'https://{AWS_S3_CUSTOM_DOMAIN}/' DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' The code where I upload generated thumbnail files (if it ever generates): I use the Pillow library for generating thumbnail Version 1 of code: tfname = os.path.join(os.path.join(settings.BASE_DIR,"media"), file_name) image.save(tfname) Version 2 of the code (saw it somewhere on this site and … -
how to send longitude and latitude to javascript script from def django
I can't figure out how to replace digital longitude and latitude values with dynamic fields from postgres in javascript how to get the longitude and latitude of a particular place in this script? <div id='map' style='width: 100%; height: 400px;'></div> <script> mapboxgl.accessToken = '{{ mapbox_access_token }}'; var map = new mapboxgl.Map({ container: 'map', style: 'mapbox://styles/mapbox/streets-v10', center: [20.890438, 52.256002], // {{venue.lat}}, {{venue.long}} How to pass fields in a similar way as all other django fields zoom: 9 }); var marker= new mapboxgl.Marker() .setLngLat([20.890438, 52.256002]) // {{venue.lat}}, {{venue.long}} .addTo(map) </script> All rendering functions in django. Here's how to send a specific longitude and latitude for a specific event. def show_venue(request, venue_id): venue = Venue.objects.get(pk=venue_id) venue_owner = User.objects.get(pk=venue.owner) long = Venue.objects.get(pk=venue.long) lat = Venue.objects.get(pk=venue.lat) #addresses = Venue.objects.all() mapbox_access_token = 'pk.eyJ1IjoicGF2ZWxzdHJ5a2hhciIsImEiOiJjbDI2ZmJmcTkyajBwM2lscDd6aDVwOG4xIn0.15o8i7eD1qwyQcnsx2iBmg' return render(request, 'events/show_venue.html', { 'venue': venue, 'venue_owner':venue_owner, #'addresses': addresses, 'mapbox_access_token': mapbox_access_token, 'lat':lat, 'long':long, }) I will be very grateful for your help -
How to send react form to an email and also save into database
How to send react form to an email and also save into database.. (We need to use Django for backend) and react js for frontend. is there anything else we can do without using the method mentioned below? Fill the form Send to Django Views Save to Database from Django View Send an email to corresponding email -
How to set up developing Django, JavaScript with Docker and static files? To get real time web page changes
Currently I have Docker container. The process with main.js: npm renders main.js and store it in static folder (out of the docker container) Docker compose and docker file collects static files in static-volume, including main.js Nginx serves main.js from static-volume But when I make changes to the source code, I can see the results only after restarting container and "docker volume prune" command. I want to have changes of the web page right after code is changed. And what is the best practise in this scenario? -
Improving efficiency around Django's ORM and serialization while importing external data
I have a celery worker that periodically fetches data from an API that I need to be in sync with. I create or update a particular model instance depending on whether I have the external id stored already. However, as the API I'm syncing with has grown, this task has become increasingly expensive. Here's the relevant code: for d in api.fetch_items(): attempted_count += 1 try: existing_item = MyModel.objects.get(item_id=d["item"]) serializer = MySerializer( existing_item, data=d, partial=True, context={"company": company}, ) except MyModel.DoesNotExist: serializer = MySerializer(data=d, context={"company": company}) if serializer.is_valid(): serializer.save() imported_count += 1 else: logger.error(f"Invalid data when deserializing item: {serializer.errors}\nBased on: {d}") I think because the response is so long (often 50,000+ items), those queries make the task eat up lots of time. I'm hoping to get some suggestions on making this flow more efficient. Some things I've considered: Comparing the instances of MyModel via iterator() to the response the task receives to determine which internal items need to be updated or created (I don't even know if this would be faster) Bulk updating, though I'm not sure how to do bulk updates when the values that need to be updated for each item are different. Maybe an atomic transaction? I'm not even … -
How to Create Collection Like QuerySet in Django
#The below statement is valid medical = Medical.objects.filter(ref_no=ref_no) print(medical) #This is the output which contains two records <QuerySet [<Medical: Medical object (1)>, <Medical: Medical object (2)>]> #This is the model for Medical class Medical(models.Model): ref_no = models.CharField(max_length = 100) med_ref = models.CharField(max_length = 100) status = models.CharField(max_length = 50) #The value return from database are encrypted. I have a class that successfully decrypt the value. med = Setup.TransformData(medical) def TransformData(medicals): medList = [] if medicals.exists(): for med in medicals: medical = Medical() medical.radius = EncryptionDecryption.DataDecryption(med.ref_no) medical.radius = EncryptionDecryption.DataDecryption(med.med_ref) medical.radius = EncryptionDecryption.DataDecryption(med.status) medList.append(medical) return medList My challenge is that in this class, I am not able to re-create the medical collection to return the value like QuerySet or some other format so that i can loop through it to get the decrypted values for each records. Please can someone help me re-write the TransformData method to return an iterable values. Thanks -
Django Admin - Preventing staff from accessing admin panel
I'm fairly new to Django. How do I prevent staff users from logging into the Django admin panel? I still want them to be identified as staff, but do not want them to be able to log into the admin panel. I am using the default Django admin panel. Thanks -
Query with multiple foreign keys (django)
I'm making a searchbar for a site I'm working on and I'm having trouble when I want to filter different fields from different models (related between them) Here are my models: class Project(models.Model): name = models.CharField(max_length=250) objective = models.CharField(max_length=250) description = models.TextField() launching = models.CharField(max_length=100, null=True, blank=True) image = models.ImageField( upload_to='imgs/', null=True, blank=True) image_thumbnail = models.ImageField( upload_to='thumbnails/', null=True, blank=True) slug = models.CharField(max_length=250) class Meta: db_table = 'project' def __str__(self): return self.name class Institution(models.Model): name = models.CharField(max_length=250) project = models.ManyToManyField(Proyecto) class Meta: db_table = 'institution' def __str__(self): return self.name And I want to be able to search by the name of the project or the institution, but my code only takes the institution's name. def searchbar(request): if request.method == 'GET': search = request.GET.get('search') post = Project.objects.all().filter(name__icontains=search, institution__name__icontains=search) return render(request, 'searchbar.html', {'post': post, 'search': search}) How can I search for all the projects that match by its name OR the institution's name? BTW, I'm using SQL, not sure if it's relevant, but I thought I should add that info. -
how to populate user field with current user in django models via forms?
hi i am working on a django app. functionality that i am implementing is to let my user buy a internet pack from the website. i have implemented the model, view, template and url so far. but in the form i am getting a drop down list of all the users registered on the app. i automatically want django to link the user with current logged in user and let him select the pack he wants to buy and populate the model(table) automatically. My models.py def get_deadline(): return dt.today() + timedelta(days=30) class CustomUser(AbstractUser): Address = models.CharField(max_length=500) def __str__(self): return self.username class Plans(models.Model): plan_name = models.CharField(max_length=50) speed = models.IntegerField() price = models.FloatField() def __str__(self): return self.plan_name class Orders(models.Model): user = models.ForeignKey(CustomUser, on_delete = models.CASCADE) pack = models.ForeignKey(Plans, on_delete = models.CASCADE) start_date = models.DateField(auto_now_add=True) end_date = models.DateField(default=get_deadline()) is_active = models.BooleanField(default=True) def __str__(self): name = str(self.user.username) return name my views.py class UserBuyPlan(LoginRequiredMixin, View): template = 'plans/plan.html' #success_url = reverse_lazy('autos:all') success_url = reverse_lazy('home-home') def get(self, request): form = BuyPlanForm() ctx = {'form': form} return render(request, self.template, ctx) def post(self, request): form = BuyPlanForm(request.CustomUser,request.POST) if not form.is_valid(): ctx = {'form': form} return render(request, self.template, ctx) make = form.save() return redirect(self.success_url) my forms.py (i tried searching … -
How to debug "INSUFFICIENT_ACCESS" from django-auth-ldap
I have a LDAP server form Authentik and configured my NetBox wich uses django-auth-ldap to authenticate via said LDAP server. I can't login with any user. Turning on django logging I get this for all login attempts: Caught LDAPError while authenticating MYUSER: INSUFFICIENT_ACCESS({'msgtype': 111, 'msgid': 3, 'result': 50, 'desc': 'Insufficient access', 'ctrls': [], 'info': 'Insufficient Access Rights'}) On the ldap-server the logs show: {"bindDN":"cn=MYUSER,ou=users,dc=authentik,dc=vulca,dc=run","client":"10.42.3.1","event":"User has access","level":"info","requestId":"250807a2-b342-41bb-ace4-5b3a66cbcd32","timestamp":"2022-04-27T19:06:14Z"} {"bindDN":"cn=MYUSER,ou=users,dc=authentik,dc=vulca,dc=run","client":"10.42.3.1","event":"Allowed access to search","group":"authentik Admins","level":"info","requestId":"250807a2-b342-41bb-ace4-5b3a66cbcd32","timestamp":"2022-04-27T19:06:14Z"} {"bindDN":"cn=MYUSER,ou=users,dc=authentik,dc=vulca,dc=run","client":"10.42.3.1","event":"Bind request","level":"info","requestId":"250807a2-b342-41bb-ace4-5b3a66cbcd32","timestamp":"2022-04-27T19:06:14Z","took-ms":1792} {"bindDN":"cn=akadmin,ou=users,dc=authentik,dc=vulca,dc=run","client":"10.42.3.1","event":"User has access","level":"info","requestId":"c87e095a-66c8-4ed9-8f59-1f3ea6df7cc2","timestamp":"2022-04-27T19:06:16Z"} {"bindDN":"cn=akadmin,ou=users,dc=authentik,dc=vulca,dc=run","client":"10.42.3.1","event":"Allowed access to search","group":"authentik Admins","level":"info","requestId":"c87e095a-66c8-4ed9-8f59-1f3ea6df7cc2","timestamp":"2022-04-27T19:06:16Z"} {"bindDN":"cn=akadmin,ou=users,dc=authentik,dc=vulca,dc=run","client":"10.42.3.1","event":"Bind request","level":"info","requestId":"c87e095a-66c8-4ed9-8f59-1f3ea6df7cc2","timestamp":"2022-04-27T19:06:16Z","took-ms":1734} akadmin is the superuser in Authentik used to bind in NetBox auth. MYUSER is the user trying to login in NetBox. The question is how I know who is accessing what that is being denied so I can fix it. As I said akadmin is a superuser in Authentik, so I can't make sense of the error message. Also tried giving MYUSER superuser privileges in Authentik, but had no effect. -
Inner Join Two Django Querysets from Related Models
TL;DR: Is there a way to inner join two related querysets if they are based on different models? Suppose I'm trying to manage access controls for a filesystem, and I have models for User, Folder, and File. A User can access a File if it is public, OR if they can access the File's Folder. I already have a Django queryset that includes all Folders for a User: # I already have this queryset... user_folders = Folder.objects.filter( Q(is_public=True) | Q(owner=user) | Q(folder_shares__user=user), deleted_at__isnull=True, ) Now the problem: I also want a queryset that includes all Files for a User. And I want to recycle the users_folders queryset so I don't have to rewrite all the same conditions again. # ...so I don't want to rewrite the same conditions for this queryset user_files = File.objects.filter( Q(is_public=True) | Q(folder__is_public=True) | Q(folder__owner=user) | Q(folder__folder_shares__user=user), deleted_at__isnull=True, folder__deleted_at__isnull=True, ) This is a simplified example. In my real codebase, the two querysets are much more complicated, and it's a 3-level hierarchy. So currently, if the sharing rules change, I have to remember to update 3 different complex queries across the app. That's easy to screw up, and the costs of getting it wrong are really high. … -
Wagtail/Django: How to pass a Page model object as a default value for a streamfield block?
How can I pass the user selected value for background_color object that is in my PostPage Page class as the default value for another ColorField that's within my streamfield blocks? class PostPage(Page): # The user selected value for background_color is the object that I'm trying to pass as a default for a streamfield block. background_color = ColorField(default="#000000") # streamfield in question blog_builder = StreamField(BlogFeatures(), blank=True) content_panels = Page.content_panels + [ NativeColorPanel('background_color'), StreamFieldPanel("blog_builder"), ] edit_handler = TabbedInterface([ ObjectList(content_panels, heading="Content"), ]) Here is my streamfield class that uses StreamBlock: class BlogFeatures(StreamBlock): simple_list = SimpleList() I use a Structblock to help achieve my streamfield goals: class SimpleList(StructBlock): ... # how can I set the default value of this background_color to match the user selected value from the Page Model called PostPage. background_color = NativeColorBlock(default="#ffffff") ... -
How to display a gallery of images of a product after clicking on the first image?
So in short, I have a ListView in Django which displays pictures with tables on the website. Then I have a DetailView where I am placing a second webpage to use with slugs but I guess my logic is wrong. I want to be able to click on a particular picture/ table and this would redirect me to another page( possible created with slug) where I can display more pictures of the same table. I have created everything so far but I am thinking my logic is wrong. You don't have to write code, just please explain what is the correct way of doing it since I am doing it for the first time. First I created a Categories model which lists categories such as: tables, kitchens, wardrobes, bedrooms. I then created Image category where I would have title and image and so on but this was okay for one of the views but for this one I want to display multiple pictures as I mentioned and I saw some code which enabled me to have multiple images. views.py class TableCategoryListView(ListView): model = Images template_name = 'main/projects/tables.html' context_object_name = 'category_images' queryset = Images.objects.filter(category__category_title="tables") class TablesDetailView(DetailView): model = Images template_name = … -
set the logged in user to created_by for django CreateView
Apart from form_valid() method what are the other efficient ways i can set the user to created by. views.py class CreatEEView(LoginRequiredMixin, CreateView,): form_class = '' template_name = '' success_url = '' def form_valid(self, form): instance = form.instance instance.created_by = Model.objects.get(user=self.request.user) instance.save() return super().form_valid(form) -
Django Email Verification
I'm adding a feature to the social media website project that is email verification while signing up for new users. But I'm unable to create profile object to generate token using uuid4 class in administration page of django and also the data between the user object and profile object are not getting linked to each other I have attached the link to the project https://github.com/nitinjain-tech/django_email_verification please help me out -
Search functionality in CBV list view
As described in this post. My project has two types of users, clients and sellers. I have created a list view (A class based list view) for the seller, where he/she can see all of his/her clients. However, I want to implement search functionality in the list view, to make it easier for the seller to find the right client. I tried to implement the same solution that was given in this post this post, but I was not able to make it work. So my question is, how should I define the "get_queryset" to get the desired outcome? -
I am making a website using django and tailwind css. But in Cpanel I am getting this command error of Node Js path. Any suggestions what I can do?
CommandError: It looks like node.js and/or npm is not installed or cannot be found. Visit https://nodejs.org to download and install node.js for your system. If you have npm installed and still getting this error message, set NPM_BIN_PATH variable in settings.py to match path of NPM executable in your system. Example: NPM_BIN_PATH = "/usr/local/bin/npm" -
wifi_add() missing 1 required positional argument: 'request' when try to create an object
I have created this post because I couldn't find it on SO. I am not using class so that is why it is weird to get a 'request not found error'. I am facing this problem for 2 days here is my code thank you. The same problem was at my user ajax view but I solve it by changing User.objects.create() to form.save in view. But not possible to solve in here please take a look to the code I really thank you. #models.py class Wifi(models.Model): ssid = models.CharField(max_length=150) password = models.CharField(max_length=150) user = models.ForeignKey(User, on_delete=models.CASCADE) def __str__(self): return self.ssid + " " + self.user.username #views.py def configrations(request): wifi_form = WifiForm() if request.method == 'POST' and request.POST.get("operation") == "wifi": wifi_form = WifiForm(request.POST) if wifi_form.is_valid(): data = wifi_form.cleaned_data wifi_obj = Wifi.objects.create(**data, user=request.user) ctx = { 'created': True, 'success': True, 'ssid': wifi_form.cleaned_data['ssid'], 'password': wifi_form.cleaned_data['password'], 'msg':'Wifi configuration created', } return JsonResponse(ctx) return render(request, 'web/configrations.html',{'wifi_form':wifi_form}) #my forms.py class WifiForm(forms.ModelForm): ssid = forms.CharField(widget=forms.TextInput( attrs={'class': "form-control"})) password = forms.CharField(widget=forms.PasswordInput( attrs={'class': "form-control"})) class Meta: model = Wifi fields = ['ssid','password'] my ajax func: <script> $('#submit_wifi').click(function(){ var wifi_name = $('#wifi_name').val() var wifi_pass = $('#wifi_pass').val() $.ajax({ type: "POST", url: "{% url 'config' %}", headers: { 'X-CSRFToken': '{{ csrf_token }}' … -
Using annotate and distinct(field) together in Django
I've got a bunch of reviews in my app. Users are able to "like" reviews. I'm trying to get the most liked reviews. However, there are some popular users on the app, and all their reviews have the most likes. I want to only select one review (ideally the most liked one) per user. Here are my objects, class Review(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='review_user', db_index=True) review_text = models.TextField(max_length=5000) rating = models.SmallIntegerField( validators=[ MaxValueValidator(10), MinValueValidator(1), ], ) date_added = models.DateTimeField(db_index=True) review_id = models.AutoField(primary_key=True, db_index=True) class LikeReview(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='likereview_user', db_index=True) review = models.ForeignKey(Review, on_delete=models.CASCADE, related_name='likereview_review', db_index=True) date_added = models.DateTimeField() class Meta: unique_together = [['user', 'review']] And here's what I currently have to get the most liked reviews: reviews = Review.objects.filter().annotate( num_likes=Count('likereview_review') ).order_by('-num_likes').distinct() As you can see, the reviews I get will be sorted by the most likes, but its possible that the top liked reviews are all by the same user. I want to add distinct('user') here but I get annotate() + distinct(fields) is not implemented. How can I accomplish this? -
Redis server on glitch
I am new user on glitch and i am not aware how to start Redis server for Django project on glitch. Please help me to do so or suggest me any other platform which is free. -
Django model form create and update
I have a model form called Record Category which has only field called name on my 2 pages 1.record_category/create/ 2.record_category/update/ how can i write my formview for both updating and creating? models.py class RecordsCategory(models.Model): name = models.CharField(max_length=255, blank=True) views.py class RecordCategoryView(FormView): ? -
Django formsets of dynamic forms
I have several arbitrary datastructures that I want to be filled by a user and I think the django formsets are the most suitable way to deal with it, thanks to prefixes, but I'm not sure. Let's say I always have an initial data whose keys and values can vary depending on the situation, but for this example I will use: fields = { "first" : forms.IntegerField(), "second" : forms.CharField() } I have the following class to create forms dynamically: class fieldsForm (forms.Form): pass Thus, I create a class dynamically: DynamicForm = type('DynamicForm', (fieldsForm,), fields) Then, I create a formset and I instantiate it: dynamicFormSet = forms.formset_factory(DynamicMsgForm) formset = dynamicFormSet() The key is I can have extra field dicts that I want to handle on the same formset giving to each dict form instance an index, for example: another = { "first" : forms.IntegerField(), "second" : forms.CharField(), "third" : forms.IntegerField() } Finally, I create the class dynamically again, I instantiate it and I try to include it to the previous formset instance: DynamicForm = type('DynamicForm', (fieldsForm,), another) anotherFormInstance = DynamicForm() formset.add_fields(form=anotherFormInstance, index=1) My problem is that the formset is not being updated with the "another" form instance, I think I've …