Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Can't assign a valid instance to a FK relation when creating a related instance
I have the following related models class Period(models.Model): """ A table to store all periods, one period equals a specific month """ period = models.DateField() def __str__(self): return f'{self.period}' class Payment(models.Model): """ A table to store all payments derived from an offer """ # Each monthly payment relates to an offer offer = models.ForeignKey(Offer, on_delete=models.CASCADE) month = models.ForeignKey(Period, on_delete=models.CASCADE) amount = models.PositiveIntegerField() ... for key, value in payments.items(): # Get the period of the payment or create it period = Period.objects.get_or_create(period=key) print(period) Payment.objects.create( offer=offer_instance, month=period, amount=value ) which raises ValueError: Cannot assign "(<Period: 2022-05-01>, False)": "Payment.month" must be a "Period" instance. although print(period) returns (<Period: 2022-05-01>, False) which to me looks like a valid instance? -
why model object attribute not change when i try to access it directly without assign to variable
i try here to change title but this not work. but when assign object to variable change is work. i need any one explain why it work when i assign object to variable and why not work when access it directly -
cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding
I was trying to run server but the terminal always showed me that "ImportError: Could not import 'rest_framework.negotiation.DefaultContentNegotiation' for API setting 'DEFAULT_CONTENT_NEGOTIATION_CLASS'. ImportError: cannot import n ame 'python_2_unicode_compatible' from 'django.utils.encoding' (C:\Users\86133\PycharmProjects\pythonProject4\venv\lib\site-packages\django\utils\encoding.py)." -
where are django-html variables defined by models?
in django, where do you get variables from the models to put in a .html this is the models of my app: class Member(models.Model): active = models.BooleanField( verbose_name=_("active"), default=True, ) image = models.ImageField( verbose_name=_("Team Menber image"), blank=True, null=True, ) name = models.CharField( verbose_name=_("Team Menber name"), max_length=100, default="", ) role = models.CharField( _("Team Menber role"), max_length=50, default="", ) order = models.PositiveIntegerField( verbose_name=_("order"), default=0, ) biography = models.TextField( verbose_name=_("Team menber bio"), ) class Meta: ordering = ["order", "name"] def __str__(self): return self.name where in my html would i get my_object.name for example? and how can i get the list of all instances of this class? my views: class TeamView(ListView): """ list view of the menbers(image, name, role) """ model = Member class MenberView(DetailView): """ Detail view of the menbers(image, title, role, bio) """ model = Member I know in django i would need to {{my_object.my_var}} inside the template but what is my_object and my_object.my_var defined so i can call them? -
Need to do POST method for the Nested serializers using django
models.py class Organisation(models.Model): """ Organisation model """ org_id = models.AutoField(unique=True, primary_key=True) org_name = models.CharField(max_length=100) org_code = models.CharField(max_length=20) org_mail_id = models.EmailField(max_length=100) org_phone_number = models.CharField(max_length=20) org_address = models.JSONField(max_length=500, null=True) product = models.ManyToManyField(Product, related_name='products') org_logo = models.ImageField(upload_to=upload_org_logo, null=True, blank=True,) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) serializers.py class Organisation_Serializers(serializers.ModelSerializer): product = Product_Serializers(read_only=True, many=True) class Meta: model = Organisation fields = ('org_id', 'org_name','org_address', 'org_phone_number', 'org_mail_id','org_logo','org_code','product',) #depth = 1 def create(self, validated_data): org_datas = validated_data.pop('product') org = Organisation.objects.create(**validated_data) for org_data in org_datas: Product.objects.create(artist=org, **org_data) return org views.py class Organisation_Viewset(DestroyWithPayloadMixin,viewsets.ModelViewSet): renderer_classes = (CustomRenderer, ) #ModelViewSet Provides the list, create, retrieve, update, destroy actions. queryset=models.Organisation.objects.all() parser_classes = [parsers.MultiPartParser, parsers.FormParser] http_method_names = ['get', 'post', 'patch', 'delete'] serializer_class=serializers.Organisation_Serializers I able to get the product data as a array of dict while performing GET method. But while i tried to post it Iam getting an error as "Key Error product ". I need to get the data as Iam getting now and it would be fine if I POST based on the array of product_id or the array of data which I receive in the GET method.I was stuck on this part for 3 days and still I couldn't able to resolve it. Please help me resolve this issue your helps … -
how to implement email_user to signals in Django?
I am trying to write a signal that will send an email to the user if the status will change but I am getting this error: AttributeError at /admin/article/requests/ 'str' object has no attribute 'email_user' models.py class Requests(models.Model): STATUS = ( ('received', _('Question received')), ('in_progress', _('In progress')), ('published', _('Published')), ) email = models.EmailField() user = models.CharField(max_length=255, blank=True, null=True,) title = models.CharField(max_length=1000, blank=True, null=True, default='') body = models.TextField('Description') publish_date = models.DateTimeField('default=timezone.now) owner = models.ForeignKey(User, blank=True, null=True, on_delete=models.SET_NULL) status = models.CharField(max_length=32, choices=STATUS, default='received') def __str__(self): return str(self.title) def send_email_to_user(sender, instance, **kwargs): subject = 'Status of your request has changed' message = render_to_string('user/request_status.html', { 'user': instance.email 'status': instance.status }) user.email_user(subject, message) post_save.connect(send_email_to_user, sender=QuestionRequests) Any tips on how to solve this issue would be appreciated. -
how to show all info and all connected tables with certain object after selecting it in <select>?
as you can see on a picture i have select menu where all my so called "video libraries" are shown. The first question is - is there any way to show all data about certain selected "video library" (every video library has its won adress)? And the second question - every video library is connected with couple of different tables (Staff, Films, Ranks etc.) by ForeignKey - how to show data which is connected with certain video library? class VideoLibrary(models.Model): shop_id = models.AutoField(primary_key=True, unique=True) shop_name = models.CharField(max_length=264) adress = models.TextField(max_length=264, default='') class Staff(models.Model): staff_id = models.AutoField(primary_key=True, unique=True) nsf = models.CharField(max_length=264) living_adress = models.TextField(max_length=264) shop_id = models.ForeignKey(VideoLibrary, on_delete=models.CASCADE) -
How to customize graphene-django response?
I have a GraphQL API with graphene-django and I want to customize the query response. Here is the default response; { "data": { "materials": { } }, "errors": { } } However, I want to customize it like this; { "data": { "materials": { } }, "errors": { }, "extra_field": { } } How can I do this? -
NoReverseMatch: Redirect to a new page in Django with a query from a template
I want to redirect from inside my HTML Template to a new page and also pass a query to that page as a GET request query. The HTML code looks like this. <th scope="row">{{ forloop.counter }}</th> <td>{{ project.article_title }}</td> <td>{{ project.target_language }}</td> <td> <a href="{% url 'translation/{{project.id}}/' %}" class="btn btn-success">View Project</a></td> This doesn't redirect and I get the following error. NoReverseMatch at /manager/ Reverse for 'translation/{{project.id}}/' not found. 'translation/{{project.id}}/' is not a valid view function or pattern name. My URL pattern looks like this urlpatterns = [ path('', views.project_input_view, name='main'), path('login/', views.login_user, name='login'), # path('register/', views.register_user, name='register'), path('translation/<str:pk>/', views.translation_view, name='translation'), path('manager/', views.manager_view, name='manager_dashboard'), path('annotator/', views.annot_dashboard_view, name='annot_dashboard'), ] However, if I write the following then it works. <th scope="row">{{ forloop.counter }}</th> <td>{{ project.article_title }}</td> <td>{{ project.target_language }}</td> <td> <a href="{% url 'main' %}" class="btn btn-success">View Project</a></td> but I want to redirect to the translation page along with the query. How can I achieve that? -
Handle large amounts of time series data in Django while preserving Djangos ORM
We are using Django with its ORM in connection with an underlying PostgreSQL database and want to extend the data model and technology stack to store massive amounts of time series data (~5 million entries per day onwards). The closest questions I found were this and this which propose to combine Django with databases such as TimescaleDB or InfluxDB. But his creates parallel structures to Django's builtin ORM and thus does not seem to be straightforward. How can we handle large amounts of time series data while preserving or staying really close to Django's ORM? Any hints on proven technology stacks and implementation patterns are welcome! -
How to group a queryset by a specific field in Django?
I have a qs qs_payments that returns the following: [ { "id": 19, "month": "2021-05-01", "amount": 3745, "offer": 38 }, { "id": 67, "month": "2021-03-01", "amount": 4235, "offer": 39 }, { "id": 68, "month": "2021-04-01", "amount": 4270, "offer": 39 }, { "id": 69, "month": "2021-05-01", "amount": 4305, "offer": 39 } ] I now try to re-group the data so that each month contains all items of that particular month (in the given example there would be two nested items for May/2021-05-21) I tried the following using itertools but this returns Payment object is not subscriptable. Context is that I want to render one component with its line items in React.js. class PayrollRun(APIView): def get(self, request): # Loop payment table for company related payments, create dict of dict for each month # Get todays date today = datetime.date(datetime.now()) # Get the related company according to the logged in user company = Company.objects.get(userprofile__user=request.user) # Get a queryset of payments that relate to the company and are not older than XX days qs_payments = Payment.objects.filter(offer__company=company).filter( month__gte=today - timedelta(days=600), month__lte=today ) payment_runs = [{'subject': k, 'Results': list(g)} for k, g in itertools.groupby(qs_payments, key=itemgetter('month'))] print(payment_runs) serializer = PaymentSerializer(qs_payments, many=True) return Response(serializer.data) The desired outcome is … -
Live camera feed is not working on ip address of wifi router on django server
I have a django server setup and I want to access the website from an android device for testing. The webpage consist of live camera feed. Here's the html code for the camera feed. <canvas id="camera--sensor"></canvas> <video id="camera--view" autoplay playsinline></video> <img src="//:0" alt="" id="camera--output"> <button id="camera--trigger">Take a picture</button> Now when i run python manage.py runserver, the camera feed is visible in the localhost. But on running python manage.py runserver wifi_ip:port_no, the camera feed is not working. Is there anything i can do to make it work? Any advice is appreciated. -
Django FilterSet for JSON fields
For example, I have a simple django-model: class SimpleModel(models.Model): some_attr = models.JSONField() #there is [attr1, attr2, ...] in JSON Simple view: class SimpleView(ListCreateApivView): filter_backends = [DjangoFilterBackend, ] filterset_class = SimpleFilter And simple filter: class SimpleFilter(django_filters.FilterSet): class Meta: model = SimpleModel fields = {'some_attr': ['icontains', ]} I wanna check is the http://127.0.0.1/simple?some_attr__icontains=['Something, that I have in db'] In my db there is JSONField, which contains [a1, a2, a3 ...], so, how can I check is value from url is in db JSONField? -
'list' object is not callable - django 1.9
First, I want to say that my project is very old (python 2.7, django 1.9). For this piece of code: @property def codes(self): codesList = [] invoices = self.invoice_set.all() for invoice in invoices: for ic in invoice.invoice_codes.all(): code = ic.suggestion_code.number if code not in codesList: codesList.append(code) print(codesList) return codesList def _statistic_claim_count(self): codesList = [] if self.status in [Claim.APPROVED, Claim.INVOICED]: codesList = self.codes() for code in codesList: issc, _ = InvoiceSuggestionCodeStatistic.objects.get_or_create( suggestion_code=code ) if self.status == Claim.APPROVED: issc.count_approved_claims() if self.status == Claim.INVOICED: issc.count_invoiced_claims() issc.count_claims() issc.save() def save(self, *args, **kwargs): super(Claim, self).save(*args, **kwargs) self._statistic_claim_count() I get 'list' object is not callable and the stack trace points out these calls: self._statistic_claim_count() codes = self.codes() I thought there might be something wrong with the way the code was wrritten because wherever you will see codesList in my code the previous name of the variable was codes. I changed them to codesList and I still get this error. Where can this error come from? I really can't get it. Thanks. -
Why do i have to restart the Django server every time I make some changes in views?
I am new to Django and every time I make a change in veiws.py or urls.py I have to run python manange.py run server. This is hectic as for every small change I have to restart the server. Is there any fix? Or is this normal? Thank you!!! -
How to add two numbers in jinja
I have a mark object which I want to list in table {% for mark in marks %} <tr> <td>{{forloop.counter}}</td> <td>{{mark.subject.name}}</td> <td>75</td> <td>25</td> <td>{{mark.mark}}</td> <td>{{mark.mark_pr}}</td> <td>{{ (mark.mark + mark.mark_pr) }}</td> <td>A</td> <td>70</td> </tr> {% endfor %} I want to display the sum of mark.mark and mark.mark_pr into third last but when I try doing (mark.mark + mark.mark_pr) it gives me error saying "Could not parse the remainder: '(mark.mark + mark.mark_pr)' from '(mark.mark + mark.mark_pr)" do anyone have any idea on how to do it? Thanks in advance. -
Openlayers display Points from Geodjango REST API endpoint
I am trying to display points on an OSM map using Openlayers and (Geo)Django. The points should be provided by a REST API endpoint which I want to query from within the openlayers javascript. The JS part looks like this: <div id="map" class="map shadow m-auto"></div> <script type="text/javascript"> var map = new ol.Map({ target: 'map', layers: [ new ol.layer.Vector({ source: new ol.source.Vector({ format: new ol.format.GeoJSON(), url: "http://localhost:8000/api/sites" }) }) , new ol.layer.Tile({ source: new ol.source.OSM(), }) ], view: new ol.View({ center: ol.proj.fromLonLat([8,48]), zoom: 10 }) }); </script> The API endpoint is just serializing a django queryset and therefore returns the following: [ { "sid":13, "site_name":"Burgsteig", "site_notes":"Reuter.2003", "municipality":1047, "geom":{ "type":"Point", "coordinates":[ 8.779644092464917, 48.00504767358004 ] } }, { "sid":14, "site_name":"Brederis, \"Weitried\"", "site_notes":"Hagn2002", "municipality":16180, "geom":{ "type":"Point", "coordinates":[ 9.628734475883569, 47.2756455228491 ] } }, { "sid":15, "site_name":"Burgweinting, \"Villa\"/\"Mühlfeld\"", "site_notes":"Zintl2012, Zintl2013", "municipality":2767, "geom":{ "type":"Point", "coordinates":[ 12.11373087937611, 49.01308089544727 ] } } ] It is just a basic API endpoint by django-rest-framework and as far as i know returns a pretty standard geoJSON format dataset. However, when running this i get an "Uncaught Error: Unsupported GeoJSON type: undefined". The basemap is displaying, it is just something wrong with that geojson. As far as I understand, the API is not … -
django upload image from url
error File "/Users/soubhagyapradhan/Desktop/upwork/polyverse/polyverse_api/env/lib/python3.8/site-packages/botocore/hooks.py", line 211, in _emit response = handler(**kwargs) File "/Users/soubhagyapradhan/Desktop/upwork/polyverse/polyverse_api/env/lib/python3.8/site-packages/botocore/utils.py", line 2355, in conditionally_calculate_md5 md5_digest = calculate_md5(body, **kwargs) File "/Users/soubhagyapradhan/Desktop/upwork/polyverse/polyverse_api/env/lib/python3.8/site-packages/botocore/utils.py", line 2332, in calculate_md5 binary_md5 = _calculate_md5_from_file(body) File "/Users/soubhagyapradhan/Desktop/upwork/polyverse/polyverse_api/env/lib/python3.8/site-packages/botocore/utils.py", line 2344, in _calculate_md5_from_file for chunk in iter(lambda: fileobj.read(1024 * 1024), b''): File "/Users/soubhagyapradhan/Desktop/upwork/polyverse/polyverse_api/env/lib/python3.8/site-packages/botocore/utils.py", line 2344, in <lambda> for chunk in iter(lambda: fileobj.read(1024 * 1024), b''): File "/Users/soubhagyapradhan/Desktop/upwork/polyverse/polyverse_api/env/lib/python3.8/site-packages/s3transfer/utils.py", line 483, in read data = self._fileobj.read(amount_to_read) File "/Users/soubhagyapradhan/Desktop/upwork/polyverse/polyverse_api/env/lib/python3.8/site-packages/s3transfer/upload.py", line 86, in read return self._fileobj.read(amount) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte [27/Apr/2022 13:14:52] "POST /api/asset-file/ HTTP/1.1" 500 283894 signal @receiver(post_save, sender=DesignerProductMedia) def save_profile(sender, instance, **kwargs): video = instance.file url = instance.url if url and not video: from django.core.files import File import os result = urllib.urlretrieve(instance.url) instance.file.save( os.path.basename(instance.url), File(open(result[0])) ) instance.save() return model: class DesignerProductMedia(models.Model): url = models.CharField(max_length=255, null=True, blank=True) file = models.FileField(null=True, blank=True, upload_to='asset') Here i am trying upload image from url I have url and using postman i am sending url after saving that from url i am generating file and added to model But getting above error Please take a look how can i solve this -
Unable to import djstripe.models to views.py
All the migrations have been successful and all the models and tables have been imported successfully by running command python3 manage.py djstripe_sync_plans_from_stripe enter image description here -
POST-request not working (django / rest_framework api)
i have got the ticket management system "helpdesk" running in django and i am trying to connect to it via an API (rest_framework). So far, i have managed to get the GET and PUT requests running via the rest_framework APIview. However, everytime i try to do a POST-request, i get the following error: Error Message I tried similar requests with selfmade django projects with simpler models and they all worked fine. Do you have an idea about what i did wrong here? By the way, i'm only working with all of this for about 2 weeks now, so please don't blame me for simple mistakes. Thanks in advance for your help! :) This is my api_views.py: from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework import generics, viewsets from rest_framework.pagination import LimitOffsetPagination from .serializers import DatatablesTicketSerializer from .models import Ticket from rest_framework.renderers import JSONRenderer, TemplateHTMLRenderer @api_view() def first_api_view(request): num_tickets = Ticket.objects.count() return Response({'num_tickets': num_tickets}) def all_tickets(request): tickets = Ticket.objects.all() ticket_serializer = DatatablesTicketSerializer(tickets, many=True) return Response(ticket_serializer.data) class AllTickets(generics.ListAPIView): # renderer_classes = [JSONRenderer] #toggle to switch raw json and optimized view queryset = Ticket.objects.all() serializer_class = DatatablesTicketSerializer class TicketViewSet(viewsets.ModelViewSet): # pagination_class = LimitOffsetPagination # ?? #authentication_classes = [] def list(self, request): … -
CSS changes happen on diffrent URL than expected
I am trying to create a webapp and on localhost:8000 I would like to put on the main page a table that shows a dataset of schools. The problem is that the css styles do not apply to localhost:8000, but they happen on localhost:63342 instead. localhost:63342 style modifications can be visible (see GID cell) database does not load localhost:8000 style cannot be seen database loads I would like to be able to see the style modifications on localhost:8000 as well schooldetails.html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link rel="stylesheet" type="text/css" href="schooldetails.css"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>Document</title> <style> th,td{ border: 1px black solid; } </style> </head> <body> <h1>School Page</h1> {% if schools %} <table> <tr id="school-gap "> <th class="cell">GID</th> <th>Type</th> <th>Province</th> <th>Street</th> <th>House_number</th> <th>Postcode</th> <th>City</th> <th>Municipality</th> <th>Geometry</th> </tr> <tr> {% for st in schools %} <td>{{st.gid}}</td> <td>{{st.schooltype}}</td> <td>{{st.provincie}}</td> <td>{{st.straatnaam}}</td> <td>{{st.huisnummer}}</td> <td>{{st.postcode}}</td> <td>{{st.plaatsnaam}}</td> <td>{{st.gemeentena}}</td> <td>{{st.geom}}</td> </tr> {% endfor %} </table> {% else %} <h1>No Data</h1> {% endif %} </body> </html> schooldetails.css /* (A) CONTAINER */ #school-gap { /* (A1) GRID LAYOUT */ display: grid; /* (A2) SPECIFY COLUMNS */ grid-template-columns: auto auto auto; /* we can also specify exact pixels, percentage, repeat grid-template-columns: 50px 100px 150px; grid-template-columns: 25% 50% 25%; grid-template-columns: 100px … -
SendGrid not fetching Send_Email_Id in Django when I am adding SendGrid template_id
I am getting 200 success codes. Email is been sending but when I am adding template id then still 200 is coming but the message is not delivering to the sent email. sg = sendgrid.SendGridAPIClient(settings.SENDGRID_API_KEY) data = { "from": { "email": settings.DEFAULT_FROM_EMAIL, "name": "######" }, "template_id":'########', "personalizations": [ { "subject": "Hello,Testing 1", "to": [ { "email":email } ], "dynamic_template_data ": [ { "info": info } ], } ], } try: response = sg.client.mail.send.post(request_body=data) print(response.status_code) print(response.body) print(response.headers) return Response( data={"message": f"success"}, status=status.HTTP_200_OK, ) except Exception as e: print(str(e)) -
send email when changing value in list_editable in Djngo admin
I am trying to implement a solution that will enable owners to send emails automatically whenever the owner changes the status and clicks save in list_view in the admin panel. The idea is that the owner goes to the admin panel, changes and saves the status for instance from received to in_progress and the user who sent a request receives an email notification. I am not sure what kind of method or function should I overwrite in my RequestsAdmin model to send an email when clicking save in my list_view in the admin panel. Creating the custom action to change status is not an option in this case. models.py class Requests(models.Model): STATUS = ( ('received', _('Question received')), ('in_progress', _('In progress')), ('ready_to_check', _('Ready to check')), ('published', _('Published')), ) user = models.CharField(max_length=255, blank=True, null=True,) owner = models.ForeignKey(User, blank=True, null=True, on_delete=models.CASCADE) title = models.CharField(max_length=1000, blank=True, null=True, default='') body = models.TextField('Description') publish_date = models.DateTimeField(default=timezone.now) priority = models.BooleanField(default=False, blank=True, null=True)default=False) status = models.CharField(max_length=32, choices=STATUS, default='received') admin.py class RequestsAdmin(ImportExportModelAdmin): list_display = ('title', 'publish_date', 'priority', 'owner', 'status') list_editable = ('status', ) admin.site.register(Requests, RequestsAdmin) -
How can I test the data saved in a session?
I new to Django and I'm trying to implement unittest. Is there a way to test the data saved in a session ? Here is a simple view, where dummy data is saved in the session. def save_data_in_session(request): request.session["hello"] = "world" # If I print(request.session.items()), output is dict_items([('hello', 'world')]) as expected. context = {} return render(request, "home.html", context) Here is my unittest class TestDummyViews(TestCase): def test_save_data_in_session(self): session = self.client.session url = reverse("home_page:save_data_in_session") response = self.client.get(url) session.save() # If I print(session.items()) output is dict_items([])... # Following test passes self.assertEqual(response.status_code, 200) # Following test fails. KeyError: 'hello' self.assertEqual( session["hello"], "world", ) -
How render django-table when click on TamplateColumn delete button?
I try build user table with delete option I use django table2 to view the list and when I click on delete button and delete user I want to render only the table list_of_user.html: {% load static %} {% load render_table from django_tables2 %} {% load bootstrap4 %} {% bootstrap_css %} <link rel="stylesheet" href="{% static "userApp/list_of_user.css" %}" /> <div class="container"> {% block content %} <div class="row"> {% if filter %} <div class="col-sm-10"> <form action="" method="get" class="form form-inline"> {% bootstrap_form filter.form layout='inline' %} {% bootstrap_button 'filter' %} </form> </div> {% endif %} <div id="table-user" class="col-sm-10"> {% render_table table % </div> </div> {% endblock %} </div> userTable.py from django.contrib.auth.models import User import django_tables2 as tables class Bootstrap4Table(tables.Table): email = tables.EmailColumn() username = tables.Column() first_name = tables.Column() last_name = tables.Column() option = tables.TemplateColumn( template_name="userApp/delete_button.html", orderable=False, verbose_name='' ) class Meta: model = User template_name = 'django_tables2/bootstrap4.html' fields = ('email', 'username', 'first_name', 'last_name', 'option') attrs = {"class": "table table-hover", "icon": "bi bi-trash"} delete_button.html {% load static %} {% load bootstrap4 %} {% bootstrap_css %} <button data-toggle="tooltip" onclick="destoryUser({{record.id}})" title="Please note that deletion cannot be undone" type="submit" class="btn-sm btn-primary">delete <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash3" viewBox="0 0 16 16"> <path d="M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 …