Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django view function getting called twice for one GET request
I have a url path defined as follows: re_path(r'installapp/(.+)', views.install_app, name='install-app') This URL path triggers a view function install_app. When a GET request is made to this URL path, the view function is triggered twice instead of once. How to prevent calling of view function twice for one GET request. -
How can I modify custom datetimepicker to display time selection first?
I have a modal that pops up to request an estimated timestamp. Most of the time, people only have to change the time, not the date, I was wondering how I can modify this so the time selection is displayed first when the picker is clicked, not the date? I'm not too familiar with python so I'm not sure if this is possible. update_modal.html {% load core_tags %} <form id="create-update-form" method="post" action="{% url "operations:update_timestamp_modal" main_object.id %}"> {% csrf_token %} <label>Please enter best estimated time for missing entry/exit</label> <div class="row"> <div class="form-group col-xs-6"> {% standard_input form.edited_timestamp datetimepicker=True hide_label=True %} </div> </div> </form> This is where I get the standard_input from core_tags.py def standard_input(context, field, **kwargs): """ Renders a form field with a label and a tooltip containing the help_text :param context: :param field: Form field :param kwargs: Additional keyword arguments (see below) :return: Rendered HTML for form field Additional optional kwargs: pre_addon: Additional group-addon text that appears before the input post_addon: Additional group-addon text that appears after the input datepicker: Whether or not this should use a datepicker widget datepicker_future: Whether or not this should use a datepicker widget that only allows future dates timepicker: Whether or not this should use … -
How to save manytomanyfield in django rest framewor and angular?
I am trying to save a manyToManyField, but I have the following error. TypeError at Direct assignment to the forward side of a many-to-many set is prohibited. Use .set() instead. In the following way I make my object in angular this.event.plan = []; checkPlan(plan) { if (this.event.plan.indexOf(plan) > -1){ this.event.plan.splice(this.event.plan.indexOf(plan),1); }else{ this.event.plan.push(plan); } } I only have this error when adding a record, when editing everything is done well -
getting object ID inside form.py
I am trying to check if my instance.id is not equal object.id in form.py so I can edit the post whenever all conditions are met. form.py ''' from django import forms from .models import Topic class TopicForm(forms.ModelForm): def __init__(self, *args, **kwargs): self.owner = kwargs.pop('owner') super(TopicForm, self).__init__(*args, **kwargs) self.fields['country'].empty_label = 'أختر الدولة' self.fields['city'].empty_label = 'أختر المدينة' self.fields['neighborhood'].empty_label = 'أختر الحي' self.fields['category'].empty_label = 'أختر القسم' self.fields['sub_category'].empty_label = 'أختر الفئة' self.fields['sub_sub_category'].empty_label = 'أختر النوع' class Meta: model = Topic fields = ['topic', 'category', 'sub_category', 'sub_sub_category', 'country', 'city', 'neighborhood', 'price', 'insurance', 'description', ] error_messages = { 'topic': { 'required': "الخانة هذي مطلوبة" }, 'category': { 'required': "الخانة هذي مطلوبة" }, 'sub_category': { 'required': "الخانة هذي مطلوبة" }, 'sub_sub_category': { 'required': "الخانة هذي مطلوبة" }, 'country': { 'required': "الخانة هذي مطلوبة" }, 'city': { 'required': "الخانة هذي مطلوبة" }, 'neighborhood': { 'required': "الخانة هذي مطلوبة" }, 'price': { 'required': "الخانة هذي مطلوبة", 'number': "الرجاء ادخال رقم صحيح" }, 'insurance': { 'required': "الخانة هذي مطلوبة" }, 'description': { 'required': "الخانة هذي مطلوبة" } } widgets = { 'topic': forms.TextInput(attrs={ 'required': True, 'placeholder': 'الرجاء إدخال عنوان' }), 'country': forms.Select(attrs={ 'required': True, 'empty_label': 'أختر الدولة' }), 'city': forms.Select(attrs={ 'required': True, 'placeholder': 'أختر المدينة' }), 'neighborhood': forms.Select(attrs={ 'required': True, … -
Django - Bad request syntax or unsupported method
I am working on a django project and I want to make a post request. import pandas import requests excel_data_df = pandas.read_excel('workorders.xlsx') json_str = excel_data_df.to_json(orient='records', date_format='iso') print(json_str) API_ENDPOINT = "http://127.0.0.1:8000/api/create/" API_KEY = "dF8NbXRA.94Mj2xeXT3NZOtx1b575CvNvbs8JWo0D" source_code = json_str data = {'api_dev_key':API_KEY, 'api_option':'paste', 'api_paste_code':source_code, 'api_paste_format':'csv'} r = requests.post(url = API_ENDPOINT, data = data) views.py class PostDataView(CreateAPIView): queryset = Workorder.objects.all() serializer_class = WorkorderSerializer serializers.py class WorkorderSerializer(serializers.ModelSerializer): class Meta: model = Workorder fields = '__all__' Thank you -
Django ModelForms - Filling fields from view?
Lets say I have a model: class Subtype(models.Model): SubtypeID = models.AutoField(primary_key=True, unique=True) Name = models.CharField(max_length=255, blank=True, null=True) TypeID = models.ForeignKey('Type', on_delete=models.CASCADE, null=True) And I'm creating this Subtype having already selected my Type object. I have TypeID as a parameter in my view. I now have a form: class addSubtypeForm(forms.ModelForm): class Meta: model = Subtype fields = ('Name',) labels = {"Name": "SubType Name"} SubtypeID is auto so I don't include that, but I need to specify a TypeID. I don't want my user to have to do that, which is why I have passed it to the view: def addSubtypeForm_Create(request, type): typeselected = Type.objects.get(TypeID = type) if request.method == 'POST': form = addSubtypeForm(request.POST) if form.is_valid(): form.save() return redirect('AddPart', obj.SubtypeID) else: form = addSubtypeForm() return render(request, 'proj/addSubtype.html', {'form': form, 'type': typeselected}) I just have no idea how to assign this from the view, I feel it should be possible though? Any help would be really appreciated. -
predicting image using fastai and django
i am making a django application in which i let user upload an image. i am not saving image anywhere. inside the view i want to predict the image label using learn.predict method of fastai library. i want help about how can i pass the image uploaded by user to the predict function inside of view without actually saving image. here is the predict image function def openimage(img): loc = static('/MainApp/') learn = load_learner(loc) i = open_image(img) predx, predidx, info = learn.predict(img) print(predx) and here is view function def predict(request): if request.method == "POST": i = request.FILES['img'] #img is form field in forms.py file openimage(i) return render(request, 'MainApp/ML.html') else: form = predictform return render(request, 'MainApp/ML.html', {"form" : form}) -
TokenValidator in `django-cognito-jwt` get_public_key method returns None
I am following the aws-cognito-tutorial-complete and trying to use Bearer with Django because my target is Single Page App(SPA) consuming Django REST Framekwork and GraphQL. With the given example I can get connected with AWS and be able to signup, login, ... etc to AWS Cognito. Then I use django-cognito-jwt to decode the Bearer token. Problem: django-cognito-jwt raises error regarding the public key problem Attempt: TokenValidator class with method _get_public_key token is there 35 def _get_public_key(self, token): 36 import ipdb; ipdb.set_trace() ---> 37 try: 38 headers = jwt.get_unverified_header(token) 39 except jwt.DecodeError as exc: 40 raise TokenError(str(exc)) 41 42 if getattr(settings, "COGNITO_PUBLIC_KEYS_CACHING_ENABLED", False): ipdb> token b'eyJraWQiOiJUaGd4NXo5MnFxNjdPR1wvMDRjT0xDS2U2K0dsQlU3XC9LZklHK2hJdFwvSjR3PSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiIyZTQ3OTBhMC0zNWE0LTQ1ZDctYjEwYy1jZWQ3OWJlMjJlOTQiLCJhdWQiOiIxNTl1ZmpyaWhnZWhiNjdzbjM3M2FvdGxpNyIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJldmVudF9pZCI6ImM2OTA0NjYyLWZlOWUtNGYwZi04OTc3LTdhZGU4M2YyOTAxMyIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNTc1NDU3MDIwLCJpc3MiOiJodHRwczpcL1wvY29nbml0by1pZHAudXMtd2VzdC0yLmFtYXpvbmF3cy5jb21cL3VzLXdlc3QtMl9mbENKYW9EaWciLCJjb2duaXRvOnVzZXJuYW1lIjoiam9obi1yYW1ibyIsImV4cCI6MTU3NTQ2MDYyMCwiaWF0IjoxNTc1NDU3MDIwLCJlbWFpbCI6ImZvZ2d5Z2lnYUBnbWFpbC5jb20ifQ.jk207sDdYb7CDhc5r0hZXa_EDPqG9Fi2oBTot8Tv_moJxdB1v4cNCDLB6m5rVVHzmxI8-cPj00GViMH3-LORnQcg4KitAlew_aD_RMD5Hzy3ltABrMYBf9LEI2kq6---Li9jk3NYpVji2h5W4oKoJrHRriJSuNuBFFijFXEc29iLhQclaDLWvXw4BJI087BKCYpnD-xR79bM3nYI-m9Wp40e_e7JbsGtu1JKfTym_nKLE-yncyhWq0rarIbauBHmq5hRYCQofUbSWD6IRGCZaiLRPBTk6LvUd3VigUz9x0mIU8feViRQmFcVFfRsB56Pbx10RUAUYHBR4JNHCMROpQ' Go next to headers ipdb> headers {'kid': 'Thgx5z92qq67OG/04cOLCKe6+GlBU7/KfIG+hIt/J4w=', 'alg': 'RS256'} ipdb> cache_key 'django_cognito_jwt:Thgx5z92qq67OG/04cOLCKe6+GlBU7/KfIG+hIt/J4w=' jwk_data is None ipdb> self._json_web_keys {'D2syaFjXXpkbzTjkRHLAtdX065Neb1EfUguGabpJWlo=': '{"alg": "RS256", "e": "AQAB", "kid": "D2syaFjXXpkbzTjkRHLAtdX065Neb1EfUguGabpJWlo=", "kty": "RSA", "n": "kDmz5mTlTil_r6sVMnln2ohc45_TlBPw1pOcVJtEyGW2_vXN4EXnYKxcFyFQqZIjXaYlrAFBAMAW_qlIfJ0J8coyNImLngfUbk1cbwwQr3wTB-6t8bM8x_B8D_D7uB-HfGe8SNS1yFU6gfDnd4z7kJZvJIFV_uEWP5A1cbXdTOTPlj3zKUXnpXBvnZ5d_V2Y3gPjlv_m3uh3ZejeTAnaLF-PGt69DdD9dj04ncqPa2rK8eShPWYckZ_oaH_4Ju9FmQGD6lzoUHhRxEsfq6pEr2wFt2TAcji9WG7NUFO5v83GRfaWiRnGSVI8iVzVWjzzGvdqAuiMgKUDtmq7b9r5Xw", "use": "sig"}', 'a7tocHhrCduYr7EFRiR9A2txhEbl2dCOOBvYAYEdEJA=': '{"alg": "RS256", "e": "AQAB", "kid": "a7tocHhrCduYr7EFRiR9A2txhEbl2dCOOBvYAYEdEJA=", "kty": "RSA", "n": "re0iYlsRqmSkoqZiGlz3mTYb0HJ3vjCXwN83OmbNQyAguC-Tflb95Z1bEJsVL0Wr6ZvmFFGpXjJU1n3K9DO2JadnBQkGsJegYvXaNC2IgHnHDq9chrP6cNdnO5jAo7wqtMeZi2VqccyRFXVx9dyKAbyGgborORP5raFSvHU-qT2iVfwrbSbWXAH1qwkwbMMbU6fUHJp7u9ZrJT04qMhm-asgoSA6Swe4znqcg87W2dSWMzstyUQwTN-1Kn2GXmTIyYo4lUIoyQRXyl2d8L37iTkbRayulvLqvzkKglAHlRF6jLLHLZt6-ZBf3hvISDbO5Vwo7jJGTYYu6h3tKKbSBQ", "use": "sig"}'} ipdb> headers["kid"] 'Thgx5z92qq67OG/04cOLCKe6+GlBU7/KfIG+hIt/J4w=' At this point jwk_data is None > /Users/sarit/.pyenv/versions/muy/lib/python3.7/site-packages/django_cognito_jwt/validator.py(48)_get_public_key() 47 jwk_data = self._json_web_keys.get(headers["kid"]) ---> 48 timeout = getattr(settings, "COGNITO_PUBLIC_KEYS_CACHING_TIMEOUT", 300) 49 cache.set(cache_key, jwk_data, timeout=timeout) ipdb> jwk_data ipdb> Workaround: Zoom in the token_validator.validate(jwt_token) class JSONWebTokenAuthentication(BaseAuthentication): """Token based authentication using the JSON Web Token standard.""" def authenticate(self, request): """Entrypoint for Django … -
How can you manually assign a generated file to a form field?
I've been struggling to solve this myself for a good while now and I just can't understand how it works. I found a way to get my generated file straight into the model, but it doesn't serve its purpose well because I also need the file to be uploaded to Amazon Web Services. Any solution that helps me with this is appreciated! In my code, I request a JSON file from the user and generate a text file in a specific format using it. This needs to both make its way to the field in the model, and be uploaded to the storage system in AWS. Here's my view as it is currently: def sped_create(request): form = SpedForm(request.POST, request.FILES, None) # sped = get_object_or_404(Sped, pk=id) if form.is_valid(): data = json.load(form.cleaned_data['json_file'].open()) # (json is successfully processed here: I've confirmed that the lines that would usually be here are irrelevant to the problem) f_txt = open(f"static/file_created_txt/bacon.txt", "w+", encoding='utf-8') # FALTA ARRUMAR O DIRETÓRIO for string in fileTxt: f_txt.write(f"{string}\n") f_txt.close() instance = SpedForm(sped_file=request.FILES['static/file_created_txt/bacon.txt']) instance.save() sped = form.save() return redirect(sped_list) return render(request, 'sped_form.html', {'form': form}) Currently, I've been getting this traceback: Environment: Request Method: POST Request URL: http://127.0.0.1:8000/sped_create/ Django Version: 2.2.7 Python Version: 3.7.3 … -
Mandatory one to many relationship in Django
Suppose I've a model Car and a model Passenger (passenger includes the driver of the bus). The models are read/write able via DRF and admin interface. How can I enforce that each car has at least one passenger and potentially several passengers (mandatory one-to-many relationship)? How/where do I have to implement validation before a model is created? -
Ajax request causing Internal Server error
This is my ajax call which is causing internal server error $.ajax({ url: url, method: "POST", dataType: 'json', data: { 'completed': true }, success: function (data) { console.log(data) }, error: function (data) { console.log(data) } }); But when i try manually with the django rest framework it is working fine. -
Django override login page
Would it be possible to just reuse the login page? I just want to add sign up button in the login page. But for what I have searched, it needed to customize all in order to override it. Please help. -
How to properly implement AJAX into Django's MVT
Estimated outcome: When a user visits www.myapp.com/dashboard Django shall render the dashboard. Meanwhile, AJAX shall call (on a regular period) the view getAccountInfo which queries data via the model AccountInformation from PostgreSQL database. The view then returns the latest data and AJAX/JS will update the DOM accordingly (staying on the very same page/url). What makes me feel dizzy: I just don't get how Ajax is implemented here considering the Django MVT architecture. Basically each URL maps to a single view. So once I visit /dashboard it calls the view render_Dashboard. But when I now map the Ajax URL to that view and include the DB query logic into the very same view, it will render the complete site again which will create an infinite loop. So I have to map the Ajax URL to my second view to make it happen? But this view doesn't have an URL because I only want to have /dashboard as URL for users to visit? So how to implement the second view into this architecture? What I have so far: views.py inside dashboard app: from Dashboard.models import AccountInformation #Get Account Information from PostgreSQL DB def getAccountInfo(): account_information = AccountInformation.objects.all() for row in account_information: profit … -
Why on earth does django parse commented html code?
This just cost me like 4 hours. Why on earth does django try to parse tags in commented out html code? -
Django Html Page Rendering Items For Loop
I have a page that I'm running a for loop on and the issues is I only want to show 4 students per column, and then start the next column with the other 4 students. However, I'm struggling getting it to work . I originally had all of this setup correctly, but the second i added the for loop it messed up all the placements of the columns. The code I'm posting is just 4 students in the first column, ill need another 2 columns to display all 12. Truly appreciate the help. Thanks {% extends 'base.html' %} {% load crispy_forms_tags %} {% crispy K8Points_ClassroomForm %} {% load static %} {% block content %} <br> <h2>{% load static %} <img src="{% static 'forms/star.png' %}" alt="chain" height="62" width= "62"> My Classroom</h2> <br> <br> <form action = "/points/k8_points_classroom" method="POST"> {% csrf_token %} <!-- Start Date --> <div class = "container"> <div class = "container"> <div class= 'row'> <div class="col-4"> <p> Recording Data as User : {{user.username}} </p> <p> Today's Date : {{date}} </p> <p> <b> Classroom : {{classname}} </b> </p> </div> </div> <div class="jumbotron" align ="middle"> <h1>My Students</h1> <!-- Line Break --> <hr style="border: 1px solid black;" /> <!-- Line Break --> … -
Playing all songs of a playlist one by one Django
Is there any way I can play all songs that are attached to a playlist using manytomanyField one by one Playlist model: class Playlist(models.Model): image = models.ImageField() name = models.CharField(max_length=100, unique=True) artist = models.ForeignKey(User, on_delete=models.CASCADE) songs = models.ManyToManyField(Music, null=True, blank=True) slug = models.SlugField(unique=True) def __str__(self): return self.name def get_absolute_url(self): return reverse('playlist-detail', kwargs={'pk': self.pk}) @classmethod def add_music(cls, new_song): playlist, created = cls.objects.get_or_create(songs=new_song) playlist.songs.add(new_song) @classmethod def remove_music(cls, new_song): playlist, created = cls.objects.get_or_create(songs=new_song) playlist.songs.remove(new_song) and here's how I try to play it: <body onload="cs_change_music('{{object.songs.song.url}}');document.getElementById('song').innerHTML = '{{object.name}}'; document.getElementById('artist').innerHTML = '{{object.artist}}';document.getElementById('cover-image').src = '{{object.image.url}}'"> </body> and it returns unknown as audio source -
List all nullable django model fields
I have a model with both nullable and non-nullable fields. Let's consider an example: from django.db import models class MyModel(models.Model): field_1 = models.CharField(null=False) field_2 = models.CharField(null=True) field_3 = models.ForeignKey(SomeOtherModel, null=True) field_4 = models.ForeignKey(YetAntherModel, null=False) How could I get list of nullable field names (as in example below) from MyModel class? ['field_2', 'field_3'] Right now I have hardcoded mapping which I need to update together with model changes so I'd like to have some generic method for it. Any idea would be appricieated. -
Filter objects with Rest Framework Django API
I have a model Person in Django class Language(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) name = models.CharField(max_length=50) def __str__(self): return self.name class Country(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) name = models.CharField(max_length=50) def __str__(self): return self.name class Person(models.Model): PersonId= models.UUIDField( primary_key=True, default=uuid.uuid4, editable=False) Countries = models.ManyToManyField(Country) Languages = models.ManyToManyField(Language) each person can have (visit) many countries and have (speak) many languages. I want to create an API that I will send to the endpoint list of few languages and countries, and will return for me the people, which has at their list one of the language and country that I sent. For example I have Person(1,['Portugal', 'Spain'],['portugues','spanish']) , Person(2, ['Portugal', 'Germany'],['portugues','russian']), Person(3,['France', 'Spain'],['spanish', 'french']) I sent data { Countries: ['Portugal', 'France'], Languages: ['russian', 'french'] } so in this case it returns Person2 and Person3. My PersonView with Authentication class PeopleListView(ListAPIView): queryset = Person.objects.all() serializer_class = PersonSerializer authentication_classes = [TokenAuthentication, ] permission_classes = [IsAuthenticated, ] def get_queryset(self): return Blog.objects.filter(UserId=self.request.user) Is there any way to do this? I would not like to search by url but send data in body. -
Getting error when changing field-lengt on a ForeignKey to a model not part of HistoricalModel
I use Historical Model in django and need help understanding why change in a non-historical model reference results in DataError Here is my model before and after change: Before: ` from src.lib.db_models import HistoricalModel class NoHistorical(models.Model): id = models.CharField(max_length=1, primary_key=True) class MyHisorical(HistoricalModel): id = models.CharField(max_length=1, primary_key=True) id2 = models.ForeignKey(NoHistorical, on_delete=models.SET_NULL, null=True) ` After: ` from src.lib.db_models import HistoricalModel class NoHistorical(models.Model): id = models.CharField(max_length=2, primary_key=True) class MyHisorical(HistoricalModel): id = models.CharField(max_length=1, primary_key=True) id2 = models.ForeignKey(NoHistorical, on_delete=models.SET_NULL, null=True) ` makemigration&migrate id2=NoHistorical.objects.create(id='bb') MyHisorical.objects.create(id=1,id2=id2) Result in: DataError: value too long for type character varying(1) How can this be solved? -
Django deployment on iis server
I have deployed a django application on IIS server. It's running perfectly fine on localhost:8000, on the server. However if the application runs into an error it is displayed on the external devices, and the server exists the runserver command on the server. How can I prevent the sever to exist runserver command and no error is displayed on the external system. -
Django query complex query in one to one field model
I have two models of Student and Parent Student models.py: class StudentInfo(models.Model): admissionNumber = models.BigIntegerField(primary_key=True,default=0) firstName = models.CharField(max_length=20) lastName = models.CharField(max_length=20) fullName = models.CharField(max_length=50) gender = models.CharField(max_length=20) dob = models.DateField(null=True) classSection = models.CharField(max_length=20) Parent models.py class ParentInfo(models.Model): student = models.OneToOneField(StudentInfo,primary_key=True, on_delete=models.CASCADE) fatherName = models.CharField(max_length=20) motherName = models.CharField(max_length=20) I have a form to search students through their fatherName. So, what I want is to filter those students whose father's name contains 'some name'. I tried this but it resultes in query set of ParentInfo: parentInfo = ParentInfo.objects.all() studentsInfo = parentInfo.filter(parent__fName = fName).select_related('student') -
Django filters with a string variable field
I want to filter a model with a field but I want to pass the field as a string variable. How can I do it? For example: the_field = 'name' TheModel.objects.filter(the_field='Gazelle') What should I replace the_field with? -
how to render django location field by id for each post?
i have a model in django like this : class post (models.Model) title = models.CharField(max_length=120) .. .. location = models.PointField(srid=4326, null=True, blank=True) objects = GeoManager() def unicode(self): return self.title def get_absoulute_url(self): return reverse("post_map", kwargs={ 'id':self.id }) and i want to render location place by id like this: path('post-map//map/',post_map,name='post_map') path('post-map//index/',home_page,name='post_map') def map (request,id): name = serialize('geojson',get_objects_or_404(Post, id=id) return HttpResponse(name,content_type='json') def home_page(request): return render(request,'home_page.html') and home_page.html is: -
When i run command docker-compose stuck at : db_1 | Version: '5.7.28' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
i am new here in docker, i am working on django, when i try to run docker-compose up, console stop after this message db_1 | Version: '5.7.28' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) Can anyone please help me what i need to do now to start my project ? -
How to get name respect to the id from different mysql table in django
i have project which submits data of employee, and i have dropdown which gives department list , while submit it takes id of that department. so when i shows that data in table i gets id but i want name of that id which is in department table how can i do that. view.py def managemp(request): employees = Employee.objects.all() department = Department.objects.all() location = Location.objects.all() return render(request, "manageemp.html", {'department': department, 'employees': employees, 'location': location}) form.py class EmpForm(ModelForm): class Meta: model = Employee fields = ["employee_id", "Name", "designation", "department_id", "manager_id", "date_of_joining", "date_of_birth", "location_id", "email", "contact_number", "password", "created_by", "modified_by", "status", "user_type"] class dept(ModelForm): class Meta: model = Department fields = ["department_id", "department_name", "created_by", "modified_by", "status"] html <tbody id="myTable"> {% for employee in employees %} <tr> <td>{{ employee.employee_id}}</td> <td>{{ employee.Name}}</td> <td>{{ employee.designation}}</td> <td>{{ employee.department_id}}</td> <td>{{ employee.manager_id}}</td> <td>{{ employee.location_id}}</td> <td> <a href="#editEmployeeModal" class="edit" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Edit">&#xE254;</i></a> <a href="#deleteEmployeeModal" class="delete" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Delete">&#xE872;</i></a> </td> </tr> {% endfor %} </tbody>