Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django/DRF Decimal Field filter not working
Here is my models field: latitude = models.DecimalField( _('latitude'), max_digits=20, decimal_places=17, blank=True, null=True) Now in django shell In [34]: GeoLocation.objects.first().latitude Out[34]: Decimal('28.64871730000000000') In [35]: Decimal('28.64871730000000000') ...: Out[35]: Decimal('28.64871730000000000') Above line [Out]34 and [Out]35 is same But the filter is not working. In [36]: GeoLocation.objects.filter(latitude=Decimal(28.64871730000000000)) Out[36]: <QuerySet []> In [37]: GeoLocation.objects.filter(latitude=Decimal('28.64871730000000000')) Out[37]: <QuerySet []> -
How to set background image in django framwork?
I was searching for 2 days how to set background image in django but i couldn't find any of them useful.i have these files in my django project.please help me how to set background image in my project and explain the code. thanks in advance. my project -
rest_framework TypeError e.indexOf is not a function
I'm new to django, I follow a tutorial from udemy (tweetme) While setting-up rest_framework to load serialized data as json, I get the Error : TypeError: e.indexOf is not a function in : jquery-3.3.1.min.js:2:82466 I just used serialized classes and simple view to display my data, (I got the display but still have the error) error_screenshot Thank you! here is my code: in "/tweets/models.py": from django.conf import settings from django.db import models class Tweet(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, default = 1,on_delete=models.CASCADE) content = models.CharField(max_length=150, default="") boolean = models.BooleanField(default=True) timestamp = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) in "/tweets/api/views.py": from rest_framework import generics from .serializers import TweetSerializer from tweets.models import Tweet class TweetListApiView(generics.ListAPIView): serializer_class = TweetSerializer def get_queryset(self): return Tweet.objects.all() in "/tweets/api/serializers.py": from rest_framework import serializers from tweets.models import Tweet class TweetSerializer(serializers.ModelSerializer): class Meta: model = Tweet fields = [ "user", "content", "boolean", "timestamp" ] -
Multiple buttons in html, same view, different values
I'm trying to have my html display a session.counter on an HTML page. The counter should increment by a random number, with 4 different options for the range at which it increments (based on buttons). So far, I have all their actions routing to the same view, but I'm not sure how to code the values into the view! Can I nest multiple if-checks into the view? If so, do I need to redirect immediately after each check, or can it be after the if-checks? Here's the views.py: def process_gold(request): reap = random.randrange(50,200) weave = random.randrange(35,50) summon = random.randrange(-200,200) war = random.randrange(-2000,2000) if request.method == 'POST': if goldCount not in request.session: goldCount = 0 ##will be displayed on HTML as the counter request.POST['reap'] = reap request.POST['weave'] = weave request.POST['summon'] = summon request.POST['war'] = war if reap in request.POST: goldCount += reap if weave in request.POST: goldCount += weave if summon in request.POST: goldCount += summon if war in request.POST: goldCount += war return redirect('/') Here's my html: <div id="goldCount"> </div> <div id="goldNode"> <h2>Blood Lotus Master</h2> <h3>It is said that when the blood lotus blooms, the night itself holds its breath. Cloaked in heavy scarlet cloth and midnight black leather, this … -
Reverse Get item by foreign key django template
I'm trying to build CMS like menu models. So in MODELS.PY: class MenuItem(models.Model): class Meta(): db_table = "menu_item" verbose_name = "Menu Item" verbose_name_plural = "Menu Items" menu_item_title = models.CharField( verbose_name="Menu Item Custom URL title", max_length=200, blank=False, null=False, ) menu_item_type = models.ForeignKey( MenuType, related_name="menu_item_type_key", blank=False, null=False, ) class MenuItemCustomUrl(models.Model): class Meta(): db_table = "menu_item_custom_url" verbose_name = "Menu Item Custom URL" verbose_name_plural = "Menu Items Custom URL" menu_item_custom_url = models.CharField( verbose_name="URL address that points menu item", max_length=200, blank=False, null=False, ) menu_item_custom_url_menu_item = models.ForeignKey( MenuItem, unique=True, on_delete=models.CASCADE, related_name="menu_item_custom_url_menu_item_key", blank=False, null=False ) in VIEWS.PY: def homepage(request): args['menu_items'] = MenuItem.objects.filter(menu_item_menu=args['main_menu']) return render(request, template_page, args) and TEMPLATE: {% for menu_item in menu_items %} <li> <a href="#"> {{ menu_item }} </a> </li> {% endfor %} So, as you see the every menu_item has attached menu_item_custom_url, and what I need is to use menu_item_custom_url value in menu_item loop NOTE: Beside custopm_url type there are also other types with their own parameter... virtualenv, django=1.11, python=3.4, ubuntu=14.04 -
Django | how to show appointment slot of time of fixed date?
I am having a car booking form . and in booking table i want to show a user time slot available for cars and after selecting the time of available i want to save the time into django booking form . please help -
Django Template: Exclude request.user from displaying user list
I have a simple problem. Below html code return list of all users whose liked blog. How can i exclude request user from list of them ? <div class="collapse" id="likes"> <ul> {% for like in instance.likes.all %} <li> {{like}} </li> {% endfor %} </ul> </div> I tried as : {{like |request.user}} or something like this ,but no result. Thanks in advance -
How can all groups and users of that particular group have seperate data from database in django?
Let suppose there is a list of books on our database, each group (will have 3 to 4 users) can view that list and then a user can select any book, so after selecting, that book should only appear in that "user's selected list". That book should not appear in the all books list of the group again means no other user of that particular group can select the same book, nor user can deselect it. The actual database should not be effected. This is an example but I have to implement this functionality in my website. -
Django: a maximum value from a sum of two columns
I need a maximum value from a sum of two columns and if there are a few rows with the same price I want the one with the most recent date. models.py from django.db import models from django.utils import timezone # Create your models here. class Flight(models.Model): outboundPrice = models.FloatField() returnPrice = models.FloatField() timeCreated = models.DateTimeField(default=timezone.now) I'm currently using this query: >>> Flight.objects.values('timeCreated').annotate(max=Max(F('outboundPrice') + F('returnPrice'))).order_by('-max')[0] {'timeCreated': datetime.datetime(2018, 6, 16, 13, 0, 12, 525111, tzinfo=<UTC>), 'max': 205} which translates two the following MySQL query: mysql [lab]> SELECT timeCreated, MAX((outboundPrice + returnPrice)) AS max FROM flights_flight GROUP BY timeCreated ORDER BY timeCreated ASC LIMIT 1; +----------------------------+--------------------+ | timeCreated | max | +----------------------------+--------------------+ | 2018-06-16 13:00:12.525111 | 205.98000000000002 | +----------------------------+--------------------+ 1 row in set (0.00 sec) but that's not the most recent one: mysql [wizzair]> SELECT timeCreated, MAX((outboundBasePrice + returnBasePrice)) AS max FROM flights_result GROUP BY timeCreated ORDER BY timeCreated ASC; +----------------------------+--------------------+ | timeCreated | max | +----------------------------+--------------------+ | 2018-06-16 13:00:12.525111 | 205.98000000000002 | | 2018-06-16 14:00:13.404816 | 205.98000000000002 | | 2018-06-16 15:00:12.927219 | 205.98000000000002 | | 2018-06-16 16:00:12.595076 | 205.98000000000002 | | 2018-06-16 17:00:11.226041 | 205.98000000000002 | | 2018-06-16 18:00:12.692635 | 205.98000000000002 | | 2018-06-16 19:47:51.000000 | 201.98000000000002 | +----------------------------+--------------------+ 7 rows … -
Invalid command 'PassengerAppRoot', perhaps misspelled or defined by a module not included in the server configuration in cpanel apache host
the server return bellow Error when i run the Django in my cpanel host ? what should i do ,Please? Invalid command 'PassengerAppRoot', perhaps misspelled or defined by a module not included in the server configuration -
Accessing distinct foreign key relationships with django queryset
Given basic book/author models: class Book(models.Model): title = models.CharField(max_length=200) author = models.ForeignKey('Author') publisher = models.ForeignKey('Publisher') class Author(models.Model): first_name = models.CharField(max_length=100) last_name = models.CharField(max_length=100) Lets say I have a very complex query to select books based on a bunch of parameters (my actual models are much more complex than these). For simplification sake, my complex query for this example will just select books that have the word "the" in their title: q = Book.objects.filter(title__icontains="the") Is there a way (other than looping, or using reverse foreign key lookups) to get all distinct Author objects linked to the books in this query? E.g. I have tried adding: q = q.values('author').distinct() But this simply returns the author__id values. I am trying to go about it this way, as my 'complex query' is quite time/resource intensive, and I'd only like to run that query once (to get the books, and separate a list of distinct authors). Also the data sets need to be flattened (a separate list of Books and Authors) as it is getting presented via django rest framework, and my clients require the data sets to be flat. E.g.: { "books": [ {"id": 1, "title": "The Book.", "author": 1, "publisher": 1}, {"id": 2, … -
Django - form with foreign key to model with gallery
i have models like this: class Picture(models.Model): source = models.ImageField(null=True, blank=True) #TODO: check the field type, correct if needed def __str__(self): return "%s" % self.pk class News(models.Model): content = MartorField() title = models.CharField(max_length=512) creation_date = models.DateField(default=timezone.now) publish_date = models.DateField(null=True, blank=True) picture_id = models.ForeignKey('Picture', null=True, blank=True, on_delete=models.CASCADE) class Meta: verbose_name_plural = "News" def __str__(self): return "%s" % self.title And i'm using CreateView and UpdateView. When use {{form.as_p}} i have problem, because picker of image is showing only id - not image. I'm looking for some widget or workaround to do this problem. -
How can I use a single gmail address in a MTA (Mail Transfer Application)?
I would like to allow users to send automated emails from a dedicated email address (automated_alerts@my-domain.com). However, in the scripts, I don't want to give users access to the credentials.json so that they can modify the scope. I don't want to use a service that I need to pay for such as Amazon SES. I have looked into resources at the following links below, but I want users to simply specify an html body, any attachments, and the recipients and then forward this on to the MTA. If a user leaves the company, the automated emails should not fail when the user's email gets closed out. The script would just need to get moved to a different server's cron or whatever. Is there an easy way to do this? I am happy to use Django also, but would prefer to avoid using SES and having to pay to send internal company emails: https://docs.djangoproject.com/en/2.0/topics/email/ https://github.com/django-ses/django-ses https://developers.google.com/gmail/api/auth/scopes -
How do I know if a variable in Django contains anything in it?
My views.py : class PostView(TemplateView): template_name = 'airapp/post_list.html' def get(self, request): form = PostForm() posts = Post.objects.order_by('-date') users = User.objects.exclude(id=request.user.id) friend, created = Friend.objects.get_or_create(current_user=request.user) friends = friend.users.all() args = {'form' : form, 'posts' : posts, 'users': users, 'friends' : friends} return render(request, self.template_name, args) My post_list.html <div class="panel panel-primary"> <div class="panel-heading"> <h1>Friends</h1> </div> <div class="panel-body"> {% if **not friends.exists()** %} <p>You don't have any friends :( Add one!!</p> {% else %} {% for friend in friends %} <a href="{% url 'airapp:profile_with_pk' pk=user.pk %}"><h3>{{ friend.username }}</h3></a> <a href="{% url 'airapp:change_friend' operation='remove' pk=friend.pk %}"><button type="button" class="btn btn-warning" name="button">Remove Friend</button> </a> {% endfor %} {% endif %} </div> </div> Is there any way in which I can check whether friends actually contains anything? Because if it doesn't, I want to display something else ( which is pretty evident) -
Django display search results
im currently working on a blog app in Django. as all Blog apps i need a search form. Therefor i have write a small view and context processor (to make the search form available globally) that querys search results: view.py: class BlogSearchListView(ListView): model = Post paginate_by = 10 def get_queryset(self): qs = Post.objects.published() keywords = self.request.GET.get('q') if keywords: query = SearchQuery(keywords) title_vector = SearchVector('title', weight='A') content_vector = SearchVector('content', weight='B') tag_vector = SearchVector('tag', weight='C') vectors = title_vector + content_vector + tag_vector qs = qs.annotate(search=vectors).filter(search=query) qs = qs.annotate(rank=SearchRank(vectors, query)).order_by('-rank') return qs base.html: <div class="globalsearch"> <form id="searchform" action="{% url 'search' %}" method="get" accept-charset="utf-8"> <label for="{{ categorysearch_form.category.id_for_label }}">In category: </label> {{ categorysearch_form.category }} <input class="searchfield" id="searchbox" name="q" type="text" placeholder="Search for ..."> <button class="searchbutton" type="submit"> <i class="fa fa-search"></i> </button> </form> </div> settings.py: TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'quickblog.quickblog.context_processors.categorysearch_form', ) context_processors.py from .forms import PostForm def categorysearch_form(request): form = PostForm() return {'categorysearch_form': form} post_list.html: {% extends 'quickblog/base.html' %} {% block content %} {% for post in posts %} <div class="post"> <h1><u><a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }}</a></u></h1> <p>{{ post.content|linebreaksbr }}</p> <div class="date"> <a>Published by: {{ post.author }}</a><br> <a>Published at: {{ post.published_date }}</a><br> <a>Category: {{ post.category }}</a><br> <a>Tag(s): {{ post.tag }}</a> </div> </div> {% endfor … -
Customize django drf JWT response
I followed the drf documentation to customize response. I want to get userdata with JWT but i cannot #settings: 'JWT_PAYLOAD_HANDLER': 'spauser.views.jwt_response_payload_handler', #views def jwt_response_payload_handler(token, user=None, request=None): #if I remove spauser, django returns an error: SpaUser matching query does not exist. spa_user = SpaUser.objects.get(email= 'test@test.com') return { 'token': token, 'user': SpaUserSerializer(spa_user, context={'request':request}).data } -
Intermediate Django 2.0 admin action page not displaying
I have created an update custom admin action and want to ask for update confirmation by going to a new page before the update action is finalised. Below is the code for various files: admin.py` class ProfileHolderAdmin(admin.ModelAdmin): list_display = [field.attname for field in ProfileHolder._meta.fields] actions = ['update_verified'] def update_verified(self, request, querySet): users_verified=querySet.update(verified='y') views.update_confirmation(request) self.message_user(request,"No. of users verified = %s" %str(users_verified)) update_verified.short_description = "Mark selected users as verified" admin.site.register(ProfileHolder, ProfileHolderAdmin)` Code in views.py: def update_confirmation(request): return render(request,'Profile/confirm_update.html', context=None) The path to the html file is: website_name\Profile\templates\Profile\confirm_update.html Profile is the name of my app and website_name is the directory name. When I carry out the update function, the status is being correctly updated but the intermediate update page is not showing. Please help. -
find similar data in database django
for my university project i'm developing an website that you search for a book and it shows you similar books to that. I'm using Django and i need help for finding the similars especially in fields that are strings. from django.db import models class Genre(models.Model): name = models.CharField(max_length = 100) def __str__(self): return self.name class Book(models.Model): titleid = models.CharField(max_length = 100) title= models.CharField(max_length = 500) rating = models.IntegerField(blank=True, null=True) genre = models.ManyToManyField(Genre) def __str__(self): """Unicode representation of Film.""" return self.primarytitle I just want to add 100 books in total for my project but if i could develop it in a way that in future i'd be able to add 1000 books and still the speed would be the same would be perfect. for rating it's a number of rating(from 0 to 5) * number of people who vote for it. I'm getting this data from goodreads. for example if a book has a score of 5 and 10 people vote is NOT similar to a book who has score of 5 with 1 million votes. the rating for the first one would be 50 and the second one would be 5 million. from other posts i've learned that for integers … -
MDB carousel with django
I am trying to implement a carousel with dynamic data coming from my django app. However as soon as i have added the dynamic data the carosuel stopped working and i could not navigate from one picture to the other. The carousel is just "stuck". The datas are fine as i have tested them. The main problem now is the carousel Would appreciate any suggestions with thanksHere is how the image carousel looks <!--Carousel Wrapper--> <div id="carousel-example-2" class="carousel slide carousel-fade" data-ride="carousel"> <!--Indicators--> <ol class="carousel-indicators"> {% for img in car.image_set.all %} {% if forloop.counter0 == 0 %} <li data-target="#carousel-example-2" data-slide-to="{{ forloop.counter0 }}" class="active"></li> {% endif %} <li data-target="#carousel-example-2" data-slide-to="{{ forloop.counter0 }}" ></li> {% endfor %} </ol> <!--/.Indicators--> <!--Slides--> <div class="carousel-inner" role="listbox"> {% for img in car.image_set.all %} <!--{% if forloop.counter == 0 %}--> <!--<div class="carousel-item active">--> <!--{% endif %}--> <div class="carousel-item active"> <div class="view"> <img class="d-block w-100" src="{{ img.image.url }}" alt="{{ car.name }}"> <div class="mask rgba-black-light"></div> </div> <div class="carousel-caption"> <h3 class="h3-responsive">{{ car.model }}</h3> <p>{{ car.description }}</p> </div> </div> {% endfor %} </div> <!--/.Slides--> <!--Controls--> <a class="carousel-control-prev" href="#carousel-example-2" role="button" data-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="carousel-control-next" href="#carousel-example-2" role="button" data-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> <!--/.Controls--> </div> <!--/.Carousel Wrapper--> -
Creating a callable function to generate a value for an attribute in django models
I have a model A which has a models.PositiveIntegerField() value and I need to generate the value for this attribute using some information that I get from another related model B. class A(models.Model): .... num = models.PositiveIntegerField() .... def get_val(instance): return instance.a.num + 1 Class B(models.Model): ... a = models.ForeignKey(A, on_delete=models.CASCADE) val = models.PositiveIntegerField(default=get_val) ... But the mentioned approach is not working and is giving me this error while trying to do python manage.py migrate after doing python manage.py makemigrations TypeError: get_val() missing 1 required positional argument: 'instance' Error in detail: Applying problemsetting.0011_testcase_index...Traceback (most recent call last): File "manage.py", line 15, in <module> execute_from_command_line(sys.argv) File "/mnt/ebram96/workspace/linux/django_projects/env3/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line utility.execute() File "/mnt/ebram96/workspace/linux/django_projects/env3/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/mnt/ebram96/workspace/linux/django_projects/env3/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **cmd_options) File "/mnt/ebram96/workspace/linux/django_projects/env3/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute output = self.handle(*args, **options) File "/mnt/ebram96/workspace/linux/django_projects/env3/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 200, in handle fake_initial=fake_initial, File "/mnt/ebram96/workspace/linux/django_projects/env3/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/mnt/ebram96/workspace/linux/django_projects/env3/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/mnt/ebram96/workspace/linux/django_projects/env3/lib/python3.6/site-packages/django/db/migrations/executor.py", line 244, in apply_migration state = migration.apply(state, schema_editor) File "/mnt/ebram96/workspace/linux/django_projects/env3/lib/python3.6/site-packages/django/db/migrations/migration.py", line 122, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/mnt/ebram96/workspace/linux/django_projects/env3/lib/python3.6/site-packages/django/db/migrations/operations/fields.py", line 84, in database_forwards field, File "/mnt/ebram96/workspace/linux/django_projects/env3/lib/python3.6/site-packages/django/db/backends/sqlite3/schema.py", line 306, in … -
How to apply django @transaction decorator to celery task
In my project I use transactions by default. I want to disable them for few celery tasks. But when I use: https://docs.djangoproject.com/en/2.0/topics/db/transactions/#django.db.transaction.non_atomic_requests from django.db import transaction @transaction.non_atomic_requests @app.task(bind=True, name='my_task') def tasks_monitor(task): m = MyModel.objects.get(id=1) m.value = 5 m.save() time.sleep(40) My celery task is still do transactions. And looks like @transaction.non_atomic_requests and @transaction.atomic_requests not applying. UPD: Trying to swap order, not working too. -
Can't edit permissions
I created a custom user model along with admin. Everything works great, however when I try to edit permissions for a user in admin I get an error relating to a password variable. I'm unsure of the root of the problem and would appreciate any help I get. Thank you for your help. The error is simply KeyError at /admin/accounts/user/7/change/ 'password1' forms.py class UserAdminCreationForm(forms.ModelForm): # A form for creating new users password1 = forms.CharField(label='Password', widget=forms.PasswordInput) password2 = forms.CharField(label='Password confirmation', widget=forms.PasswordInput) class Meta: model = User fields = ('first_name', 'last_name', 'email') # where you put more required fields def clean_password2(self): # Check that the two password entries match password1 = self.cleaned_data.get("password1") password2 = self.cleaned_data.get("password2") if password1 and password2 and password1 != password2: raise forms.ValidationError("Passwords don't match") return password2 def save(self, commit=True): # Save the provided password in hashed format user = super(UserAdminCreationForm, self).save(commit=False) user.first_name = self.cleaned_data["first_name"] user.last_name = self.cleaned_data["last_name"] user.set_password(self.cleaned_data["password1"]) if commit: user.save() return user class UserAdminChangeForm(forms.ModelForm): # A form for updating users password1 = ReadOnlyPasswordHashField() class Meta: model = User fields = ('first_name', 'last_name', 'email', 'password', 'student', 'parent', 'teacher', 'active', 'admin') # add arguments def clean_password(self): # Regardless of what the user provides, return the initial value. return self.initial["password1"] admin.py … -
How to track form errors in Django?
how can I track form errors? Is there any concept within django or a plugin to track form errors? I would like to understand why some of my website users have problems to submit a valid form. (By seeing the validation errors somewhere and the input) -
can't import "from rest_framework import serializers" show the unresolved reference
It will show the unresolved reference of "import rest_framework import serializers,import rest_framework import viewsets" models.py from django.db import models class Task(models.Model): task_name=models.CharField(max_length=20) task_desc=models.TextField(max_length=200) date_created=models.DateTimeField(auto_now=True) def __str__(self): return self.task_name in serializer file have a problem for rest_framework and i am many more times create a new project for i think missing any file of rest_framework library Serializers.py(file) from django.contrib.auth.models import User, Group from rest_framework import serializers from .models import Task class TaskSerializer(serializers.ModelSerializer): class Meta: model = Task fields = ('id','task_name','task_desc') settings.py(file) INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'TaskAPI', 'rest_framework', ) views.py(file) from rest_framework import viewsets from .models import Task from .Serializers import TaskSerializer class TaskViewSet(viewsets.ModelViewSet): queryset= Task.objects.all().order_by('-date_created') Serializer_class = TaskSerializer i am using python==3.6.4 django==2.0.3 djangorestframework==3.8.2 The rest_framework library is not usable in program. so what is the problem in my code or missing any steps. plz help me any one give a reply as sson as possible thank you -
Django: exception handling in view.py
I build an exception handleing in result_page view. It's normal in common, but sometimes, it is no into exception block and the client web continue waiting. I have not idea about this situation. if you have relative experience, help me plz :)) thanks! def result_page(request): if 'selected' in request.COOKIES: try: main('{0}'.format(request.COOKIES['selected']), '{0}'.format(request.COOKIES['link'])) except: return render(request, 'error_back.html', { }) else: return render(request, 'home_live.html', { }) return render(request, 'select_first.html', { })