Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django POSTing stripe element view reads empty formData
I am trying to read the element I sent using XHR request, but even though the data is there, I cannot access it the usual way: Here is the JS code: $( function() { var customerEmail = document.querySelector("[data-email]").getAttribute('data-email'); var submissionURL = document.querySelector("[data-redirect]").getAttribute('data-redirect'); var stripeSubscriptionForm = document.getElementById('subscriptionId'); var cardElement = elements.create("card", { style: style }); // Mounting the card element in the template cardElement.mount("#card-element"); stripeSubscriptionForm.addEventListener('submit', function(event){ event.preventDefault(); // Before submitting, we need to send the data to our database too theForm = event.target; // getting the form; same as using getElementById, but using the event only theFormData = new FormData(theForm); stripe.createPaymentMethod( { type : 'card', // this is what's sent to stripe card : cardElement, billing_details : { email : customerEmail, } }, ) .then( (result) => { // Once stripe returns the result // Building the data theFormData.append('card', cardElement); theFormData.append('billing_details', customerEmail); theFormData.append('payement_method', result.paymentMethod.id); // Setting up the request const xhr = new XMLHttpRequest() // Creating an XHR request object xhr.open(method, url); // Creating a POST request // Setting up the header xhr.setRequestHeader("HTTP_X_REQUESTED_WITH", "XMLHttpRequest"); xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); xhr.setRequestHeader("X-CSRF-TOKEN", "{{ csrf_token }}"); xhr.onload = function() { // After server sends response data back console.log('Got something back from server ') const response = xhr.response; … -
the css and jquery stylesheet are not referencing on my django project, i have tried switching the location
{% load static %} <!DOCTYPE html> <html lang="en"> <head> <title>Trave</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="description" content="Travello template project"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" href="{% static 'styles/bootstrap4/bootstrap.min.css' %"> <link href="{% static 'plugins/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css' %"> the SRC plugins refused to reference even after using the jason format and loaded the static files first <link rel="stylesheet" type="text/css" src="{% static 'plugins/OwlCarousel2-2.2.1/owl.carousel.' %"> <link rel="stylesheet" type="text/css" src="{% static 'plugins/OwlCarousel2-2.2.1/owl.theme.default.css' %"> this plugins has refused to reference <link rel="stylesheet" type="text/css" src="{% static 'plugins/OwlCarousel2-2.2.1/animate.css' %}"> <link rel= type="text/css" src="{% static 'styles/main_styles.css' %}" > this CSS file ha failed to reference <link rel= type="text/css" src="{% static 'styles/responsive.css' %}"> </head> <body> -
how can I fix this error: no module named 'PIL' on Heroku cloud?
I did create a project in Django and I installed everything Django needs to into the virtual environment now I upload the project on the Heroku cloud and when I try to upload any image I get message error: No module named 'PIL' so, I thought maybe I didn't install Pillow when I check on pip3 freeze I get a Pillow and the project locally works properly. so what is the real problem here and How can I fix this issue? -
Django: how to add custom fields to data on form save?
I want to insert some custom variable eg Status into the model when the user submits the form. I want the field status to be updated to Pending when a new record is inserted. This should be done automatically when the user inserts a new form. I know how to insert the form with values set by the user how can i insert my own values instead. My current form that inserts all data into db and it looks like this def createProcess(request): form = ProcessForm() if request.method =='POST': #print('Printing POST request : ', request.POST) form = ProcessForm(request.POST) if form.is_valid(): form.save() # above this i think i can add something to set the status return redirect('process_list') context = {'form' : form} return render(request, 'process/create_process.html', context) How can I customize the value of for eg the status field? I want the status field to automatically be updated without the user submitting any information. -
Running into problems with some java Script
Ive been following a tutorial on YouTube ( Django Ecommerce Website | Add to Cart Functionality | Part 3) and at (20:56 - 23:00) i keep getting this error. Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0 I followed every thing he did i even spent a few days backtracking through my code and i still cant get this error to go away, Ive only been coding for a few weeks so i probably need more knowledge on java script.But for the time being i wanna see if i can get some help from you guys,Thanks in advance!! -
after submit the views functions do nothing
hello this my html formulaire <div id="Admin" class="tabcontent"> <form method="POST" action=""> {% csrf_token %} <h2> Vous ètes un Admin ?</h2> <div class="container" action > <input type="hidden" name="user_type" value="1"> <label for ="id_email"><b>Votre Email</b></label> <input id="id_email" type="text" placeholder="Entrer Votre Email" name="email" required> <label for ="id_password" ><b>Mot de Passe</b></label> <input id="id_password" type="password" placeholder="Entrer Votre Mot de passe" name="password" required> <button type="submit" >Login</button> <label> <input type="checkbox" checked="checked" name="remember"> souviens de moi </label> </div> and this the views function called login def login(request): context = {} user = request.user if user.is_authenticated: return render(request, "login.html") if request.POST: form = LoginForm(request.POST) if form.is_valid(): email = form.cleaned_data.POST['email'] password = form.cleaned_data.POST['password'] user = authenticate(request, email=email, password=password) if user: login(request, user) if user.user_type == '1': return render(request, "administrateur.html") elif user.user_type == '2': return render(request, "entrepreneur.html") else: print("errors") form = AuthenticationForm() context['login_form'] = form return render(request, "entrepreneur", context) and i create in form files this class class LoginForm(forms.ModelForm): email = forms.EmailField() password = forms.PasswordInput() this my 3 user class in model: class CustomUser(AbstractUser): user_type=((1,"admin"),(2,"entrepreneur")) user_type=models.IntegerField(default=1,choices=user_type) email=models.EmailField(unique=True,blank=True) objects = UserManager() def __str__(self): return self.first_name #admin----------------------------------------------------------------------- class Admin(models.Model): user = models.OneToOneField(CustomUser, on_delete=models.CASCADE,primary_key=True) date_naissance = models.DateField(default=timezone.now) adresse = models.CharField(max_length=20, blank=True) def __str__(self): return self.user.first_name # Entrepreneur---------------------------------------------------------------- class Entrepreneur(models.Model): user= models.OneToOneField(CustomUser,on_delete=models.CASCADE,primary_key=True) date_naissance=models.DateField() adresse_entr=models.CharField(max_length=20,blank=True) telephone=models.IntegerField() occupation=models.CharField(max_length=50) … -
How can I update the database in Django?
I am building a web service and trying to update my db but obviously this is not the right method to do it. Can I have a helping hand here, I have tried all variations. I got this error: local variable 'Printer' referenced before assignment. I tried to change the name to PrinterObj but then I got the error: PrinterObj have no save method. What I want to do is to save to a new record if it is not existing and if it exist I want to update. I thought it should be simple. from .models import Printer class RequestData(APIView): permission_classes = (IsAuthenticated,) def get(self, request): Printer = Printer.objects.get(printername = printername) if Printer: #UPDATE Printer.printername = printername Printer.ip = request.META['REMOTE_ADDR'] Printer.lastupdate = datetime.now() Printer.save() else: #CREATE b = Printer( printername = printername, ip = request.META['REMOTE_ADDR'], lastupdate = datetime.now() ) b.save() -
How to add user Authentication with python, graphql, django, and Insomnia?
I'm following the graphql python tutorial at https://www.howtographql.com/graphql-python/4-authentication/. The section on Authentication, particularly where mentions using Insomnia, seems incomplete. I don't see the link between Insomnia and the tutorial. The author says, "Unfortunately, the GraphiQL web interface that we used before does not accept adding custom HTTP headers. From now on, we will be using the Insomnia desktop app. You can download and install it from here." Not even sure what Insomina is; looks like an endpoint/api tester like Postman? I am learning python, don't know Django or graphql, so it's a lot to digest all at once, but it was going ok until now. Also not sure what relevant bits to include here. I followed all the instructions. When I go to my local project site, I get TypeError at /graphql/ __init__() missing 1 required positional argument: 'get_response' Here is the relevant snippet of my settings.py: MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', ] GRAPHENE = { 'SCHEMA': 'hackernews.schema.schema', 'MIDDLEWARE': ['graphql_jwt.middleware.JSONWebTokenMiddleware', ], } AUTHENTICATION_BACKENDS = [ 'graphql_jwt.backends.JSONWebTokenBackend', 'django.contrib.auth.backends.ModelBackend', ] I also did import graphql_jwt in my main schema.py Here is some kind of stack trace Environment: Request Method: GET Request URL: http://localhost:8000/graphql/ Django Version: 2.1.4 … -
Why does the hard-coded url work but not the name-spaced url in Django?
I need someone that really knows their Django. So I can always give more detail if it's necessary but long story short, I'm trying to link to urls using django's url tag and I get a NoReverseMatch exception everytime. <ul> {% for item in results %} <li><a href="{% url 'cards:stats' item.title %}">{{ item.title }}</a></li> {% endfor %} </ul> BUT, when I use the hardcoded url, this works perfectly fine: <ul> {% for item in results %} <li><a href="/cards/stats/{{ item.title }}">{{ item.title }}</a></li> {% endfor %} </ul> Does anyone have any idea why this might be happening? Let me know if you need more details. Any help is appreciated, thanks! -
ManyToMany Field on Django Admin Interface
On Django Rest, I have a many to many relation for a field of material list. Instances of materials are added in a loan model. It works, to add through the admin site but the display is disintuitive: Instances are mixed with materials (instances are in parenthesis). It's possible to have to separated list ? One to select materials and one other to add/remove instances linked to materials ? -
Python MultiValueDictKeyError, Why am getting this Error? Whats the mistake I can't find out. Please help me with this
Product Update Form( product_update.html ) {% extends 'dash_board/products/products_home.html' %} {% load crispy_forms_tags %} {% block update %} <div class="row justify-content-center"> <div class="col-8"> <div class="card"> <div class="card-body"> <h2>Product Update Form:</h2> <!-- When This Product match to any existing Product --> {% if product_match.status %} <h5 style="color: red; border: 1.5px solid red; border-radius: 15px;" class="text-center ml-2 mr-2 p-2"> {{ product_match.message }}</h5> {% endif %} <form method="post" autocomplete="on"> {% csrf_token %} <div class="form-row ml-5 mr-5" enctype="multipart/form-data"> <div class="form-group col-lg-5 "> <!-- Previous | Product Image --> <img id="prev_image" class="float-left float-top rounded img-thumbnail" style="width: 28rem; height: 16rem;" src="{{ product_data.imageReference }}" alt="" /> <br> <!-- Input | Product Image --> <input name="uploaded_image" type='file' class="pt-1 pl-2" /> </div> <div class="form-group col-lg-7 pl-5 pr-5"> <!-- Fixed ID | Barcode --> <p>Barcode: <b><span style="color: deeppink;"> {{ barcode }}</span></b></p> <!-- Input | Product name --> <div style="width: 100%;"> {{ form.itemName|as_crispy_field }} </div><br> <!-- Input | Dropdown | Category --> <select style="width: 100%; height: 2.5em; border-radius: 5px; padding-left:5%; background-color: whitesmoke;" name="product_category" id="input_category"> {% for category in product_data.category_list %} {% if category == product_data.category %} <option class="pl-5" selected="selected" value="{{ category }}"> <b>{{ category }}</b></option> {% else %} <option class="pl-5" value="{{ category }}"> <b>{{ category }}</b></option> {% endif %} {% endfor %} … -
Django: function with model query is being called before migrations
I'm getting an error message saying that "no such table: otree_roomstest" when I'm trying to run my migrations. From what I can tell theres a function being called BEFORE the migrations, when the model is not created yet. Can't really figure out what to change to make the migrations run first then the model query. Hoping someone has a good idea. I've tried putting an if statement around the def get_room_dict() that looks if the model exists, but that did not work. I know the code is long and out of context, I'm just really hoping someone spots a solution, I'm out of ideas. The error message from my terminal Traceback (most recent call last): File "c:\users\perni\projects\otree-core\env\lib\site-packages\django\db\backends\utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "c:\users\perni\projects\otree-core\env\lib\site-packages\django\db\backends\sqlite3\base.py", line 383, in execute return Database.Cursor.execute(self, query, params) sqlite3.OperationalError: no such table: otree_roomstest The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\perni\Projects\otree-core\env\Scripts\otree-script.py", line 11, in <module> load_entry_point('otree', 'console_scripts', 'otree')() File "c:\users\perni\projects\otree-core\otree_startup\__init__.py", line 185, in execute_from_command_line fetch_command(subcommand).run_from_argv(argv) File "c:\users\perni\projects\otree-core\env\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "c:\users\perni\projects\otree-core\env\lib\site-packages\django\core\management\base.py", line 361, in execute self.check() File "c:\users\perni\projects\otree-core\env\lib\site-packages\django\core\management\base.py", line 390, in check include_deployment_checks=include_deployment_checks, File "c:\users\perni\projects\otree-core\env\lib\site-packages\django\core\management\commands\migrate.py", line 65, in _run_checks issues.extend(super()._run_checks(**kwargs)) … -
Connect to a websocket in a Django ASGI application
I want to run my Django application as usual but at the same time also connect to a websocket and receive events from there that feed into my main Django code. How would I go about doing that? -
Store API response in PostgreSQL
I'm trying to store the response from an API as a field in my postgreSQL table. I receive the data I'm trying to save like this { "count": 0, "next": null, "previous": null, "results": [ { "slug": "slug", "name": "name", "other": [] "things": "string" }, { etc... } } I'm trying to save the results key and everything contained in the corresponding list. Initially I thought I could do search_results = ArrayField(models.CharField(null=True, blank=True), size=3, null=True) but this seems to make it difficult to actually access the information from the keys since it's saving the entries as plain strings. I'm looking for the best way to go about this. Thanks! -
Using npm and Django together?
I developed the frontend using React JS, and I'm having issues with gluing those separate JS and npm modules to my Django backend. Are there any good libraries tackling this issue, or best practices? I'd like to keep the frontend separated from Django. -
Django URL does not see the link and its POST request
I made a project, but in it you need to get a special token from the VK social network. I made the token pass along with the link. She looks like this: http://127.0.0.1:8000/vk/auth#access_token=7138dcd74f5da5e557943b955bbfbd9a62811da7874067e5fa0edef1ca8680216755be16&expires_in=86400&user_id=397697636 But the problem is that the django cannot see this link. I tried to look at it in a post request, get request, but everything is empty there. I tried to make it come not as a request but as a link, it is like this: http://127.0.0.1:8000/vk/auth #access_token=7138dcd74f5da5e557943b955bbfbd9a62811da7874067e5fa0edef1ca8680216755be16&expires_in=86400&user_id=397697636 But the django does not want to read the space. Who can help -
How do you correctly mock a 3rd-party module in Django
I'm trying to write a simple unit test to test an instance method of one of my models in Django. However my class initialises an external connection on __init__ which is not being patched even though I'm trying to target it. Folder Structure: - project/ - app1/ - tests/ - tests_models.py - models.py models.py: from 3rdPartyPlugin import Bot class MyClass: def __init__(self, token): self.bot = Bot(token) def generate_buttons(self): ... tests_models.py: from django.test import TestCase from unittest.mock import MagicMock, patch from app1.models import MyClass @patch('app1.models.3rdPartyPlugin.Bot') class GenerateButtonsTestCase(TestCase): def setUp(self): self.tb = MyClass('', '', '') def test_generates_button_correctly(self): return True I can't get past the setUp step because the initialisation of the class fails because it tries to reach out to that 3rdPartyPlugin module even though I patched it. I've tried setting the patch to: @patch('app1.models.3rdPartyPlugin.Bot') @patch('app1.models.Bot') @patch('app1.models.TB.Bot') But all of the above still leads to the Bot being called. Any suggestions? -
STORE_ENGINE Error deploying Django App to Heroku
I am receiving a mysterious error when trying to deploy my django + react.js app to heroku. AttributeError: 'Settings' object has no attribute 'STORE_ENGINE' and also logger.error(f'StoreEngineFailure KNOX_STORE_ENGINE={settings.STORE_ENGINE} I can not find any reference to adding a 'STORE_ENGINE' setting to settings.py in any related documentation or other questions on this site. I am using djangorestframework==3.11.0 knox==0.0.23 gunicorn==20.0.4 whitenoise==5.1.0 django-heroku django_rest_knox==4.1.0 here is my settings.py import os from corsheaders.defaults import default_headers import django_heroku # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '92(sb@talx3&(5d)@u6x0qxxf*gs2(i-b&g*d_3)fb4xvcb91v' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True # Add current https url here and to facebook api for authentication ALLOWED_HOSTS = ['127.0.0.1', 'localhost', 'easysocialads.herokuapp.com'] # Application definition INSTALLED_APPS = [ 'facebook_ads.apps.FacebookAdsConfig', 'pages.apps.PagesConfig', 'frontend.apps.FrontendConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', #Django Rest Framework 'rest_framework', #Social Auth 'social_django', #Rest Social Auth 'rest_social_auth', #React Frontend App #Auth 'knox', 'accounts', 'corsheaders', ] REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ('knox.auth.TokenAuthentication',) } MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'corsheaders.middleware.CorsMiddleware', #Social Auth 'social_django.middleware.SocialAuthExceptionMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', ] ROOT_URLCONF = 'easysocialads.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ #Backend Route #os.path.join(BASE_DIR, … -
How can I use the 'uwsgi_params' file?
I've completed a tutorial on how to set up an nginx-uwsgi-django server. Part of the tutorial was to put a copy of uwsgi_params from the nginx github onto my server. Then, to use that file in the server configuration: server { ... location / { uwsgi_pass django; include /path/to/your/mysite/uwsgi_params; # the uwsgi_params file you installed } } The only explanation it gives for the file is: What is the uwsgi_params file? It’s convenience, nothing more! For your reading pleasure, the contents of the file as of uWSGI 1.3: I'd like a more detailed explanation on the importance of this file. How is this a convenience for me? Am I meant to use them as environmental variables somehow? If so, could you please give a simple use case example? -
dj-rest-auth error when restarting server
I'm using https://dj-rest-auth.readthedocs.io/en/latest/index.html. It works the first time (just after the installation and adding everything), but when I restart VS Code, I can't run the server again. Here is what I get: Exception ignored in thread started by: <function check_errors.<locals>.wrapper at 0x034DA268> Traceback (most recent call last): File "D:\Library\Logiciels\Python\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "D:\Library\Logiciels\Python\lib\site-packages\django\core\management\commands\runserver.py", line 112, in inner_run autoreload.raise_last_exception() File "D:\Library\Logiciels\Python\lib\site-packages\django\utils\autoreload.py", line 248, in raise_last_exception raise _exception[2] File "D:\Library\Logiciels\Python\lib\site-packages\django\core\management\__init__.py", line 327, in execute autoreload.check_errors(django.setup)() File "D:\Library\Logiciels\Python\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "D:\Library\Logiciels\Python\lib\site-packages\django\__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "D:\Library\Logiciels\Python\lib\site-packages\django\apps\registry.py", line 89, in populate app_config = AppConfig.create(entry) File "D:\Library\Logiciels\Python\lib\site-packages\django\apps\config.py", line 90, in create module = import_module(entry) File "D:\Library\Logiciels\Python\lib\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 'dj_rest_auth' settings.py: INSTALLED_APPS = [ ... 'django.contrib.sites', # 3rd party 'rest_framework', 'rest_framework.authtoken', 'dj_rest_auth', 'allauth', 'allauth.account', 'allauth.socialaccount', 'dj_rest_auth.registration', 'corsheaders', ... REST_SESSION_LOGIN = True EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' SITE_ID = 1 ACCOUNT_EMAIL_REQUIRED = False ACCOUNT_AUTHENTICATION_METHOD = 'username' ACCOUNT_EMAIL_VERIFICATION = 'none' REST_USE_JWT = True JWT_AUTH_COOKIE = 'auth' REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.TokenAuthentication', 'dj_rest_auth.utils.JWTCookieAuthentication' ), 'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema' } … -
Replace existing file after uploading a new file
I have a scenario where , I have a svg in my Static Images folder which i am using to display a image on a webpage Now I want if i upload a new svg using <input type="file"> It will replace that existing svg Need some suggestions Thanks in advance -
"[HMR] Waiting for update signal from WDS.. : react console
I am new to react and using React + Django to create a todo app, When I try to console.log anything it gives me this error in the console [HMR] Waiting for update signal from WDS.. I tried to look online, but nothing works. this is the error on my page -
How would I print a model fields from oldest to newest?
I've created a budget app that lists your income and expenses. And instead of listing most recent evemts at the top it lists them in the bottom. Is there anyway I could reverse the list or sort by most recent? Here are some of my folders and my django project. Let me know if I need to add any others, I'm a beginner. HTML file Views Models Django Project, as you can see the most recent are at the bottom -
Django==3.0.7 FileNotFoundError
I know that no is the best way. But I want to know why not find the file. The path is ok. I dont understand that. My views.py and urls.py: The archives path: -
formset for OneToOne fields
I have three models in my Django app: class Parent (models.Model): pass class Sister(models.Model): pass class Brother(models.Model): owner = models.ForeignKey(to=Parent, on_delete=models.CASCADE) sibling = models.OneToOneField(to=Sister, on_delete=models.CASCADE) I need to let users choose for which Sister instances they want to create a corresponding Brother when I create a new Parent (Sisters as you can see are not connected to a Parent). The way I see it that when a user in a ParentCreateView I would also show them the list of all existing Sisters where they can put checkboxes in front of those for whom they would create a corresponding Brother. Then when they submit, a new Parent is created and corresponding number of Brothers attached to the sisters that have been chosen, and to a Parent that just has been created. I can't figure out though the right design: should I use inlineformsetfactory for that? Should I pass there existing sisters? Or I can just pass a checkbox field with existing sisters to a form where new Parent is created, and then create corresponding brothers in a post method of CreateView class.