Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How can to run python unittests in Django in debug mode with PyCharm using local settings?
I have local settings for my Django project. I run applicatin with ./manage.py runserver --settings=settings.local command. I have next settings for Unittests But when I press Debug Unittests for test.t... I get error django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. settings/base.py AUTH_USER_MODEL = "core.User" settings/local.py from .base import * -
Django view/html input - Can I force an update using submit when no form update is present?
Is it possible to force a refresh of a template using a html form from the form itself when it appears no form updates are present? Here is a simple example of what I thought was a valid use case. A view generates a random number:- def test_random_view(request): varid=randint(1,1000) context={ "Randomid": varid } return render(request ,'test_random.html', {'context': context}) A simple page is supposed to generate this random number:- This doesn't work<br><br> Here is a random number: <br> {{ context.Randomid }} <form method='get' action=''> <input type="text" name="input" value="Here is an empty field"><br> <input type="submit" value="Update the random number"><br> </form> But on clicking the submit button the random number will not update. I'm assuming this is because it recognises that no update has been made to the form so it doesn't pass back to the view to generate a new random number. You can "trick" it by passing the random number into a text input:- This sort of works<br><br> Here is a random number: <br> <form method='get' action=''> <input type="text" name="input" value={{ context.Randomid }}><br> <input type="submit" value="Update the random number"><br> </form> But there is no reason for this text field to exist other than to force the form to recognise the update … -
add header to openstack api client
i am intern student. i want to add accept-language to openStack client for use translate error come back from server but i can't find any solution in document openstack from django.conf import settings from keystoneauth1 import session from keystoneauth1.identity import v3 from openstack import connection from novaclient import client as nova_client from gnocchiclient.v1 import client as gnocchi_client from cloudkittyclient.v1 import client as cloudkitty_client from glanceclient.v2 import client as glance_client from cinderclient.v3 import client as cinder_client def _get_session(request, project_id=None): if project_id: token = request.auth.projects.get(project__keystone_id=project_id) else: token = request.auth.projects.first() auth_token = token.scoped_token auth_url = settings.OPENSTACK_KEYSTONE_URL project_id = token.project.keystone_id project_domain_id = token.project.keystone_domain_id auth = v3.Token(auth_url=auth_url, token=auth_token, project_id=project_id, project_domain_id=project_domain_id) s=session.Session(auth=auth) return s def get_glance_client(request, project_id=None): session = _get_session(request, project_id) a=glance_client.Client(session=session) a.images.http_client.language_header = "fr" a.images.http_client.additional_headers["Accept-Language"]="fr" return a this is some part of my code i am try to add Accept-Language to header but response come back is english i check my openstack server local folder "fr" exist there -
how can I make the validation email condition before sending an email? [django]
how can I put condition if an email doesn't exist don't send this email to my own email I'm trying that here when I put (exists) method but I see as if it doesn't work. in both cases, shows me an email successful message how can I stops that ? if there is a mistake in my code becomes error I wish to get advice to process that sorry, I'm not fluent in English views.py from .forms import SignUp, ResetPassword, EditForm from website import settings from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from django.contrib.auth.views import PasswordResetView, PasswordResetDoneView from django.views.generic.edit import FormView from django.urls import reverse_lazy from django.core.mail import send_mail from django.contrib.auth.models import User class PasswordReset(PasswordResetView, FormView): template_name = 'account/password_reset_view.html' success_url = reverse_lazy('account:password_reset_done') email_template_name = 'account/reset_password_email.html' subject_template_name = 'account/password_reset_subject.txt' form_class = ResetPassword class PasswordResetDone(PasswordResetDoneView): template_name = 'account/password_reset_done.html' # Reset Your Password By G-mail Account def send_mail(self, request, **kwargs): subject = "Complete the modification of the password form" message = "please check here" if request.method == "POST": user = User.objects.filter(email=str(request.POST['email'])) if user.exists(): recipient = str(request.POST.get(kwargs['Email'])) if subject and message and recipient: send_mail(subject=subject, message=message, from_email=settings.EMAIL_HOST, auth_user=request.user.email, auth_password=request.user.password, recipient_list=[recipient], fail_silently=False) return render(request, self.template_name) else: return redirect('account:password-reset') def register(request): template_name = 'account/register.html' if … -
django http://127.0.0.1:8000/ This site can’t be reached
I run the python server and it runs successfully but when i visited the localhost http://127.0.0.1:8000 it show's me this site can't be reached here is the terminal with server runninggitbash terminal And here is my browser browser localhost -
Django versions and database support (MariaDB)
Based on the release notes of Django, it seems that: Support for Mysql 5.5 is dropped in Django 2.1 Support for MariaDB 10.1 and higher is added in Django 3.0 We currently use Django 2.0 with MariaDB 5.5, we'd like to upgrade to Django 3.0 and MariaDB 10.4. What would be the suggested upgradepath to get to the latest version of Django and MariaDB? Is Django 2.1 and 2.2 compatible with MariaDB 5.5 and should we upgrade to Django before upgrading MariaDB? Or is unofficial support for MariaDB 10.x sufficient in Django 2.1, Django 2.2 and Django 3.0 and should we just upgrade to MariaDB to 10.4 first? -
I get this erros{ "headers": { "normalizedNames": {}, "lazyUpdate": null, "headers": {} },..}
I'm using angular/cli 8.3.23 and django 3.0.2. I want to access the django backend server from angular to get image draw on dataframe but I receive the following error which I'm not understand : { "headers": { "normalizedNames": {}, "lazyUpdate": null, "headers": {} }, "status": 0, "statusText": "Unknown Error", "url": "localhost:8000/lineplot", "ok": false, "name": "HttpErrorResponse", "message": "Http failure response for localhost:8000/lineplot: 0 Unknown Error", "error": { "isTrusted": true } } Here's the code that try to connect to the backend: import { Component, OnInit} from '@angular/core'; import { HttpClient } from '@angular/common/http'; //import { Response } import { Observable } from 'rxjs'; @Component({ selector: 'app-visualization', templateUrl: './visualization.component.html', styleUrls: ['./visualization.component.scss'] }) export class VisualizationComponent implements OnInit { imgSrc = ""; baseUrl = 'localhost:8000/'; constructor(private _http : HttpClient) { } ngOnInit() { } // Visualization functions getLinePlot(){ this._http.get(this.baseUrl + 'lineplot').subscribe( image => this.imgSrc = image.toString() ); } Thanks in advance for your help. -
Two Docker containers not communicating with each other
I've hosted OSRM server: https://hub.docker.com/r/osrm/osrm-backend/ docker run -t -i --network="test-net" -p 5000:5000 -v "${PWD}:/data" osrm/osrm-backend osrm-routed --algorithm mld /data/indonesia-latest.osrm And its working as I am getting following output when browsing it: {"message":"URL string malformed close to position 1: \"\/\"","code":"InvalidUrl"} The backend is made using Django and the following code is supposed to hit the OSRM server and give the response: BACKEND_HOST = os.getenv('WEB_VRP_BACKEND_HOST', '<ip address of osrm hosted server>') BACKEND_PORT = os.getenv('WEB_VRP_BACKEND_PORT', '5000') request = 'http://' + BACKEND_HOST + ':' + BACKEND_PORT + '/table/v1/driving/' Both OSRM and Django is hosted in the same server and same network. The backend is built using docker and run docker run --name vrp-backend --network="test-net" -d -p 9012:8090 vrp-web-django And when i hit the backend with this address and required parameters, i get status:invalid in Postman. The two containers don't seem to be communicating but both are in same network and same server. http://<ip address>/vrp/parse I created the test-net network which is bridged. And docker inspect also shows both container in same network. What could be the cause? Thanks -
Want to show only the first latest post on my main page
i am trying to show only the first latest post the main page but still loops all. please i need help this is the view.py: def index(request): context = { 'infos': info.objects.all(), } return render(request, 'blog/index.html',context) index.html i want to know how to show only the latest post when is posted from the database <div class="img-border"> <!-- {% for info in infos %} --> <a href="{{ infos.video.url }}" class="popup-vimeo image-play"> <span class="icon-wrap"> <span class="icon icon-play"></span> </span> <img src="{% static 'blog/images/img_2.jpg' %}" alt="" class="img-fluid"> </a> </div> </div> <div class="col-md-5 ml-auto"> <span class="caption px-0 text-muted">Latest Sermon</span> <h2 class="h2 mb-0">{{ infos.title }}</h2> <span class="d-block mb-3"><em>by</em> {{ infos.author }}</span> <p class="h5 mb-2">If ye love Me, keep My Commandments.</p> <p class="mb-4 word-wrap1">{{ infos.content }}</p> <p><a href="{{ infos.video.url }}" class="popup-vimeo text-uppercase">Watch Video <span class="icon-arrow-right small"></span></a></p> <!-- {% endfor %} --> </div> </div> </div> </div> model.py class info(models.Model): image = models.ImageField(upload_to='profile_pics') video = models.FileField(upload_to="videos") title = models.CharField(max_length= 100) content = models.TextField() author = models.CharField(max_length=15) date_posted = models.DateTimeField(default = timezone.now) published = models.BooleanField(default=True) -
How to get the Model ID in the Graphene Django Relay query?
How to receive the native Model ID that stored in the DB (eg. django model ID) when we are executing the Relay query? The main issue that the Relay defines it's own ID so I'm not sure how can we correctly handle it. For ex. query { allFuelTypes (codeMatch: "g") { edges { node { id, code, label } } } } will print { "data": { "allFuelTypes": { "edges": [ { "node": { "id": "RnVlbFR5cGVOb2RlOjM=", "code": "g", "label": "Gas" } } ] } } } Where id is the Graphene Relay ID but I'd like to see the Model ID. The only one possible way that I see is just to create some alias in the graphene Schema for the Model ID field and manually fetch this ID from the Django Model. But perhaps there is existing some more dynamic way to achieve the same result? Thanks for any help! P.S. the implementation of the query isn't important. It's just a dummy demo -
Django, create profile at the same time User is registered
I am trying to make profile at the same time User is registered. I am following youtube video all the way to the end only to make failure. Any help would be welcomed. Thank you a lot. This is signals.py file. i am trying to use signal from django.db.models.signals import post_save from django.contirb.auth.models import User from django.dispatch import receiver from .models import Profile @receiver(post_save,sender=User) def create_profile(sender, instance, created, **kwargs): if created: Profile.objects.create(user=instance) @receiver(post_save,sender=User) def create_profile(sender, instance, **kwargs): instance.profile.save() and i set apps.py located in same modules that singals in. from django.apps import AppConfig class UsersConfig(AppConfig): name = 'users' def ready(self): import users.signals But it doesn't work when i make a new account. -
Mutate foreign field in Graphene Django (relay)
I'm wondering how to correctly implement the mutation that includes ForeignKey? Sorry for the long post but I really want to explain everything as much detailed as possible Let's imagine we have these models class FuelType(models.Model): code = models.CharField(max_length=64, help_text='Fuel Type. Diesel | Benzing | Gas | Spiritus, etc. Short code for it') # code = models.CharField(max_length=64, choices=TYPES.choices, default=TYPES.DIESEL, help_text='Fuel Type. Diesel | Benzing | Gas | Spiritus, etc. Short code for it') label = models.CharField(max_length=256, help_text='A human readable label of the fuel type.') # fuel_type = models.CharField(choices=FUEL_TYPES, default=0) def __str__(self): return self.label class Meta: ordering = ['id'] class FuelSubType(models.Model): fuel_type = models.ForeignKey('FuelType', on_delete=models.CASCADE, help_text='A fuel subtype. Eg, benzin Extra | 95 | 92, etc.') label = models.CharField(max_length=256, help_text='A human readable label of the fuel subtype type.') def __str__(self): return self.label I want to create a normal graphql mutation of the FuelSubType and I'm wondering about the best way how to implement it in the case of ForeignField class FuelTypeNode(DjangoObjectType): class Meta: model = FuelType # a custom Filter filterset_class = FuleTypeFilter interfaces = (relay.Node, ) class CreateFuelType(relay.ClientIDMutation): class Input: # The input arguments for this mutation code = String(required=True) label = String(required=True) ok = graphene.Boolean() # The class attributes … -
How should I use lists of instances in django
I'm trying to use some kind of list of objects in django. So I have different database entries: class A(models.Model): name = models.CharField(max_length=250) I would like to link these database entries with other database entries class B(models.Model): name = models.CharField(max_length=250) list<A> = ??? I would normally store a list of class A instances in class B, but in django? Each instance of class A has an ID in the database. So you would have to create a table for each instance of class B, in whose rows these IDs of class A are stored. But how do I do it? can someone please show and explain me a simple example? thx -
Is it possible to convert from Tkinter to Django
I am developing this platform using tkinter but now I want to change to Django without restarting everything. Is it possible? -
In django after deleting the posts the post images are still in the directory
In django my posts are deleted but the files are not. I have a image field in the model which i want to deelete whenever the author deletes it. I'm using generics class based views delete.. so when i delete the post the posts are deleted but the image isn't deleted from the directory. i'v tried in many ways but its not working. my models.py: class postManager(models.Manager): def repost(self, author, parent_obj): if parent_obj.parent: og_parent = parent_obj.parent else: og_parent = parent_obj obj = self.model( parent = og_parent, author = author, content = og_parent.content, image = og_parent.image, ) obj.save() return obj class post(models.Model): parent = models.ForeignKey("self", on_delete=models.CASCADE, blank=True, null=True) title = models.CharField(max_length=100) image = models.ImageField(upload_to='post_pics', null=True, blank=True) video = models.FileField(upload_to='post_videos', null=True, blank=True) content = models.TextField() likes = models.ManyToManyField(User, related_name='likes', blank=True) date_posted = models.DateTimeField(default=timezone.now) author = models.ForeignKey(User, on_delete=models.CASCADE) objects = postManager() def __str__(self): return self.title my views.py: @login_required def post_list(request): count_filter = Q(likes=request.user) like_case = Count('likes', filter=count_filter, output_field=BooleanField()) posts = post.objects.annotate(is_liked=like_case).all().order_by('-date_posted') return render(request, 'blog/home.html', {'posts': posts, }) class PostDeleteView(LoginRequiredMixin, UserPassesTestMixin, DeleteView): model = post fields = ['content', 'image', 'video'] success_url = '/' def test_func(self): post = self.get_object() if self.request.user == post.author: return True return False my urls.py: path('post/<int:pk>/delete/', PostDeleteView.as_view(), name='post-delete'), i"m using the … -
TypeError at /admin/attempt/add_model/add/
my models class add_category(models.Model): addcategory=models.CharField(max_length=20,null=True,blank=True) def __str__(self): return self.addcategory class sub_category(models.Model): category=models.ForeignKey('add_category', on_delete=models.CASCADE,related_name='xyz') subcategory=models.CharField(max_length=20,null=True,blank=True) def __str__(self): return self.subcategory class add_texture_categ(models.Model): addtexturecategory=models.CharField(max_length=20) def __str__(self): return self.addtexturecategory class add_texture(models.Model): apply_texture=models.ForeignKey('add_texture_categ', on_delete=models.CASCADE,null=True) texture_name=models.CharField(max_length=40,null=True,blank=True) texture_image=models.FileField(blank=True, default="", upload_to="media/images") def __str__(self): return self.texture_name class add_model(models.Model): select_category=models.ForeignKey('add_category', on_delete=models.CASCADE,null=True) select_sub_category=models.ForeignKey('sub_category', on_delete=models.CASCADE,null=True) available_in=models.ForeignKey('add_texture_categ', on_delete=models.CASCADE,null=True) model_name=models.CharField(max_length=10,blank=True,null=True) length=models.IntegerField(null=True,blank=True) breadth=models.IntegerField(null=True,blank=True) base=models.IntegerField(null=True,blank=True) name=models.CharField(max_length=20,blank=True) image = models.FileField(blank=True, default="" ,upload_to="media/images") def __str__(self): return self.name my viewset class add_modelViewSet(viewsets.ViewSet): def create(self,request): try: data=request.data model_name=data.get('model_name') length=data.get('length') breadth=data.get('breadth') base=data.get('base') select_category=data.get('select_category') select_sub_category=data.get('select_sub_category') available_in=data.get('available_in') new=add_model() new.model_name=model_name new.length=length new.breadth=breadth new.base=base new.select_category=add_category.objects.get(addcategory=select_category) new.select_sub_category=sub_category.objects.get(subcategory=select_sub_category) new.available_in=add_texture_categ.objects.get(addtexturecategory=available_in) new.save() return Response({'submit':True}) except Exception as error: return Response({"message": str(error), "success": False}, status=status.HTTP_200_OK) why am i getting this str returned non string type -
fields in class Meta got invalid
forms.py :` from django.forms import ModelForm from.models import Product class OpinionModelForm(ModelForm): class Meta: model = Product fields = ['name','email','body','product'] invalid in code line : fields = ['name','email','body','product'] #---- NOT WORK !!! but if i change above code to : fields = "all" # ----it is WORKing ok without any problem !! question : what is the error , i am not need all the fields in the Product model (like active boolean field) ,i need only 'name','email','body','product' fields . -
Django Reverse with arguments '(5,)' not found
I have created a view that accepts 3 arguments but I get the following error in the homepage. Reverse for 'application-detail' with arguments '(5,)' not found. 1 pattern(s) tried: ['(?P[0-9]+)/devices/(?P[^/]+)$'] urlpatterns = [ path('',views.MapView,name='home'), path('map/',views.MapView,name='map'), path('<int:application_id>/devices/<cat>', views.ApplicationDetail, name='application-detail'), ] View: def ApplicationDetail(request, application_id,cat): device = Device.objects.all().filter(category=cat) data = serializers.serialize('json', device) return HttpResponse(data, content_type='application/json') -
pd.to_datetime() Stop to working, application crash
I have a dashboard that use pandas to manipulate datas, and my DateTime conversions are being performed by pd.to_datetime function as sample below: pd.to_datetime(df1['ProcessFinishTime'],errors='ignore') I never had any problems related to dates in pandas. However today morning tried run my app and face this error message: raise TypeError(f"dtype {data.dtype} cannot be converted to datetime64[ns]") TypeError: dtype timedelta64[ns] cannot be converted to datetime64[ns] O tried to use the function below, but without success. pd.to_datetime(df1['ProcessFinishTime'].values.astype('datetime64[D]')) -
Django Suspicious File Operation joined path is located outside of the base path
When running python manage.py collectstatic i get the following exception: django.core.exceptions.SuspiciousFileOperation: The joined path (/Users/global_assets/images/backgrounds/seamless.png) is located outside of the base path component ..... Although I can't find where this file is located in my project and where it is requested. I have also installed django_heroku -
npm start in dev mode within django project fail using django-tailwind package
im trying to use the below package to use tailwind css within my django project im using a windows 10 machine package used to integrate tailwind-css in django tailwind-css uses npm modules to install and start of which the install worked although the start failed giving me the below error (all steps in the package Readme were followed upto 7 where the error occured) im trying to figure out whether its an issue nodejs has with windows or not. any help will be appreciated -
How to wait for task completes with celery chain?
I am trying to create a celery chain here: chain(getAllProducts.s(shopname, hdrs), editOgTags.s(title, description, whichImage, readableShopname, currentThemeId), notifyBulkEditFinish.si(email, name, readableShopname, totalProducts), updateBulkEditTask.si(taskID))() In editOgTags, there are 3 subtasks: @shared_task(ignore_result=True) def editOgTags(products, title, description, whichImage, readableShopname, currentThemeId): for product in products: editOgTitle.delay(product, title, readableShopname) editOgDescription.delay(product, description, readableShopname) editOgImage.delay(product, int(whichImage), currentThemeId) In each editOgXXX function, there is a function to be called with rate limit: @shared_task(rate_limit='1/s') def updateMetafield(index, loop_var, target_id, type_value): resource = type_value + 's' # print(f"loop_var key = {loop_var[index]['key']}") if type_value == 'product' or type_value == 'collection' or type_value == 'article' or type_value == 'page': meta = shopify.Metafield.find(resource=resource, resource_id=target_id, namespace='global', key=loop_var[index]['key']) checkAndWaitShopifyAPICallLimit() else: print("Not available metafield type! Cannot update.") return if meta: # meta[0].destroy() meta[0].value = loop_var[index]['value'] meta[0].save() else: metafield = shopify.Metafield.create({ 'value_type': 'string', 'namespace': 'global', 'value': loop_var[index]['value'], 'value-type': 'string', 'key': loop_var[index]['key'], 'resource': resource, 'resource_id': target_id, }) metafield.save() Under leaky bucket algo, it provides 40 api calls at once, 2 reqs / s replenishment. Since there is a rate limit of 2 requests / s for shopify function. I set the rate limit to 1/s. When it uses up the api quota, I will call time.sleep(20) to wait for replenishment. The question is the email notification function (notifyBulkEditFinish) is called before … -
AttributeError: 'Settings' object has no attribute
Examined the documentation of django and this post Django MEDIA_URL and MEDIA_ROOT but, I'm still having issues, at first It was a SQlight issue so, I updated to latest Django from Django 2 now I'm getting AttributeError: 'Settings' object has no attribute 'MEDIA_Root' Settings.py 'MEDIA_Root'STATIC_URL = '/static/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' urls.py from django.contrib import admin from django.urls import path from django.conf import settings from django.conf.urls.static import static urlpatterns = patterns('', path('admin/', admin.site.urls), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT), Also tried this. urlpatterns = [ path('admin/', admin.site.urls), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT), -
How to prevent XSS attacks in Django REST API CharFields?
I'm currently working on an app using Django 2.2 with djangorestframework 3.9.2. I am aware that Django itself provides good security protection against SQL Injection or in in the context of displaying content in django templates (XSS), but I've noticed that while I use Django REST API, all the CharFields in my models are not sanitized automatically. Note: this question does not apply to django templates. E.g. having a direct messages model (message/models.py): class Message(models.Model): sender = models.ForeignKey(...) receiver = models.ForeignKey(...) message = models.CharField(max_length=1200) timestamp = models.DateTimeField(...) is_read = models.BooleanField(default=False) Actually does not provide potential attacker from typing a message containing <script>alert("Attack");</script>. It will be saved in database and served by the REST API as a valid HTML, thus allowing to perform Cross Site Scripting attack. Is this an expected behavior? How can this be prevented? -
Model matching query does not exist in Django
I have implemented a student webportal functionality in django. it gives me this error DoesNotExist at /coninq/.. Can somebody help to solve this. Will paste my code here. Can somebody help me to solve this problem. error message: DoesNotExist at /coninq/ inqModel matching query does not exist. Request Method: GET Request URL: http://127.0.0.1:8000/coninq/ Django Version: 3.0.1 Exception Type: DoesNotExist Exception Value: inqModel matching query does not exist. Exception Location: C:\Program Files\Python38\lib\site-packages\django\db\models\query.py in get, line 415 Python Executable: C:\Program Files\Python38\python.exe Python Version: 3.8.0 Python Path: ['E:\Comp. Webportal\final\final', 'C:\Program Files\Python38\python38.zip', 'C:\Program Files\Python38\DLLs', 'C:\Program Files\Python38\lib', 'C:\Program Files\Python38', 'C:\Program Files\Python38\lib\site-packages'] Server time: Tue, 4 Feb 2020 12:13:00 +0000 1)Html Code <h3 class="header-title">Confirm Table</h3> <button id="demo-delete-row" class="btn btn-danger btn-sm" onclick="del()"><i class="mdi mdi-close mr-1"></i>Delete</button> <table id="demo-custom-toolbar" data-toggle="table" data-toolbar="#demo-delete-row" data-search="true" data-show-refresh="true" data-show-columns="true" data-sort-name="id" data-page-list="[5, 10, 20]" data-page-size="5" data-pagination="true" data-show-pagination-switch="true" class="table-borderless"> <thead class="thead-light"> <tr> <th data-field="state" data-checkbox="true"></th> <th data-field="name" data-sortable="true" >Name</th> <th data-field="number" data-sortable="true">Contact No.</th> <th data-field="email" data-sortable="true">Email</th> <th data-field="ref name" data-sortable="true" >Reffernce Name</th> <th data-field="time" data-sortable="true" >Time</th> <th data-field="date" data-sortable="true" >Date</th> <th data-field="inst" data-sortable="true" >Institute</th> <th data-field="sem" data-sortable="true" >Sem</th> <th data-field="stream" data-sortable="true" >Stream</th> <th data-field="language" data-sortable="true" >Language</th> </tr> </thead> <tbody> {% for s in result %} <tr> <td></td> <td>{{ s.fname1 }}</td> <td>{{ s.pnum }}</td> <td>{{ s.email }}</td> …