Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How can i make my input in my templates save in same template page and in database using django. Please help i am new here
I created a model. i want my input data from my template page to show on that same page after clicking submit and that same data should save in my database in the model -
What are Django swappable models?
What are swappable models in Django? And Why sometimes when we do a migration a swappable dependency appears in Django migration files? I have searched for this concept in Django but I did not understand what it really does?! -
How to limit form submit request in Django app
I want to limit submitting request for visitors(anonymous) in my django app. Suppose 10 or 50 limits per day/month. If they try to search more than my given limit I want to show a message "you have reached your daily or monthly limit!" How can I do this? Here is views: def homeview(request): if request.method == "POST" and 'text1' in request.POST: text1 = request.POST.get('text1') text2 = request.POST.get('text2') data = my_custom_function(text1, text2) context = {'data': data} else: context = {} return render(request, 'home.html', context) here is form in template: <form action="" method="POST"> {% csrf_token %} <input class="form-control m-3 w-50 mx-auto" type="text" name="text1" id="text1" placeholder=""> <input class="form-control m-3 w-50 mx-auto" type="text" name="text2" id="text2" placeholder=""> <input class="btn btn-primary btn-lg my-3" type="submit" value="Submit"> </form> -
Upgrading Django 3.1.7 to 4.0.7 along with python 3.10 facing issues in project
Below are the error when try to run the project using django 4.0.7. If I downgrade django to 3.1.7 everything work fine. Exception in thread django-main-thread: Traceback (most recent call last): File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner self.run() File "/usr/lib/python3.10/threading.py", line 946, in run self._target(*self._args, **self._kwargs) File "/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper fn(*args, **kwargs) File "/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run autoreload.raise_last_exception() File "/lib/python3.10/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception raise _exception[1] File "/lib/python3.10/site-packages/django/core/management/init.py", line 398, in execute autoreload.check_errors(django.setup)() File "/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper fn(*args, **kwargs) File "/lib/python3.10/site-packages/django/init.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/lib/python3.10/site-packages/django/apps/registry.py", line 91, in populate app_config = AppConfig.create(entry) File "/lib/python3.10/site-packages/django/apps/config.py", line 126, in create mod = import_module(mod_path) File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/rest_registration/apps.py", line 3, in import rest_registration.checks # noqa File "/rest_registration/checks.py", line 33, in def auth_installed_check(): File "/lib/python3.10/site-packages/django/core/checks/registry.py", line 52, in inner raise TypeError( TypeError: Check functions must accept key arguments (**kwargs). -
i am trying to visit the admin link in my django server link, but i keep getting a, "TypeError at /admin". i did notice the "venv" folder gives a sign
#admin.py from django.contrib import admin Register your models here. from .models import Student admin.site.register(Student) #models.py class Student(models.Model): id = models.CharField(max_length=50) surname = models.CharField(max_length=50) first_name = models.CharField(max_length=50) gender = models.CharField(max_length=6) course = models.TextField() -
Facet Filter List using django-filter
I'm trying to build a facet Filter using django-filter. Also in filter, I have Postgres full-text search. Filter and search work good, but I don't know how to build a facet Filter. For example, I want that when I select Chinese, then I see count each value and related value in filter. Could you please give me any advice how to build it? models.py class Book(models.Model): name = models.CharField(max_length=255) author = models.ForeignKey( "Authors", on_delete=models.SET_NULL, null=True, blank=True, ) subject = TreeManyToManyField("Subject") published_date = models.DateField(blank=True, null=True) language = models.ForeignKey( "Language", on_delete=models.SET_NULL, null=True) class Subject(MPTTModel): name = models.CharField( max_length=1000, unique=True, ) class Language(models.Model): name = models.CharField( max_length=255, unique=True, ) class Authors(models.Model): name = models.CharField( max_length=255, unique=True, ) filters.py class BookFilter(django_filters.FilterSet): search = django_filters.CharFilter( method="my_custom_filter", widget=TextInput( attrs={ "class": "form-control", "placeholder": _("Type to search"), } ), ) language = django_filters.ModelMultipleChoiceFilter( field_name="language", queryset=Language.objects.order_by("name"), widget=forms.CheckboxSelectMultiple(), ) subject = django_filters.ModelMultipleChoiceFilter( field_name="subject", queryset=Subject.objects.all(), widget=autocomplete.ModelSelect2Multiple(} ), ) class Meta: model = Book fields = { "subject", "language", "published_date", } def my_custom_filter(self, queryset, name, value): q = value return ( queryset.annotate( rank=SearchRank(vector, q), similarity=TrigramSimilarity("title", q) + similarity=TrigramSimilarity("author", q) ) views.py def BookListView(request): book = Book.objects.all() filter = BookFilter(request.GET, queryset=book) context = { "filter": filter, "book": book, } return render(request, "book.html", context) … -
Can`t run `manage.py test` in Django: django.db.utils.OperationalError
I`m trying to run some auto-tests in Django framework 4.0.4 by command python manage.py test test.to.run Also at the start it gets notification: RuntimeWarning: Normally Django will use a connection to the 'postgres' database to avoid running initialization queries against the production database when it's not needed (for example, when running tests). Django was unable to create a connection to the 'postgres' database and will use the first PostgreSQL database instead. , but at the result it gets error without any specific explanation: ...conn = _connect(dsn, connection_factory=connection_factory, **kwasync) psycopg2.OperationalError The above exception was the direct cause of the following exception: ... conn = _connect(dsn, connection_factory=connection_factory, **kwasync) django.db.utils.OperationalError Connected DB is postgres located on another computer in the local network. When I run app on dev-server by command python manage.py runserver everything goes ok, there are no troubles with database. I tried to create local postgres database on my machine and set connection to it in settings.py, python manage.py test runs as well too. -
how do I edit the user detail/profile of other users?
This to be done through user defined admin page and not the Django admin page. I would like to access and edit the user details of other users that have registered to my site. I already have a self edit function in my views but would like to add more accessibility to the admin role in case of user emergency. This is my self edit views code. What should be the value to insert into instance field (I assume) to get the details of the user the admin selects. if request.method == "POST": form = NewEditForm(request.POST, instance=request.user) Sform = StudentForm(request.POST, instance=request.user) if form.is_valid() and Sform.is_valid(): user = form.save() student = Sform.save(commit=False) student.user = user student.save() messages.success(request, ("Profile updated.")) return HttpResponseRedirect("/clubhomepage") messages.error(request, "Unsuccessful update. Invalid information.") else: form = NewEditForm(instance=request.user) Sform = StudentForm(instance=request.user) return render(request=request, template_name="App2/edituser.html", context={"edit_form": form, "Student": Sform }) I am still kinda new to django so any help would be appreciated. -
"ModelForm has no model class specified."
I am trying to create a Register Form but I couldn't find any solution "ModelForm has no model class specified." for this error. I didn't use ModelForm but I take this error. Can somebody explain me why am I taking this error and how can I fix it // views.py// from django.shortcuts import render from .forms import RegisterForm from django.contrib import messages from django.contrib.auth import login as dj_login def register(request): if request.method == "POST": form = RegisterForm(request.POST) if form.is_valid(): user = { "username": form.cleaned_data["username"], "email": form.cleaned_data["email"], "phone": form.cleaned_data["phone"], "password1": form.cleaned_data["password1"], "password2": form.cleaned_data["password2"] } user = form.save() dj_login(request,user) messages.success(request,"You have completed registration successfully.") return render(request,"index.html",{"user":user}) else: messages.info(request,"You couldn't complete registrations!") else: form = RegisterForm() return render(request,"register.html",{"form":form}) // forms.py // from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User class RegisterForm(UserCreationForm): email = forms.EmailField(required=True) phone = forms.IntegerField(required=True) class Meta(): user = User fields = ["username","email","phone","password1","password2"] def save(self, commit=True): user = super(RegisterForm, self).save(commit=False) user.email = self.cleaned_data["email"] user.phone = self.cleaned_data["phone"] if commit: user.save() return user -
How to test Django custom decorator with different values?
I've got a function based view like this: @new_group_required("special_group", raise_exception=True) def my_view(request): <my code> I'd like to test this as if the raise_exception was set to False but I can't seem to figure out through google how to do this. Some people recommend using Mock but I'm pretty unfamiliar with Mock and how I can run my_view, but change just the attribute of that decorator. Any help would be appreciated! The decorator code looks like this (very similar to the built-in Permission decorator from Django): def user_passes_test( test_func, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME ): """ Decorator for views that checks that the user passes the given test, redirecting to the log-in page if necessary. The test should be a callable that takes the user object and returns True if the user passes. """ def decorator(view_func): @wraps(view_func) def _wrapper_view(request, *args, **kwargs): if test_func(request.user): return view_func(request, *args, **kwargs) path = request.build_absolute_uri() resolved_login_url = resolve_url(login_url or settings.LOGIN_URL) # If the login url is the same scheme and net location then just # use the path as the "next" url. login_scheme, login_netloc = urlparse(resolved_login_url)[:2] current_scheme, current_netloc = urlparse(path)[:2] if (not login_scheme or login_scheme == current_scheme) and ( not login_netloc or login_netloc == current_netloc ): path = request.get_full_path() … -
Can't see images after deploying to heroku
I had uploaded my site Django app on Heroku server when I upload image file in my admin panel is successfully uploaded but i can't see it in my page settings.py STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATIC_URL = 'static/' STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),) MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media/') MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', "whitenoise.middleware.WhiteNoiseMiddleware", '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', ] urls.py if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) template {% for data in datas %} <li class="nav-item dropdown pe-3"> <a class="nav-link nav-profile d-flex align-items-center pe-0" href="#" data-bs-toggle="dropdown"> <img src= {{data.profile_image}} alt="Profile" class="rounded-circle"> <span class="d-none d-md-block dropdown-toggle ps-2">{{user.username}}</span> -
How to order a queryset based on the multiselectfield values
choix = ( ('Proche station ski','Proche station ski'), ('Piscine', 'Piscine'), ('Jardin', 'Jardin'), ('Cave', 'Cave'), ('Parking', 'Parking'), ) class Appartement(models.Model): surface = models.FloatField() prix = modelsenter code here.FloatField() nombre_piece = models.IntegerField() list_caracteristiques = MultiSelectField(choices=choix, max_length = 200) program = models.ForeignKey(Programme_immobilier, on_delete=models.CASCADE) def __str__(self) -> str: return f"Appartement {self.id} de {self.program_id}" My task is to do the following: List the apartments by ordering the answer according to the season (according to the date of the request) as follows: o In winter (December – March) the apartments that are "Proche station ski" appear first, then sort by decreasing price, decreasing area, o In summer (June – September) the apartments with a "Piscine" appear first, then sort by decreasing price, decreasing area. Otherwise, sorting is by decreasing price, decreasing area I am stuck at how to sort the queryset, based on the values of the multiselectfield Thanks in advance for any cooperation ! -
Add loading view during process of the next view in Django
I want to add a loading page during the process, I tried all the solutions here in stackoverflow and different articales, but I'm really surprised that the solutions did not work for me, It's been 2 days and I still didn't find a solution. I have two pages Home and datatable I want to add a loading page when i redirect from the home page to the datatable one. Please any help is highly appreciated. this is my view.py : def home_view(request): context = {} context ['form'] = Scraping() return render(request,'home.html', context) def datatable_view(request): if request.method =='POST': if form.is_valid(): return render(request,'datatable.html') -
Django + HTMX - create/update parent model with child models at once
I found a great tutorial about dynamically saving models in django using HTMX: Video: https://www.youtube.com/watch?v=KVq_DjIfnBo Text version: https://justdjango.com/blog/dynamic-forms-in-django-htmx My problem is that I want to create author, add books and save author with books at once - using HTMX on one page. Could you please explain, how to do it? Thank you -
How to disallow to change "status" for simple user and keep it for admin and support(superuser)?
The simple user must either not see the status button or it must be grayed out for selection. Admin(user.is_staff) and Support(user.is_superuser) should see the field and be able to change it. Now user can change the status of ticket in Update view. My serializer: class TicketSerializerUpdate(serializers.ModelSerializer): user = serializers.HiddenField(default=serializers.CurrentUserDefault()) status = Status.objects.all() class Meta: model = Ticket fields = "__all__" My models Ticket and Status: class Status(models.Model): status = models.CharField(max_length=150) desc_status = models.TextField() def __str__(self): return self.status class Ticket(models.Model): title = models.CharField(max_length=150) text = models.TextField() status = models.ForeignKey(Status, on_delete=models.PROTECT, default=2) user = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.CASCADE, ) time_create = models.DateTimeField(auto_now_add=True) time_update = models.DateTimeField(auto_now=True) def __str__(self): return self.title File permissions now haven't anything for solve the problem and I haven't any idea. I think it is simple problem, if you need more info you can request me) -
Django tabularInline 'categories.Category_children_ids' has more than one ForeignKey to 'categories.Category'. You must specify a 'fk_name' attribute
I'm want to create nested categories, model work fine. class Category(models.Model): category_name = models.CharField(max_length=100) children_ids = models.ManyToManyField( "Category", blank=True, related_name="categories" ) ...etc but, when i add inline for admin panel class ChildrensInline(admin.TabularInline): model = Category.children_ids.through compiler shows me error: 'categories.Category_children_ids' has more than one ForeignKey to 'categories.Category'. You must specify a 'fk_name' attribute. I also try fk_name='categories', and columns name inside Category_children_ids table, but it not work -
Use of Routers in ReactJS and Django Sends Empty Page [closed]
Routes in ReactJS and Django Integration keeps sending me empty page. Wwhat could be wrong? -
in python wants to take certain part from a given string [duplicate]
I have a string type URL --https://drive.google.com/file/d/1vBiwyAL3OZ9VVCWCn5t6BagvLQoMjk82/view?usp=sharing I want only part after "d/" and before "/view" from the above string so how can I use it using regex or any other function example I only want 1vBiwyAL3OZ9VVCWCn5t6BagvLQoMjk82 from the above string using python -
In Django, why i cannot import a model in an python file created by me in inside the same app?
I created in Django, in my app an python file for forms and I want to import a model from .models (from the same app). The problem is when I import the model, it returned an error. The model is(models.py): class Article(models.Model): title = models.CharField(max_length=100) location=models.CharField(max_length=120,null=True,blank=True) category=models.CharField(max_length=100,null=True,blank=False) slug=models.SlugField(null=True, blank=True, unique=True) boddy=models.TextField() timestamp = datetime.now() update = models.TimeField(auto_now=True) The problem is in util.py (the python file that i created) : from .models import Article The error is: ImportError: cannot import name 'Article' from partially initialized module 'hello.models' (most likely due to a circular import) (D:\Python\Django\Projects\myproject\hello\models.py) The python files are in the same app -
Python Postgres JSON
Currently as written I insert the payload as JSON into a single column. I want to break the k/v into columns in the predefined table. The value from MQTT is always byte object. ie... b'{"name":"John","age":30,"city":"New York"}' def insertIntoDatabase(message): """Inserts the mqtt data into the database""" with connection.cursor() as cursor: print("Inserting data...) # MQTT message always a byte object # message.payload contains message sent in this format b'{"name":"John","age":30,"city":"New York"}' # Covert to string ***WORKS*** test_json = message.payload.decode('utf8') # Convert string to dict ***WORKS*** json_dict = json.loads(test_json) print(json_dict) # How do I deconstruct the dict into an sql insert???? # Inserts JSON into single column. Need one column per key cursor.callproc('InsertIntoMQTTTable', [str(message.topic), str(message.payload)[2:][:-1], int(message.qos)]) connection.commit() SQL Routine - Called via callproc create function insertintomqtttable(topic text, message text, qos numeric) returns void language plpgsql as $$ BEGIN INSERT INTO mqtt (createdAt, topic, message, qos) VALUES (CURRENT_TIMESTAMP, topic, message, qos); END; $$; alter function insertintomqtttable(text, text, numeric) owner to don; postgres Table Structure - CREATE TABLE mqtt ( id SERIAL PRIMARY KEY, createdAt TIMESTAMP NOT NULL, topic TEXT NOT NULL, message TEXT, qos NUMERIC(1) NOT NULL ); -
updating an object related to two others by a foreignKey and OneToOneKey respectively does not work in django
Here is the model of object I want to update: class Abonnement(models.Model): client = models.ForeignKey('Client', on_delete=models.CASCADE, related_name="abonnements") compteur = models.OneToOneField(Compteur, on_delete=models.CASCADE,related_name="abonnement") adresse = models.CharField(max_length=200, blank=True, null=True) point_service = models.CharField(max_length=200, null=True, blank=True) lat_machine = models.FloatField(default=0.0) lon_machine = models.FloatField(default=0.0) The Client model is linked to this model by a Foreign key and the Compteur model by a OneToOne key Retrieving the object from the OneToOne field does not pose a problem. But when I try to update, it does not work. This is what I do in the controller: compteur = get_object_or_404(Compteur,pk=request.POST["deveui"]) a = compteur.abonnement a.point_service = form.cleaned_data["pointservice"] a.lat_machine = form.cleaned_data["latitude"] a.lon_machine = form.cleaned_data["latitude"] a.save() I also try to do it another way, but nothing changes, the edit still doesn't work compteur = get_object_or_404(Machine,pk=request.POST["deveui"]) a = Abonnement.objects.get(compteur=compteur) a.point_service = form.cleaned_data["pointservice"] a.lat_machine = form.cleaned_data["latitude"] a.lon_machine = form.cleaned_data["latitude"] a.save() -
How can I solve this error "Reverse for 'resume-detail' with no arguments not found. 1 pattern(s) tried: ['userapp/view/(?P<slug>[^/]+)/\\Z']"?
I'm trying to delete from my database but I'm getting the error "Reverse for 'resume-detail' with no arguments not found. 1 pattern(s) tried: ['userapp/view/(?P[^/]+)/\Z']". How do I resolve this error ? views.py def delete_view_experience(request, experience_id): experience_instance=get_object_or_404(Experience, id=experience_id) if experience_instance: experience_instance.delete() messages.success(request,"Information Deleted Successfully") return redirect('resume-detail') urls.py path('userapp/view/<str:slug>/', user_views.resume_detail, name='resume-detail'), path('delete-experience/<int:experience_id>/', user_views.delete_view_experience, name='delete_experience'), models.py class Experience(models.Model): company = models.CharField(null = True, max_length=200) position = models.CharField(null = True, max_length=200) start_date = models.DateField() end_date = models.DateField() experience = models.TextField() skills = models.TextField() resume = models.ForeignKey(Resume, on_delete = models.CASCADE, null = True) def __str__(self): return '{} at {}'.format(self.position, self.company) error traceback Traceback (most recent call last): File "C:\Users\Muhumuza-Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\handlers\exception.py", line 55, in inner response = get_response(request) File "C:\Users\Muhumuza-Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\Muhumuza-Ivan\Desktop\JobPortal\userapp\views.py", line 219, in delete_view_education return redirect('resume-detail') File "C:\Users\Muhumuza-Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\django\shortcuts.py", line 48, in redirect return redirect_class(resolve_url(to, *args, **kwargs)) File "C:\Users\Muhumuza-Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\django\shortcuts.py", line 145, in resolve_url return reverse(to, args=args, kwargs=kwargs) File "C:\Users\Muhumuza-Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\django\urls\base.py", line 88, in reverse return resolver._reverse_with_prefix(view, prefix, *args, **kwargs) File "C:\Users\Muhumuza-Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\django\urls\resolvers.py", line 802, in _reverse_with_prefix raise NoReverseMatch(msg) django.urls.exceptions.NoReverseMatch: Reverse for 'resume-detail' with no arguments not found. 1 pattern(s) tried: ['userapp/view/(?P<slug>[^/]+)/\\Z' -
How to create a django microservices monorepo?
Given this blog project which has posts and comments apps: blog ├── blog │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── comments │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ └── views.py ├── manage.py └── posts ├── __init__.py ├── admin.py ├── apps.py ├── migrations │ └── __init__.py ├── models.py ├── tests.py └── views.py I want to be able to run each of the apps (services) independently. The django-admin runserver runs the whole app which is not what my intention. I want to run and deploy services independently, each with its own db and port, and choose which services to start in advance. I'm aware that each app can have its own db specified in settings.py. Not sure about how to run services independently though. I also want the resulting project structure to be PyCharm-friendly, which means I can choose which services to run within the same project workspace. -
Got errors in Django app coverted to desktop app
I am working on a project. I have got a django web app "converted" into desktop app. So now I try to run that app, it gives me error . So can somone help me to resolve these errors.i have attached the screenshot also to understand the situation. -
Pagination in Django Admin with Custom List Filters
I have a proxy model and admin section where I am implementing a custom multi select filter. The results are coming correctly. How ever, pagination is not working with this filter. http://127.0.0.1:8000/users/?taggroup=1&taggroup=2 When I try to click on page 2 the url turns to : http://127.0.0.1:8000/users/?page=2&taggroup=2 But the expected result is : http://127.0.0.1:8000/users/?page=2&taggroup=1&taggroup=2 I tried overriding the change list using [https://stackoverflow.com/questions/62960518/overriding-django-admin-pagination-along-with-url-parameters][1] But now the pagination is like below when I try navigating from page 1 to page 2 and also the pagination is starting from 0 and not 1: http://127.0.0.1:8000/users/?page=2&page=1 Below is the code that I have tried: @register.inclusion_tag('admin/custom_pagination.html', takes_context=True) def custom_pagination(context, cl): pagination = admin_list.pagination(cl) if 'group_id' in context: pagination['params'] = (('taggroup', context['group_id']),) return pagination change_list_template = 'admin/users_changelist.html' def changelist_view(self, request, extra_context=""): response = super(PartnerUsersAdmin, self).changelist_view( request, extra_context) group_id = request.GET.urlencode() if group_id: extra_context = { 'group_id': str(group_id), } response.context_data.update(extra_context) return TemplateResponse(request, "admin/partner_users_changelist.html", response.context_data) #custom_pagination.html {% load admin_list %} {% load i18n %} {% load content_extras %} <p class="paginator"> {% if pagination_required %} {% for i in page_range %} <a href="?p={{ i }}{% for key, value in params %}{% if key != 'p' %}&{{ value }}{% endif %}{% endfor %}"> {{i}}</a> {% endfor %} {% endif %} {{ cl.result_count …