Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django - How to display specific content in a template
Django newbie question - I need to display a specific entry in a template. So far I have not been able to get this to work. I have the following code: model: class BasicPage(models.Model): title = models.CharField(max_length=200) body = HTMLField() def __str__(self): return self.title view: class TermsPageView(TemplateView): model = BasicPage template_name = 'terms.html' def get_queryset(self): body = BasicPage.objects.filter(id=1) return body template: {% block content %} <h1>{{ body.title }}</h1> {% endblock content %} -
Profile Page for all Users blogs Django
everyone. I'm building a blog site and each user has a profile that should list their written blogs. But I'm finding it difficult to make a reference to individual users. My Views class ShowProfilePageView(LoginRequiredMixin, DetailView): model = UserProfile template_name= 'registration/user_profile.html' def get_context_data(self, *args, **kwargs): context = super(ShowProfilePageView, self).get_context_data(*args, **kwargs) page_user = get_object_or_404(UserProfile, id=self.kwargs['pk']) user = self.request.user user_posts = Post.objects.filter(author= user).order_by('-post_date') context['page_user'] = page_user context['user_posts'] = user_posts return context Note: The user, defined in the view above is self.request.user and this makes all the user profiles list out the blogs of the current logged in user instead of been based on particular users. Models The Post/Blog model class Post(models.Model): title = models.CharField(max_length=225) header_image = models.ImageField(blank= True, null=True, upload_to='images/header_image') author = models.ForeignKey(User, on_delete=models.CASCADE) body = RichTextField(blank=True, null=True) post_date = models.DateField(auto_now_add = True) category = models.CharField(max_length=225) snippet = models.CharField(max_length=70) UserProfile models The user profile models class UserProfile(models.Model): user = models.OneToOneField(User, null=True, on_delete = models.CASCADE) bio = models.TextField(max_length=160) profile_pic = models.ImageField(blank= True, null=True, upload_to='images/profile_pics') website_url = models.CharField(max_length=250, null = True, blank = True) twitter_url = models.CharField(max_length=250, null = True, blank = True) github_url = models.CharField(max_length=250, null = True, blank = True) linkedin_url = models.CharField(max_length=250, null = True, blank = True) dribble_url = models.CharField(max_length=250, null … -
What's the best way to return to the previous page after Post? (Not login)
After a user updates a record and hits the 'Post' button, what's the best way to redirect them to the previous page? I know there's a potential issue with using the HTTP_REFERER method however the user will be using not be using a browser with custom settings. This does not work (it only refreshes the page) def form_valid(self, form): form.instance.fk_user = self.request.user form.save() return HttpResponseRedirect(self.request.META.get('HTTP_REFERER')) def test_func(self): post = self.get_object() if self.request.user == post.fk_user: return True return False If I remove the 'self.' i recieve an error where 'name 'request' is not defined' -
What framework should I use for my project?
all the developers, I am a member of a programming team and we want to create a large scale web application that requires a lot of user interactions and databases. 3 members of our team have experience with python and C#, 2 members have with javascript(the one has python too). Which framework is better for this kind of web application? Which one will take less time to code? 1.Django 2.Flask 3.MERN stack 4.ASP.Net Thanks before :) -
Beanstalk cannot connect to rds instance
Im in a similar boat to the user on this question; Connecting the elastic beanstalk environment with existing RDS instance I have a Codestar project (Django via Beanstalk) and i cannot get the application to access any rds instances. When attempting to deploy during the testing step (python manage.py test) the following error message is thrown; django.db.utils.OperationalError: could not connect to server: Connection timed out Is the server running on host "172.31.44.126" and accepting TCP/IP connections on port 5432? Things ive already tried Running locally works fine via django and psql using ipaddress and public hostname (name.key.eu-west-2.rds.amazonaws.com) both work fine locally and provide the same error message when deploying Connecting to rds via the EC2 instance This works fine connecting via local ip and name. Queries such as \d and \l return fine indincating the instance can see the database. Changing vpc / subnets Both EC2 and rds instances are in the same vpc (only have one) and subnet (eu-west, availability group 2a) Spinning up an attached beanstalk rds instance I have tried dedicated rds instances and a connected instance using the EBS tool and the application has been unable to connect to either. Settings.py if 'RDS_DB_NAME' in os.environ: DATABASES … -
Django Nested Serializer
I am pretty new to DRF/Django and want to create an endpoint that returns nested json from multiple models in the format: { "site": { "uuid": "99cba2b8-ddb0-11eb-bd58-237a8c3c3fe6", "domain_name": "hello.org" }, "status": "live", "configuration": { "secrets": [ { "name": "SEGMENT_KEY", # Configuration.name "value": [...] # Configuration.value }, { "name": "CONFIG_KEY", "value": [...] }, "admin_settings": { 'tier'='trail', 'subscription_ends'='some date', 'features'=[] } Here are the models: class Site(models.Model): uuid = models.UUIDField( default=uuid.uuid4, editable=False, unique=True) domain_name = models.CharField(max_length=255, unique=True) created = models.DateTimeField(editable=False, auto_now_add=True) modified = models.DateTimeField(editable=False, auto_now=True) class AdminConfiguration(models.Model): TRIAL = 'trial' PRO = 'pro' TIERS = [ (TRIAL, 'Trial'), (PRO, 'Professional'), ] site = models.OneToOneField( Site, null=False, blank=False, on_delete=models.CASCADE) tier = models.CharField( max_length=255, choices=TIERS, default=TRIAL) subscription_ends = models.DateTimeField( default=set_default_expiration) features = models.JSONField(default=list) class Configuration(models.Model): CSS = 'css' SECRET = 'secret' TYPES = [ (CSS, 'css'), (SECRET, 'secret') ] LIVE = 'live' DRAFT = 'draft' STATUSES = [ (LIVE, 'Live'), (DRAFT, 'Draft'), ] site = models.ForeignKey(Site, on_delete=models.CASCADE) name = models.CharField(max_length=255, blank=False) type = models.CharField( max_length=255, choices=TYPES) value = models.JSONField( null=True) status = models.CharField( max_length=20, choices=STATUSES) Logic behind serializer/viewset to achieve mentioned json: retrieves lookup_field: uuid filters query param: Configuration.status (either live or draft filters AdminConfiguration on site id (something like AdminConfiguration.objects.get(Site.objects.get(uuid)) filters Configuration on … -
ManyToManyField does not show
Want to use REST API to populate my tables but my field does not display on the API page. Models (Series, Roster): class Series(models.Model): (...) def __str__(self): return self.title class Roster(models.Model): (...) series = models.ManyToManyField(Series) (...) def __str__(self): return self.name Serializers: class SeriesSerializer(serializers.ModelSerializer): class Meta: model = Series fields = ('id', 'title', 'icon') read_only_fields = ('slug',) class RosterSerializer(serializers.ModelSerializer): series = SeriesSerializer(many=True, read_only=True) class Meta: model = Roster fields = ('id', 'name', 'number', 'primary_color', 'secondary_color', 'image', 'series') Views: class SeriesView(viewsets.ModelViewSet): serializer_class = SeriesSerializer queryset = Series.objects.all() class RosterView(viewsets.ModelViewSet): serializer_class = RosterSerializer queryset = Roster.objects.all() Unsure where I am mistepping here. -
DRF how to get items grouping by categories
I understand that my question is repeated often, but i'm stuck with this. I want to make simple api with DRF. I have two models: models.py class Rubrics(models.Model): id = models.AutoField(primary_key=True) rubric = models.CharField(max_length=255, blank=True, null=True) class Books(models.Model): id = models.AutoField(primary_key=True) title = models.CharField(max_length=255, blank=True, null=True) author = models.CharField(max_length=255, blank=True, null=True) date = models.CharField(max_length=255, blank=True, null=True) rubrics = models.ForeignKey('Rubrics', on_delete=models.DO_NOTHING, related_name='books', blank=True, null=True) I'd like to view serialized result like this: [ rubric1: [ { title: "title1", author:"author1" }, book_obj2, so on ], rubric2: [ book_obj4, book_obj5 ] ] my views.py: class BooksByRubricView(APIView): """List of books by rubrics""" def get(self, request): last_date = Books.objects.latest("date").date books_last = Books.objects.filter(date=last_date) serializer = RubricsSerializer(books_last, many=True) return Response(serializer.data) I try a lot of examples in this theme, sorry this garbage class BookSerializer(serializers.ModelSerializer): class Meta: model = Books #fields = ("title",) exclude = () class RubricsSerializer(serializers.ModelSerializer): rubrics = BookSerializer(read_only=True) class Meta: model = Rubrics fields = ("rubrics",) #exclude = () """ class RubricSerializer(serializers.ModelSerializer): #rubrics = serializers.PrimaryKeyRelatedField(many=True, read_only=True) #books = RecursiveSerializer(many=True) #print(books) rubrics = RubricSerializer(read_only=True) #books = BooksListSerializer(many=True) class Meta: model = Books fields = ("title", "rubrics",) #fields = ['rubric', 'rubrics'] #fields = ['books', 'rubrics'] """ but maybe i don't understand principles of reverse relationships and serializing … -
Can't host my django website on shared hosting
I am trying to deploy my django project on shared hosting. I am trying from couple of hours but still now I can't host my django website and getting "Internal Server Error Error 500". this is my root passenger_wsgi.py from my_root_folder_name.wsgi import application #setting.py ALLOWED_HOSTS = ['mydomain.com','www.mydomain.com'] I also installed python app and django on my server. Now I am hopeless. I am trying from last five hours for host an website but still now I can't. Where I am doing mistake??? I am seeing those error from error log: File "/home/sellvqed/virtualenv/farhyn.com/3.8/lib/python3.8/site-packages/django/apps/registry.py", line 83, in populate raise RuntimeError("populate() isn't reentrant") RuntimeError: populate() isn't reentrant -
Why i get results of this ajax call instantly though I have async code?
I am studying async programming with Python and I cannot get why I get instant answer when I call route corresponding to this call (I call it as ajax call, platform is Django, this file is views.py file in Django app)? (When I click on button ajax calls buy method, it simulates buying some stock with sandbox and returns result, I want it to wait 5 secs and then return result, instead I get results of ajax call nearly immediately) async def buy(request): figi = request.GET.get('figi', 'missing') data = { 'result': 'success', 'figi': figi } SANDBOX_TOKEN = 'some_token' async def buy_stock(): try: async with TinkoffInvestmentsRESTClient( token=SANDBOX_TOKEN) as rest: order = await rest.orders.create_market_order( figi="BBG000BTR593", lots=1, operation=OperationType.BUY, ) await asyncio.sleep(5) result = await rest.orders.create_limit_order( figi="BBG000BTR593", lots=1, operation=OperationType.SELL, price=50.3, ) return 'result' except TinkoffInvestmentsError as e: print(e) result = await buy_stock() return JsonResponse({ 'result': 'success', 'message': result }, safe=False) In other words, seems call doesn't wait for async methods to finish and immediately sends JsonResponse -
How to upload a form image that comes in a request.FILES[] to an ImageField in my django db?
The problem here is that when I "upload" the image, it doesn't make any changes where it should It lets me make the upload with no errors but as I said, it doesn't update un db or anywhere. I need to write more to post this as I have too much code so dont read this part in parenthesis (Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra augue sed pharetra lobortis. Mauris sit amet pellentesque felis. Integer in magna nec enim placerat imperdiet vitae et justo. Integer vel est ultricies, faucibus urna id, consequat eros. Integer venenatis ut nisi a aliquam. Morbi leo sem, dictum porttitor nibh id, condimentum pellentesque purus. Quisque pellentesque et nibh nec hendrerit. Suspendisse in nulla urna. Nam sit amet congue quam. Duis tellus enim, tincidunt ac est eget, lobortis accumsan orci. Mauris laoreet iaculis ornare. Maecenas eget urna malesuada dolor mollis efficitur. Nullam vehicula vel justo nec suscipit. Morbi fermentum libero urna, feugiat tincidunt felis pharetra ut. Vestibulum at erat sed massa sodales malesuada et eget justo. Fusce at iaculis quam, non elementum quam.) This is my model from django.db import models from django.utils.timezone import now from django.contrib.auth.models import User from ckeditor.fields import … -
Django url re_path failed to redirect to the correct view
Django re_path did not match and I don't know the reason why. urls.py urlpatterns = [ .. re_path(r'^localDeliveryPayment\?paymentId\=(?P<UUID>[0-9-a-z]{32})$', verifyMobilePayReceived.as_view()), re_path(r'^localDeliveryPayment$', Payment.as_view(), name = 'localDeliveryPayment'), .. ] If url www.example.com/localDeliveryPayment the user is directed to Payment view. If url www.example.com/localDeliveryPayment?paymentId=00340000610febab0891e9008816d3e9 the user should be directed to verifyMobilePayReceived view. The problem is that right now www.example.com/localDeliveryPayment?paymentId=00340000610febab0891e9008816d3e9 is still directed to Payment view. -
NoReverseMatch in Django but no clear issues
I've been reading other solutions to this but none of them apply to my project. It's a database of family pictures. The Problem On the list view, which works fine, there are two types of links - one at the top of the page to create a new record and one for each of the listed items to update the selected record. When clicking either, I get the following error. If I simply enter the URLs, I also get the same error. NoReverseMatch at /stories/l_memories_update_people/4 Reverse for 'memories_people' not found. 'memories_people' is not a valid view function or pattern name. . Models class memories_people(models.Model): fk_user = models.ForeignKey(User, default='1', on_delete=models.CASCADE) name = models.CharField(max_length=750, default='', blank=True, null=True) def __str__(self): return self.name class Meta: ordering = ('name', ) Views class v_memories_list_people(LoginRequiredMixin, ListView): model = memories_people template_name = 'storiesapp/t_memories_list_people.html' context_object_name = 'people' ordering = ['name'] class v_memories_update_people(LoginRequiredMixin, UserPassesTestMixin, UpdateView): model = memories_people fields = ['fk_user', 'name'] template_name = 'storiesapp/t_memories_update_people.html' def form_valid(self, form): form.instance.fk_user = self.request.user form.save() return HttpResponseRedirect(self.request.path_info) def test_func(self): post = self.get_object() if self.request.user == post.fk_user: return True return False URLs path('l_memories_list_people',v_memories_list_people.as_view(), name='r_memories_list_people'), path('l_memories_update_people/<int:pk>',v_memories_update_people.as_view(), name='r_memories_update_people'), Template (List) {% load static %} {% load crispy_forms_tags %} {% load render_table from django_tables2 %} {% load … -
Can 2 urls file in the same app have the same app name in Django?
The question is honestly completely self-explanatory. Can 2 urls.py files in the same app have the same app_name in Django? -
Django - import processes breaks if multiple S3 backends configured
I have a import process that should fetch multiple S3 backends for objects. Actually the process is working fine if I just have a single s3 backend configured. As soon as I have multiple S3 backends setup to fetch data from, my whole import process fails as no entries are written to my "Files" table. I have my import process packed as a celery task, please see below: @app.task(name="Fetch Descriptor JSON", base=Singleton) @transaction.atomic def fetch_descriptors(*args, **kwargs): keys = [] urls = [] for resource in S3Backend.objects.filter(backend_type=0): endpoint = resource.endpoint bucket = resource.bucket access_key = resource.access_key secret_key = resource.secret_key region = resource.region for obj in s3_get_resource(endpoint=endpoint, access_key=access_key, secret_key=secret_key, region=region).Bucket(bucket).objects.all(): keys.append(obj.key) for key in keys: descriptor = s3_get_client(endpoint=endpoint, access_key=access_key, secret_key=secret_key, region=region).generate_presigned_url( ClientMethod='get_object', Params={'Bucket': bucket, 'Key': key}, ExpiresIn=432000, ) new_file, create = Files.objects.get_or_create(descriptor=strip_descriptor_url_scheme(descriptor), file_path=key, file_name=Path(key).name, s3_backend=resource ) urls.append(descriptor) workflow_extract_descriptors = ( group([extract_descriptors.s(descriptor) for descriptor in urls]).apply_async() ) Are there maybe any problems with my for loop construct if S3Backend.objects.filter(backend_type=0) returns more than one entry? Thanks in advance -
Creating a blockchain game integrated on the web using python
Basically i need advice on which packages / frameworks to use in order to create this. My goal is to create a sort of cards/dice game (its called orlog) and im planning to use web3 to fetch a players data from the blockchain The game is in browser as well so i dont know what to use, whether its pygame + opengl django web framework etc etc Note: the game will be online 1 vs 1 -
How can I implement a database (ER) table where the values of a foreign key depend on another foreign key within the same table? (Django, e-commerce)
Please bare with me as I am a newbie to database design. I am trying to implement an e-commerce store in Django with product variations as shown in the attached image. For the ProductVariations model/table, I would like to have a foreign key for Options (which would represent something like size) and then based on that foreign key, I would like to have another foreign key for OptionValues (e.g. small). The possible values for the latter foreign key should be limited by the former foreign key. More specifically, I want don't want the drop-down in the admin site to display "small, red, blue, 32, 33, large" when the previous foreign key was "size". In that case, I would only want it to display "small, large". How do I go about doing this? I'd be grateful for any ideas either specific to Django or just database design in general. Image of my ER model. I might consider also adding the Product relationship to the Option which would mean now the option_value depends on the option which depends on the product. -
Django - creating super user
I created the model User And i added this two lines " is_superuser=models.BooleanField(default=False) is_staff=models.BooleanField(default=False)" just to by pass the probleme and create a super user by the model not the default one but this can't be the solution to my probleme i need to create a default django super uesr from django.db import models from django.contrib.auth.models import AbstractUser class User(AbstractUser): first_name= models.CharField(max_length=30) last_name= models.CharField(max_length=30) cin = models.IntegerField() username= models.CharField(max_length=30,unique=True) password= models.CharField(max_length=30) codeQR = models.CharField(max_length=30) poste = models.CharField(max_length=30) image = models.CharField(max_length=30) email = models.EmailField() telephone= models.IntegerField() is_superuser=models.BooleanField(default=False) is_staff=models.BooleanField(default=False) USERNAME_FIELD = 'username' REQUIRED_FIELDS = [] class pointage(models.Model): entre = models.CharField(max_length=30) sortie = models.CharField(max_length=30) retard = models.CharField(max_length=30) absance = models.CharField(max_length=30) user = models.ManyToManyField(User) class salaire(models.Model): mois = models.IntegerField() heurs_base= models.FloatField() heurs_sup = models.FloatField() primes = models.FloatField() total = models.FloatField() user = models.ManyToManyField(User) But i get the following error PS C:\py\pointage> py manage.py createsuperuser Username: a Password: Password (again): Error: Your passwords didn't match. Password: Password (again): The password is too similar to the username. This password is too short. It must contain at least 8 characters. This password is too common. Bypass password validation and create user anyway? [y/N]: y Traceback (most recent call last): File "C:\Users\moezm\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\utils.py", line 84, in _execute return self.cursor.execute(sql, … -
How to connect many to many relationaship if I save them via form.save() (django)?
This link https://docs.djangoproject.com/en/3.2/topics/db/examples/many_to_many/ explains that I need to make an object of the class to save the connection. Because I have many fields in my classes I used form.save() to save them, but that doesn't fill the connection ManyToMany in the class. How to fill that field? def create(response): if response.method == "POST": if "next" in response.POST: form = CreateNewPerson(response.POST) form.save() form2 = CreateNewDog() # form doesn't have filed many_to_many to Person, but class Dog does class CreateNewDog(forms.ModelForm): class Meta: model = Dog fields = ['name','years_old', 'sex', 'blood_type', 'image'] class Dog(models.Model): owner = models.ForeignKey(Person, on_delete=models.SET_NULL, null=True) user = models.ManyToManyField(User) -
Django save a change to Database
I'm trying to update the is_admin column of the model user_profile. I've written the following code in views.py but it's not updating in the DB. How can I save the change (user_object[0].is_admin = True) to the database? def post(self, request, format=None): users_provided = request.data.get('user_ids') for each_user in users_provided: user_object = UserProfile.objects.filter(user__is_active=True, user_id=each_user) if (user_object.exists()): user_object[0].is_admin = True user_object.update() -
reques.POST.get, always returns none
I'm trying to get the value of the template's select field, using request.POST.get. But even with the correct name the value that the view receives and always None, can someone help me how to solve this? Here are the codes: view: def efetuar_pagamento(request, id_pagamento): if request.POST: objPagamento = Pagamento.objects.select_related( "Matricula", "FormaPagamento").get(pk=id_pagamento) valorPago = request.POST.get("Valor_%s" % id_pagamento, None) formaPaga = request.POST.get("Forma_%s" % id_pagamento, None) print(formaPaga, valorPago) objFormaPG = FormaPagamento.objects.get(pk=formaPaga) objPagamento.ValorParcial = valorPago.replace(',', '.') objPagamento.FormaPagamento = objFormaPG objPagamento.save() if objPagamento.ValorParcial < objPagamento.Matricula.Plano.Valor and objPagamento.ValorParcial: objPagamento.Status = "PC" elif objPagamento.ValorParcial >= objPagamento.Matricula.Plano.Valor: objPagamento.Status = "PG" Template: <div class="body table-responsive"> <table class="table table-bordered table-striped table-hover js-basic-example dataTable"> <thead> <tr> <th>Data Vencimento</th> <th>Status Pagamento</th> <th>Valor Total</th> <th>Valor Pago</th> <th>Ações</th> </tr> </thead> <tbody> {% for objPagamento in listPagamentos %} <tr> <td>{{objPagamento.DataVencimento}}</td> <td>{{objPagamento.get_Status_display}}</td> <td>{{objMatricula.Plano.Valor}}</td> <td>{{objPagamento.ValorParcial|default_if_none:"0,00"}}</td> <td> {% if objMatricula.Plano.Valor >= objPagamento.ValorParcial %} <a type="button" class="btn btn-primary waves-effect" data-toggle="modal" data-target="#id_Status_{{objPagamento.id}}" data-toggle="tooltip" data-placement="top" title="Pagar!"><i class="material-icons" >attach_money</i></a> {% else %} <a type="button" class="btn btn-success waves-effect" data-toggle="tooltip" data-placement="top" title="Liquidado!"><i class="material-icons" >price_check</i></a> {% endif %} </td> </tr> <div class="modal fade" id="id_Status_{{objPagamento.id}}" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title" id="defaultModalLabel"> <p>Efetuar Pagamento</p> </h4> </div> <form action="{% url 'efetuar_pagamento' objPagamento.id %}" id="id_form_{{objPagamento.id}}" method="POST"> {% csrf_token %} <div class="modal-body col-xs-12"> <h4>Valor … -
How to integrate Tron (TRX) crypto currency with python ? I am confused in their code can someone please help me to understand their code
import requests url = "https://api.trongrid.io/wallet/createtransaction" payload = "{\n \"to_address\": \"41e9d79cc47518930bc322d9bf7cddd260a0260a8d\",\n \"owner_address\": \"41D1E7A6BC354106CB410E65FF8B181C600FF14292\",\n \"amount\": 1000\n}" headers = { 'Content-Type': "application/json", 'TRON-PRO-API-KEY': "25f66928-0b70-48cd-9ac6-da6f5465447c663" } response = requests.request("POST", url, data=payload, headers=headers) print(response.text) I am creating a django based app where I will accept payments in Tron My Doubt is Do I have to keep "to_address"\ and "Owner Address"\ in code Where to pass Owners address and Clients address [as they have specified in the code Owner_address but to_address means we are paying "to" (someone) so I am not sure where to pass which address.] so where to pass owner's address as it is written in code but their is also to_address so I am confused with to_address and owner_address please help me to understand this, Thank you. -
Pre-populating Selected Values in Django Admin FilteredSelectmultiple Widget
I want to be able to set some default selected users on the right side of a Django Admin FilteredSelectMultiple widget. This is my model: class UserAdminForm(forms.ModelForm): users = forms.ModelMultipleChoiceField( queryset=User.objects.all(), widget=FilteredSelectMultiple("Users", is_stacked=False)) class Meta: model = User exclude = () Is there a way to do this with JavaScript so that I don't have to hand-select these defaults each time I create a new item? -
Not showing the Form in html
This is my model class showroom(models.Model): serialno=models.IntegerField(db_index=True,primary_key=True) carname=models.CharField(max_length=50) carmodel=models.CharField(max_length=50) price=models.IntegerField() rating=models.IntegerField(validators=[MinValueValidator(1),MaxValueValidator(5)]) This is my forms.py class RegisterForm(ModelForm): class Meta: model = showroom fields =("__all__") views.py class carform(CreateView): model = showroom form_class=RegisterForm template_name = "carbrand/carregister.html" context_object_name='registerform' html page {% block content %} {{registerform}} {% endblock content %} It's just showing a blank screen. I have imported all the necessary classes and views. It will make this too long for you so i removed it.can anyone please tell me if anything wrong in my view/form. -
How can i implement advanced search in django?
How can i implement advanced search like the below image in Django? I want the user can selects OR/AND operator. When I searched, I don't want the page to be refresh. What is the best technique for doing that? Ajax, rest framework, or other things...?