Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Heroku connecting to random postgresql server instead of MongoDB
Currently i am working on a web app with Django and MongoDB (using Djongo). I have connected the mongodb server succesfully on my pc and everything worked fine but when i started deploying the project to heroku, it connected to a random postgresql server instead of my mongoDB server. Heres my DATABASES settings in settings.py: DATABASES = { 'default': { 'ENGINE': 'djongo', 'NAME': 'database', 'CLIENT': { 'host': 'mongodb+srv://connectionstring', 'username': 'name', 'password': 'pass' } } } Any clue why this is happening? -
how i configure django new app execute as latest app?
I have created a Django module. In this module, a model related to the Django user model exists. I have used the module already. it was correct and worked successfully. now I would like to deploy my project to the server. I clone the project to the server, run make the migration, and then run the runserver command. all things are right. but when I run the 'manage.py test' command. it shows below errors File "/home/rasoul/Desktop/debug/backend/.venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers return executor(sql, params, many, context) File "/home/rasoul/Desktop/debug/backend/.venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) File "/home/rasoul/Desktop/debug/backend/.venv/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/home/rasoul/Desktop/debug/backend/.venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) File "/home/rasoul/Desktop/debug/backend/.venv/lib/python3.8/site-packages/elasticapm/instrumentation/packages/dbapi2.py", line 210, in execute return self._trace_sql(self.__wrapped__.execute, sql, params) File "/home/rasoul/Desktop/debug/backend/.venv/lib/python3.8/site-packages/elasticapm/instrumentation/packages/dbapi2.py", line 244, in _trace_sql result = method(sql, params) django.db.utils.ProgrammingError: relation "user_user" does not exist -
Generic model that can be used by several other models but only one at a time
I'm trying to make a Description model that can be used by several different models. But the Description model can only have one at a time. Lets say that i have these two models. class Account(models.Model): user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) birthdate = models.DateField() phoneNumber = models.CharField(max_length=20) class CompanyProfile(models.Model): companyName = models.CharField(max_length=50) VAT = models.CharField(max_length=35, unique=True) I want both to have multiple descriptions. One (dirty) solution that i found was this. class Description(models.Model): title = models.CharField(max_length=100) text = models.CharField(max_length=2500, null=True, blank=True) account = models.ForeignKey(Account, on_delete=models.CASCADE, null=True, blank=True) company = models.ForeignKey(CompanyProfile, on_delete=models.CASCADE, null=True, blank=True) In normal python you would just be able to have a list of description. But in django, this isn't possible. I've thought about using generic relations but that seems to work differently. Why I want to do it like this? Because I want to expand Description by using inheritance and I want to be able to use all those types of 'Descriptions' for multiple classes. -
Strange behavior manage.py loaddata in Heroku Procfile
I tried to load the Heroku PostgreSQL database during the execution of the Procfile when deploying the site to Heroku. At the first stage, I create database empty db, deployed the site and initialized the database. Procfile: release: python manage.py makemigrations release: python manage.py migrate web: gunicorn design_sa.wsgi --log-file - log 1 db after initial django migrate At the second stage I did it: Procfile: release: python manage.py loaddata design-sa_no_unnessesary.json log 2 According to the log, the download was successful (174 records processed)! Miracles followed - nothing changed in the database. db after loaddata - the same The question is - where are all the rows "succesfully" installed ?! -
Django - ForeignKey to model with multiple choices
Sorry if the title is a bit unclear, I am a beginner and I have a few questions about database design. I am building django app that would store info about a Book and another class Category that contains a list of genres. I would like to connect these tables so that one could choose category when inserting the book, however the categories are not showing up (I'm using django forms). Do you maybe know why? CATEGORIES = (('Thriller', 'Thriller'), ...) class Category(models.Model): name = models.CharField(max_length=40, choices=CATEGORIES, default='Unknown') class Book(models.Model): user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) title = models.CharField(max_length=200) ....... category = models.ForeignKey(Category, on_delete=models.CASCADE) Or should I just include category inside the Book class and not connect them with ForeignKey? What would be the pros and cons of this? I already changed my DB few times splitting things up and again just putting it back to Book class as I don't really know what is better design in this situation. Thanks -
Class 'Task' has no 'objects' member
#I don't know where have I made a mistake, there is a error says Class 'Task' has no 'objects' member ''' views.py from django.shortcuts import render from django.http import HttpResponse from .models import * # Create your views here. def index(request): tasks = Task.objects.all() context = {'tasks':tasks} return render(request,'task/list.html',context) ''' ''' models.py from django.db import models # Create your models here. class Task(models.Model): title = models.CharField(max_length=200) complete =models.BooleanField(default=False) created = models.DateTimeField(auto_now_add=True) def __str__(self): return self.title ''' ''' list.html <h3>To Do</h3> {%for first in task %} <div> <p>{{first}}</p> </div> {% endfor %} ''' One more thing which is the database SQL lite inbuilt, I have created task but it does not shows below ex: It should be like Task playing Dancing It says Task Task Object(2) Task Object(1) -
Forbidden (403) Post Request in a "Build React App" but work fine with React App running on "http://localhost:3000/" and PostMan
I am using Django Rest Framework and React. When I run the react app on "localhost:3000", every post request is accepted and worked fine. But After I build the react app with "npm run build". Then, all POST requests are being Forbidden(403) and GET requests are working fine. -
Using ajax jquery for search form
I'm working on a Django project where I want to use ajax jquery to complete my search in my search form. Tried everything, but it does not seem to work. Pls, where have I missed it? used this tutorial views.py import json def search(request): if request.method == 'POST': form = SearchForm(request.POST) if form.is_valid(): query = form.cleaned_data['query'] catid = form.cleaned_data['catid'] if catid == 0: products = Product.objects.filter(name__icontains=query) else: products = Product.objects.filter(name__icontains=query, category_id=catid) category = Category.objects.all() context = { 'products': products, 'category': category, 'query': query, } return render(request, 'shop/product/search.html', context) return HttpResponseRedirect('/') def search_auto(request): if request.is_ajax(): q = request.GET.get('term', '') products = Product.objects.filter(name__icontains=q) results = [] for pl in products: product_json = {} product_json = pl.name results.append(product_json) data = json.dumps(results) else: data = 'fail' mimetype = 'application/json' return HttpResponse(data, mimetype) Thanks. -
objects.update_or_create() creates a new record in database rathe than update exisiting record
I have created a model in Django and for which I get the data from an API. I am trying to use the update_or_create method for getting the data from the API and into my database. However, I may be confused on how it works. When I run it for the first time it adds the data into the database as expected, however if I were to update one of the fields for a record - the data from the API has changed for the respective record - and then run it again, it is creating a new record rather than updating the existing record. So in the scenario below, I run it and the count for record Commander Legends is 718, which I then update manually in the database to be 100. When I run it again, it creates a new record with count of 718 With my understanding of it, it should of updated the record rather than create a new record. views.py def set_update(request): try: discover_api = requests.get('https://api.scryfall.com/sets').json() set_data = discover_api['data'] while discover_api['has_more']: discover_api = requests.get(discover_api['next_page']).json() set_data.extend(discover_api['data']) except HTTPError as http_err: print(f'HTTP error occurred: {http_err}') except Exception as err: print(f'Other error occurred: {err}') sorted_data = sorted(set_data, key=lambda … -
Pop up warning message of inactivity in django
I have managed to log a user (who is defined under the admin group 'customer') out of their session and managed to return them to the login page using the SESSION_COOKIE_AGE functionality in my settings.py. But i want to create a pop up warning message to the user after a X amount of time of inactivity. I did some research and i found SESSION_SECURITY_WARN_AFTER option but i think this requires javascript which i am unfamiliar with. Is there another way? Below is my code: views.py: @allowed_users(allowed_roles=['customer']) def home_view(request): # forms context = {#keys} return render(request,"home.html",context) decorator.py: def allowed_users(allowed_roles=[]): def decorator(view_func): def wrapper_func(request, *args, **kwargs): group = None if request.user.groups.exists(): group = request.user.groups.all()[0].name if group in allowed_roles: return view_func(request, *args, **kwargs) else: messages.info(request, 'Your session has expired!') return redirect('login')` return wrapper_func return decorator settings.py: #SESSION SECURITY SETTINGS SESSION_EXPIRE_AT_BROWSER_CLOSE = True SESSION_COOKIE_AGE = 10 # Low time for testing SESSION_SAVE_EVERY_REQUEST = True -
Try to test views that use request.session[key] in dajngo
I made an attempt to test on a views.py in which the file has one line using request.session['key'] values. def updateaccout(request): username = request.session['username'] profile = Account.objects.get(username=username) return render(request, "user/profile .html",profile ) At the test.py file I have tried sets. def test_updateaccout(self): self.client.login(username='john', password='johnpassword') session = self.client.session session['username'] = 'john' session.save() c = Client() data = {'username' : 'john'} response = c.post('/account', data,follow=True) self.assertEqual(response.status_code,200) ERROR: test_updateaccout (user.tests.UsersTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/ubuntu/cn331project/user/tests.py", line 57, in test_updateaccout response = c.post('/login/account', data,follow=True) File "/home/ubuntu/.venv/lib/python3.7/site-packages/django/test/client.py", line 741, in post response = super().post(path, data=data, content_type=content_type, secure=secure, **extra) File "/home/ubuntu/.venv/lib/python3.7/site-packages/django/test/client.py", line 405, in post secure=secure, **extra) File "/home/ubuntu/.venv/lib/python3.7/site-packages/django/test/client.py", line 470, in generic return self.request(**r) File "/home/ubuntu/.venv/lib/python3.7/site-packages/django/test/client.py", line 709, in request self.check_exception(response) File "/home/ubuntu/.venv/lib/python3.7/site-packages/django/test/client.py", line 571, in check_exception raise exc_value File "/home/ubuntu/.venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/home/ubuntu/.venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/ubuntu/cn331project/user/views.py", line 50, in updateaccout username = request.session['username'] File "/home/ubuntu/.venv/lib/python3.7/site-packages/django/contrib/sessions/backends/base.py", line 65, in __getitem__ return self._session[key] KeyError: 'username' Another one that I tried to set is to add self._session ['username'] = 'john' but it says AttributeError: 'UsersTestCase' object has no attribute '_session' how can I do to solve it? thank you -
django channels works locally but fails on server
Django channels fails to connect in production i'm working on a chat application using django Channels and reconnecting-web-socket the app works fine locally but when deployed to heroku the site works fine but the web socket closes before connection is established and sometimes it works fine. it tries to connect and says websocket open and established 2020-11-21T11:45:14.483101+00:00 app[web.1]: 10.38.231.42:12792 - - [21/Nov/2020:11:45:14] "WSCONNECTING /ws/chat/" - - 2020-11-21T11:45:14.483267+00:00 app[web.1]: 2020-11-21 11:45:14,483 DEBUG Upgraded connection ['10.38.231.42', 12792] to WebSocket 2020-11-21T11:45:14.486434+00:00 app[web.1]: 2020-11-21 11:45:14.486 UTC [24] LOG C-0x5564d6f000a0: db1/kutxkggzwbkjsp@127.0.0.1:35034 login attempt: db=db1 user=kutxkggzwbkjsp tls=no 2020-11-21T11:45:14.493134+00:00 app[web.1]: 2020-11-21 11:45:14,492 DEBUG WebSocket ['10.38.231.42', 12792] open and established 2020-11-21T11:45:14.493228+00:00 app[web.1]: 10.38.231.42:12792 - - [21/Nov/2020:11:45:14] "WSCONNECT /ws/chat/" - - 2020-11-21T11:45:14.493405+00:00 app[web.1]: 2020-11-21 11:45:14,493 DEBUG WebSocket ['10.38.231.42', 12792] accepted by application then it tries to connect to the redis db 2020-11-21T11:45:14.494880+00:00 app[web.1]: 2020-11-21 11:45:14,494 DEBUG Parsed Redis URI ('redis-10596.c8.us-east-1-2.ec2.cloud.redislabs.com', 10596) 2020-11-21T11:45:14.495020+00:00 app[web.1]: 2020-11-21 11:45:14,494 DEBUG Creating tcp connection to ('redis-10596.c8.us-east-1-2.ec2.cloud.redislabs.com', 10596) but right after that the socket closes 2020-11-21T11:45:17.133433+00:00 heroku[router]: at=info method=GET path="/ws/chat/" host=tolk-project.herokuapp.com request_id=41ed7690-5f91-4238-9792-01f52c5f65a1 fwd="102.143.218.204" dyno=web.1 connect=0ms service=2654ms status=101 bytes=145 protocol=http 2020-11-21T11:45:17.134597+00:00 app[web.1]: 2020-11-21 11:45:17,134 DEBUG WebSocket closed for ['10.38.231.42', 12792] 2020-11-21T11:45:17.135119+00:00 app[web.1]: 10.38.231.42:12792 - - [21/Nov/2020:11:45:17] "WSDISCONNECT /ws/chat/" - - 2020-11-21T11:45:17.419219+00:00 app[web.1]: 2020-11-21 11:45:17,419 DEBUG Cancelling … -
realtime video feed processing using server client architecture for multi-user setup
I created a flutter app that sends frames to Django server where it gets processed and sent back. How do i make this work for multiple users? The computation is done on GPU so it's heavy image processing on server but its real time. what do i need to do in order to achieve a. multiple users use the app and send realtime video to server b. make sure processed video feed isn't sent to wrong user c. balance the load when multiple people stream at once, i only have 16 gigs of VRAM on server. what technology should i use? i came across kafka. would that solve the problem? Please help! i have a critical deadline :'( -
TypeError: update() takes 2 positional arguments but 3 were given : Python
I'm getting TypeError: update() takes 2 positional arguments but 3 were given. I have no idea about why this error occurs. if anybody could figure out where i'm doing thing wrong then would be much appreciated. thank you so much in advance. serializers.py : class ShopOwnerOrderManageSerializer(Serializer): invoice_no = CharField(read_only=True) shopowner_expected_date = CharField(allow_blank=True) shopowner_estimated_time = CharField(allow_blank=True) status = CharField(allow_blank=True) class Meta: model = CarOwnerShopConfirm fields= ['shopowner_expected_date','shopowner_estimated_time','status'] def update(self,validated_data): shopowner_expected_date = validated_data['shopowner_expected_date'] shopowner_estimated_time = validated_data['shopowner_estimated_time'] status = validated_data['status'] shopconfirm_obj = CarOwnerShopConfirm.objects.update( shopowner_expected_date = shopowner_expected_date, shopowner_estimated_time = shopowner_estimated_time, status = status ) shopconfirm_obj.save() return validated_data -
Securely post data with Python Requests to a Django Website
I am wanting to post data from another computer (a Raspberry Pi) to my Django website so that I can use that data to create an entry in the website's database. The following code signs me in to the website and sends the POST data successfully, so that I am able to create a database entry with the POST data, although I am concerned about security. # Imports import requests # Constants LOGIN_URL = "http://127.0.0.1:8000/login/" SAVE_DATA_URL = "http://127.0.0.1:8000/save_data/" login_data = { "username": "Test", "password": "test_password123", "next": "/" } data_package = { "title": "Testing POST", "contents": "Lorem ipsum dolor sit." } with requests.Session() as s: # --- Start Login --- # # Get login page CSRF Token and add it to the login data r = s.get(LOGIN_URL) csrf_token = r.cookies["csrftoken"] login_data["csrfmiddlewaretoken"] = csrf_token # Post login data to login to the website r = s.post(LOGIN_URL, data=login_data, headers=dict(Referer=LOGIN_URL)) # --- End Login --- # # --- Start POST Data --- # # Get save data page CSRF Token and add it to the data package r = s.get(SAVE_DATA_URL) csrf_token = r.cookies["csrftoken"] data_package["csrfmiddlewaretoken"] = csrf_token # Post error data to the website r = s.post(SAVE_DATA_URL, data=data_package) # --- End POST Data --- # … -
I want to generate bill of restaurant by multiplying quantity and price how to do this
In my code of invoice food name and food price both are showing food name on localhost portal so look into my foreign keys And also guide how to multiply product price and quantity. I am showing you both add product table and invoice table and their forms also look out and guide me for this models.py class AddFood(models.Model): food_name = models.CharField(max_length=20) food_price = models.PositiveIntegerField() company = models.ForeignKey(CompRegister, on_delete=models.CASCADE) res = models.ForeignKey(ResRegister, on_delete=models.CASCADE) def __str__(self): return self.food_name class GenerateInvoice(models.Model): foods_name = models.ForeignKey(AddFood, null=True, on_delete=models.CASCADE, related_name='food_n') foods_price = models.ForeignKey(AddFood, null=True, on_delete=models.CASCADE, related_name='food_p') quantity = models.PositiveIntegerField() company = models.ForeignKey(CompRegister, on_delete=models.CASCADE) res = models.ForeignKey(ResRegister, null=True, on_delete=models.CASCADE) start_date = models.DateTimeField(auto_now_add=True) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def __str__(self): return self.res, self.foods_name def total_price(self): return AddFood.food_price * self.quantity forms.py class FoodForm(forms.ModelForm): def __init__(self, user, *args, **kwargs): super(FoodForm, self).__init__(*args, **kwargs) self.fields['res'].queryset = ResRegister.objects.filter(res=True, company__user_id=user) class Meta: model = AddFood exclude = ['company','price','food'] fields = '__all__' class InvoiceForm(forms.ModelForm): def __init__(self, user, *args, **kwargs): super(InvoiceForm, self).__init__(*args, **kwargs) self.fields['foods_name'].queryset = AddFood.objects.filter(company__user_id=user) self.fields['foods_price'].queryset = AddFood.objects.filter(company__user_id=user) class Meta: model = GenerateInvoice exclude = ['company','res','start_date',] fields = '__all__' views.py def generate_invoice(request): u = CompRegister.objects.get(user_id=request.user) if request.method == 'POST': form = InvoiceForm(request.user, request.POST) if form.is_valid(): form_r = form.save(commit=False) form_r.company = u form_r.save() return … -
Error "write EPIPE" while pushing Heroku PostgreSQL database
An error "write EPIPE" occurred while loading Heroku PostgreSQL database from the local database. heroku addons:create heroku-postgresql:hobby-dev heroku pg:push postgres://localhost:5432/design-sa-1 DATABASE_URL --app design-sa screenshot Appeared only recently, before this was not. My system Windows 10, local databases v.11 or v.12 - the result is one - this error. I have already tried it on two old applications - the result is one – this error. The applications themselves (Django 3.0/ Python 3.7) are deployed on Heroku without errors. Local python manage.py dumpdata > db.json works perfect. -
Store a tree with labelled edges and labelled nodes in Django
So I need to store a questionnaire, which has a lot of branches based on the options. This diagram will give you an idea: I have already gone through these: Making a tree structure in django models? https://github.com/django-mptt/django-mptt/ These do not fit my use case, because my structure somewhere violates the idea of a tree (single parent property). Also, djang-mptt doesn't support labelled edges. I will have to create a Node class, and tell it if it is going to act like a Question or an Option. I tried to create the structure myself using Question and Option model class, having Foreign key in appropriate places (so that the structure below an option or question is deleted (models.CASCADE). But the problem there was to present it in such a way in the admin site, so that modification of the tree was a bit easier than treating the Questions and Options as yet another ordinary classes with foreign key references in them. Finally, I had the idea of moving to PostgreSQL as it supports storage of JSON data, hence representing everything in a single Python dictionary. I want some suggestions on how to go around modelling this. -
Add multisple select dropdown in django using javascript / bootstrap
Can anyone please tell me how to make a multiple select dropdown using javascript or bootstrap in django ? I've seen many posts for adding this feature on here as well as many other site but none worked... can you please send me a full working code ? This is the link I used -
How to add a value to the serializer that is not in the Model?
t when requesting films, it would return in the form movie id and number of comments, my model: class Movie(models.Model): Title = models.CharField(max_length=200) Year = models.CharField(max_length=25, blank=True) Rated = models.CharField(max_length=10, blank=True) class Comment(models.Model): comment_text = models.CharField(max_length=200) movie_id = models.ForeignKey( Movie, on_delete=models.CASCADE, related_name='Comments') how to add number of comments to output like { "movie_id": 2 "comment_count":3 }, { "movie_id": 1 "comment_count":2 } ] my View: class MoviesTop(APIView): def get(self, request): topMovie = Movie.objects.annotate( num_comments=Count('Comments')).order_by('-num_comments') serializer = MoviesTopSerializator(topMovie,many=True) return Response(serializer.data) -
How to send data to perticular user using server sent events on django?
I am new to server sent event please guide me. How can i send data from server to perticular client/user when change happen in database without reloading page. Also guid me if it is good to use server sent event or i should use websocket for this. -
django-modeltranslation: Why to I have 3 columns for two translations in database
Here is the relevant section of my settings.py LANGUAGE_CODE = "de" gettext = lambda s: s LANGUAGES = [ ("de", gettext("German")), ("en", gettext("English")), ] TIME_ZONE = "UTC" USE_I18N = True USE_L10N = True USE_TZ = True And I have this translation.py file in my awards app: from modeltranslation.translator import TranslationOptions, translator from .models import Award class AwardTranslationOptions(TranslationOptions): fields = ("title", "text") But in the database I get 3 columns for title: title title_en title_de And when I assign 1,2,3 to these three fields in the same order and save in admin I get the values: title: 2 title_en: 2 title_de: 3 It seems like title is always equal to title_en. Also, in the admin, the title field is required and the title_en and title_de are not required. What I had expected was to get only two fields, title_en and title_de of which title_de should be required since it is the default language. Can someone explain to me what is going on here? -
How to store selected values of the template in Django
I have searched a lot about how to store choices and dropdown list, but I could not find a solution for my situation. Here I have three classes with rating choices. models.py RATING_CHOICES = ((1, "Weak"), (2, "Average"), (3, "Good"), (4, "Excellent")) class Question(models.Model): text = models.CharField(max_length=100) def __str__(self): return self.text class Teacher(models.Model): name = models.CharField(max_length=50) def __str__(self): return self.name class Answer(models.Model): teacher = models.ForeignKey(Teacher, on_delete=models.CASCADE) question = models.ForeignKey(Question, on_delete=models.CASCADE) answer = models.IntegerField(choices=RATING_CHOICES, default=1) views.py Here I want to know how to write my function to store data. from django.shortcuts import render from .models import Question, RATING_CHOICES, Teacher def index(request): context = {'questions': Question.objects.all(), 'rating_choices': RATING_CHOICES, 'teacher': Teacher.objects.all()} return render(request, 'index.html', context) index.html <form action=""> <select name="teacher" id=""> {% for teacher in teacher %} <option value="{{teacher}}">{{teacher}}</option> {% endfor %} </select> {% for question in questions %} <ol>{{ question.text }}</ol> {% for choice in rating_choices %} <input type="radio" name="question_{{question.id}}" value="{{choice.0}}">{{choice.1}} {% endfor %} {% endfor %} <br> <input type="submit" value="Vote"> </form> I want to store selected values similar to the admin when you simply select your options and save the results. -
Updating a Boolean field with detail View
I want to believe you all are doing fine. i've a little issue I've been thinking my head out about. I've a class detail view that displays my model class object, which works perfectly fine. i want to create a functionality for one of the objects in my models paper = models.BooleanField(default=True, blank=True). in my template, i created a link so were a user clicks on the link, the link will update the Boolean field to be true. now my question is, in my def paper_frame(request,pk) (the code is below) how can i add it to the class BusinessDetailView(DetailView), so it stands as just one functionality. class BusinessDetailView(DetailView): model = Item template_name = 'business/detail_view.html' context_object_name='items' def paper_frame(request,pk): paper = Item.objects.get(pk=pk) paper.paper = True paper.save() return redirect("???")``` -
I cannot have “skip to” functionality inspite of adding controls to my django .html file video tag. How do I resolve that?
<video class="video" controls src="{{post.clip.url}}" type="video/mp4"></video> To get "skip to particular time", what do I need to do?