Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Collecting data from a json array using jquery or javscript
I would love to be able to collect the json array data , passed from my Django channels to my templates. What is the best way to go about it using jquery or javascript. async def websocket_connect(self,event): print("connected",event) #await execut the code and waits for it to finis data=self.get_obj() await self.send({ "type":"websocket.accept" "text":json.dumps(content) }) ) def get_obj(self): objects = modelname.objects.all() content={ 'objs':self.objs_to_json(objects) } return content def objs_to_json(objects): result=[] for objs in objects: result.append(self.objects_to_json(objs)) def objects_to_json(objs): return { 'name':objs.name, 'date':objs.str(objs.date), } var data =JSON.parse(e.data); /* how to use for loop to access the jason data and append it todisplay_objects */ -
Uploading large files to Server with resumable option and then server move file to S3
I need to design an architecture in which user can upload a large file e.g 1GB to server using REST API and then a stream open from server that connect with bucket and there should be resume option if in case connection lost. I have used a package name "Django-chunk-upload" but this not satisfy may requirements. -
Integrity error: null value in column violates constraint
I have a ;django view set. I added the create method to my viewset to create new instances and objects to store them. I have 6 fields in the model that include version, path, namespace, value, user_id, and person(ForeignKey) When i open the django rest framework backend page and attempt to create preference, it throws the following error: DETAIL: Failing row contains (20, 1, , , , 1, null). and when i create the object I am adding all of the correct fields so i am not sure why it is throwing null at then end. @permission_classes((IsAuthenticated)) def create(self, request, *args, **kwargs): # switch user_id value with logged in users id queryset = Preference.objects.create() serializer = PreferenceSerializer(queryset, many=True) return Response(serializer.data) I want to be able to create a new preference without an error. -
Exporting data to a tab delimited file from Django
I have exported a .csv file using the csv library of Python and it has a huge amount of columns and data that I want to be able to tab so its more easy to read. Is there some kind of way to deal with this? I'm guessing something like writerow() but for tabs? For example: Tab One: Name and Emails for people with more than 20 years Tab Two: Name and Emails for people with more than 30 years Tab Three: Name and Emails for people with more than 40 years -
AJAX GET Request Being Ignored
I am brand new to AJAX requests and I am still learning Django, but I have a project where the user enters an Elasticsearch query and then we generate a downloadable document (report) for the user. I have an AJAX request to continuously check on the existence of a file in my form.html file and it doesn't seem to be getting picked up at all. I can tell this because it isn't giving me any alerts and it's just automatically timing out on big requests after ~30 seconds. I tried to write a temporary fix in my views.py that is basically attempting to do what the javascript in form.html is doing, but A) I feel like this isn't the best method to use in production, B) it doesn't feel like a good use of time to essentially re-invent the wheel, and C) I want the user to get some sort of alert or indication on their end that the report is in progress, and then when it's ready to download. How can I modify my code to actually perform the AJAX request? Or why does it appear that the AJAX request isn't working? urls.py urlpatterns = [ path('admin/', admin.site.urls), path('accounts/', … -
Fetch request on React with redirect in Django is blocked due to CORS
I am trying to use Spotify authentication in my app. The backend works without any problems on its own, but with React I get an error. In React frontend app, there is a button which makes a successful request to my Django app. For Spotify authentication, I have to create a URL and redirect the request to Spotify API. Spotify has a redirect URI which they use to pass authentication code to the user. I have another endpoint in my Django app to process the authentication code. The first endpoint is /api/v1/login and the redirect endpoint is /api/v1/login_complete on my app. The first endpoint redirects the request to https://accounts.spotify.com/authorize?client_id=*** and Spotify redirects it back to the Login Complete endpoint. The process works without any problems when I try it by directly going to /api/v1/login on my browser. On React, however, I get blocked by the following error: Access to fetch at 'https://accounts.spotify.com/authorize?client_id=CLIENT_ID&response_type=code&redirect_uri=http://127.0.0.1:8000/api/v1/login_complete&state=STATE&scope=user-top-read' (redirected from 'http://127.0.0.1:8000/api/v1/login') from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. Firstly, I am using django-cors-headers. I added … -
How to use "LIKE" on "FROM" clause in sql
I am trying to query a specific table based on a user input, and want to query the table that contains that user input as the search_id in the name. For example, the table names are structured as run_000000_search_000000_lda_000000 and I want to get the table that has the same search_id as the on they put in. I know when "LIKE" is used on the Where clause you can get a column with a specific string or int in the name. However, I have found nothing on using it with the "FROM" clause. Specific hardcoded query for search_id 50 SELECT * FROM `run_000044_search_000050_lda_000366`; In summary, how can I get the table that has the same search_id as the one the user put in. Also trying to use the run and lda to form a full table name does not work because there is no noticeable pattern in between the 3 names. -
How to properly use Nested relationships for serializers?
I am trying to display whatever data I have in my CatPerm inside my Category API endpoint. My CatPerm data consists of 'cat', 'permission', and 'description' whereby they are category name, permission and description respectively Current 'Category' API endpoint look: { "name": "Travel", "permission": [ { "description": "Camera is used to take photos" } ] }, This is my desired 'Category' API endpoint look: { "name": "Travel", "permission": [ { "cat": "Travel", "permission": "Internet", "description": "This is a description inside CatPerm" } ] }, models.py class CatPerm(models.Model): cat = models.ForeignKey(Category, on_delete=models.CASCADE, related_name='permissions') permission = models.ForeignKey(Permission, on_delete=models.CASCADE) description = models.TextField() class Category(models.Model): name = models.CharField(max_length=50) permission = models.ManyToManyField(Permission, related_name='category_permissions', through='CatPerm' ) class Permission(models.Model): name = models.CharField(max_length=100) description = models.TextField() platform = models.CharField( max_length=10, choices=PLATFORM_CHOICES, default=BOTH, ) classification = models.CharField( max_length=10, choices=CLASSIFICATION_CHOICES, default=LOW, ) serializer.py class CatPermSerializer(serializers.ModelSerializer): cat = serializers.SlugRelatedField(slug_field='name', read_only=True) permission = serializers.SlugRelatedField(slug_field='name', read_only=True) class Meta: model = CatPerm fields = ("cat", "permission", "description") class CategorySerializer(serializers.ModelSerializer): permission = CatPermSerializer(many=True, read_only=True) class Meta: model = Category fields = ("name", "permission") -
How to Save User Input (Django)
I have a dropdown menu which is populated through the combination of two different object values contact.firstName and contact.lastName. How can I submit these two values separately on POST so I can query them at a later time? This issue arose because I need to handle when a first name or last name is more than one word. views.py if form.is_valid(): obj.contact = request.POST.get('select_contacts') template.html <div class="select"> <select name="select_contacts" id="select_contacts" required> <option value="">Contact</option> % for contact in contacts %} <option value="{{ contact.firstName }} {{ contact.lastName }}" name="selected_contact" id="selected_contact">{{ contact.firstName }} {{ contact.lastName }}</option> {% endfor %} </select> </div> -
Redirect does not redirect in Django
I'm doing a registration for a user using jquery for the event of the register button, although my createUser method correctly registers a user does, not redirect to the indicated page, but paints it by console views.py @csrf_exempt def createUser(request): #if request.method == 'POST': ''' nombres = request.POST.get('nombres') apellidos = request.POST.get('apellidos') email = request.POST.get('email') password = request.POST.get('password') direccion = request.POST.get('direccion') hour = timezone.now() day = timezone.now() myuser=User(password,day,hour,email,nombres,apellidos,direccion) myuser.save() ''' return redirect('http://127.0.0.1:8000/platos/') def platos(request): platos=Plato.objects.all() return render(request,"core/platos.html",{'platos':platos}) urls.py path('register/',views.createUser,name="register"), path('platos/',views.platos,name="platos"), jquery $('#registro').click(function(){ var nombres = $("#exampleInputNombresRegistrarse").val(); var apellidos = $("#exampleInputApellidosRegistrarse").val(); var email = $("#exampleInputEmailRegistrarse").val(); var password = $("#exampleInputPasswordRegistrarse").val(); var direccion=$("#exampleInputDireccionRegistrarse").val(); if (nombres == '' || email == '' || password == '' || apellidos == '' || direccion == '') { alert("Por favor completa todos los campos...!!!!!!"); } else if(email.indexOf('@', 0) == -1 || email.indexOf('.', 0) == -1){ alert("Por favor ingrese un correo válido...!!!!!!"); } else{ alert("Bien hecho "+nombres); $.ajax({ url: "http://127.0.0.1:8000/register/", method: 'POST', // or another (GET), whatever you need data: {'nombres': nombres,'apellidos':apellidos,'email':email, 'password':password,'direccion':direccion }, success: function (data) { // success callback // you can process data returned by function from views.py console.log(data); } }); } }); -
Login required for Django UpdateView
Why am I always able to access the view even if I am not authenticated: from django.contrib.auth.mixins import LoginRequiredMixin class MyClass(LoginRequiredMixin, UpdateView): model = MyModel fields = ['my_field'] template_name = 'my_template.html' def get_success_url(self): messages.success(self.request, 'Update: success') return reverse('my_ns:my_view') def form_valid(self, form): form.instance.created_by = self.request.user return super().form_valid(form) Is there something I should add? -
IntegrityError at /cart/update-transaction/0cqydz1f/
Hello am trying to make a transaction pressing submit this is the error am getting IntegrityError at /cart/update-transaction/0cqydz1f/ NOT NULL constraint failed: shopping_cart_transaction.product_id Request Method: GET Request URL: http://localhost:8000/cart/update-transaction/0cqydz1f/ Django Version: 2.2 Exception Type: IntegrityError Exception Value: NOT NULL constraint failed: shopping_cart_transaction.product_id models.py class Transaction(models.Model): profile = models.ForeignKey(Profile, on_delete=models.CASCADE) product = models.ForeignKey(Product,on_delete=models.CASCADE) token = models.CharField(max_length=120) order_id = models.CharField(max_length=120) amount = models.DecimalField(max_digits=100, decimal_places=2) success = models.BooleanField(default=True) timestamp = models.DateTimeField(auto_now_add=True, auto_now=False) def __str__(self): return self.order_id class Meta: ordering = ['-timestamp'] views.py @login_required() def update_transaction_records(request, token): # get the order being processed order_to_purchase = get_user_pending_order(request) # update the placed order order_to_purchase.is_ordered=True order_to_purchase.date_ordered=datetime.datetime.now() order_to_purchase.save() # get all items in the order - generates a queryset order_items = order_to_purchase.items.all() # update order items order_items.update(is_ordered=True, date_ordered=datetime.datetime.now()) # Add products to user profile user_profile = get_object_or_404(Profile, user=request.user) # get the products from the items order_products = [item.product for item in order_items] user_profile.ebooks.add(*order_products) user_profile.save() # create a transaction transaction = Transaction(profile=request.user.profile, token=token, order_id=order_to_purchase.id, amount=order_to_purchase.get_cart_total(), success=True) # save the transcation (otherwise doesn't exist) transaction.save() messages.info(request, "Thank you! Your purchase was successful!") return redirect(reverse('accounts:my_profile')) Please help out am stuck here -
Trying to do a RadioSelect or Select with Imagen
I am trying to do a Radio Select or a simple Select with Django but I don't know how to do. I have tryed something but when I try to print in html with a for to put a img tag near the radio select it doesn't work. However with {{profile_form.choice_picture|as_crispy_field}} works fine: Why my "for" in html doesn't work? Is there any better way to do this? html: <form action="{% url 'edit_profile' %}" method="post"> {% csrf_token %} {% for radio in profile_form.picture_choice %} {{ radio.choice_label }} <span class="radio">{{ radio.tag }}</span> {% endfor %} {{profile_form.choice_picture|as_crispy_field }} {{ user_form|crispy }} {{ profile_form.description|as_crispy_field }} <input class="btn btn-outline-info my-2 my-sm-0" type="submit" value="Guardar"> <a href="{% url 'profile' %}" class="btn btn-primary">Cancelar</a> </form> model: class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) picture = models.CharField(default='users/img/default.png', blank=False, null=False, max_length=200) description = models.TextField(max_length=250, blank=True) played_tournaments = models.PositiveIntegerField(default=0) won_tournaments = models.PositiveIntegerField(default=0) def __str__(self): return f'{self.user.username} Profile' class Picture(models.Model): name = models.CharField(max_length=200, blank=False, null=False, unique=True) image = models.ImageField(upload_to='users/static/users/img', null=False, unique=True) def __str__(self): return str(self.name) forms: class EditProfileForm(forms.ModelForm): images = Picture.objects.all() CHOICES = [(i.image.url, i.name) for i in images] choice_picture = forms.ChoiceField(widget=forms.RadioSelect, choices=CHOICES) class Meta: model = Profile fields = ['description', ] labels = { 'description': 'Descripción' } views: @login_required() def edit_profile(request): if … -
Multi tables filter calculation
I have two tables: 1 - dates with user id: dateStart, dateEnd,userId 2 - users with allowedAmount: userid,allowedAmount I am trying to perform filter as following - return only the: (dateEnd-dateStart)/allowedAmount I know how i can filter as following qs = qs.filter(dateStart__range=[dateStart, dateEnd]) qs = qs.filter(dateEnd__range=[dateStart, dateEnd]) but i am struggling on filtering by the result of the above requirement using DJANGO's queryset filter any suggestions? -
Is it possible to capture a cache timeout in Django?
I would like to adopt the Django cache system to put an object in cache with let's say a 60 seconds timeout. Every time a cache hit happens such timeout is reset back to 60 seconds. This should work fine but the problem is that I would also like to do something when the timeout occurs. Is that even possibile with cache? -
How can i add upload size limit when upload image in django
i want to change user profile photo; However i don't know how can i add upload size limit views.py def profile_photo_upload(request): if request.method=="POST": form=UploadForm(request.POST, files=request.FILES,instance=request.user.profile) if form.is_valid(): userprofile=form.save(commit=False) userprofile.user=request.user userprofile.save() messages.success(request,"Success") else: form=UploadForm() return render(request,'imageupdate.html',{'form':form}) Also, is my code properly? for safety -
How should a view function to have a get that post data ? How to process user input and save it ? with view to each input processed/preprocessed?
So I'm working on an app where users can upload images and I can process the images using some libraries combined in a function.The basic outline is a view to show the uploaded images and a view for the processed images when the user enter the url/view of the processed image it should show the processed images of a single image. how can i make that possible ? should i make 2 data models one for the uploaded and the other for the processed ? i made a function for defining a user path for the image so as the user can process the image multiple times how can i make a function to define a new name/path to the processed image ? I saw basic code on gearheart where it looks something like this: #forms.py class UploadFileForm(forms.Form): title = forms.CharField(max_length=50) file = forms.FileField() #views.py def handle_uploaded_file(f): with open('some/file/name.txt', 'wb+') as destination: for chunk in f.chunks(): destination.write(chunk) def upload_file(request): if request.method == 'POST': form = UploadFileForm(request.POST, request.FILES) if form.is_valid(): handle_uploaded_file(request.FILES['file']) return HttpResponseRedirect('/success/url/') else: form = UploadFileForm() return render(request, 'upload.html', {'form': form}) so it should look like this but how to save the processed data in a different field/model to be … -
AuthenticationError at /admin/auth/user/add/
Hello am trying to add another user through the django admin and am getting this error You did not provide an API key, though you did set your Authorization header to "Bearer". Using Bearer auth, your Authorization header should look something like 'Authorization: Bearer YOUR_SECRET_KEY'. See https://stripe.com/docs/api#authentication for details, or we can help at https://support.stripe.com/ I cant figure a way to solve this please help out -
Promotheus - Django : connection refused
(This is my first time using Prometheus and I'm not very good with Docker/Django yet) I'm running a Django project in a docker container, and Prometheus with docker run -p 9090:9090 -v /tmp/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus In my docker-compose.yml I have: ... nginx-proxy: build: context: ./dockerfiles/nginx-proxy/ args: - DOMAIN_NAME=local.my.url ports: - "80:80" depends_on: - api - ... volumes: - ./volumes/nginx-front/log/:/var/log/nginx api: build: context: ./dockerfiles/api/ args: - GUNICORN_WORKERS=20 restart: always volumes: - ./volumes/api/src/:/usr/src/app ... In /tmp/prometheus.yml I have: global: scrape_interval: 15s evaluation_interval: 15s external_labels: monitor: 'iot-rocket-monitor' rule_files: scrape_configs: - job_name: 'prometheus' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ['localhost:9090'] - job_name: 'api' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ['api.local.my.url'] The prometheus job seems to work ok (but those aren't the metrics I'm interested in), the api gives the following error from the Promotheus UI: Get http://api.local.my.url:80/metrics: dial tcp 127.0.0.1:80: connect: connection refused However, when I type in http://api.local.my.url:80/metrics in my browser I can see the information correctly. I've tried replacing the URL with my IP address 10.25.2.192 but that doesn't change the result. I don't understand why it can't connect. -
Improve Django database performance by oriding or index?
I'm working on a project in which around 3 million records are saved in a MySQL database. The model is like: class Record(models.Model): rec_type = models.CharField(...) rec_value = models.FloatField(...) rec_prop1 = models.CharField(...) ...other fields... class Meta: ordering = ['rec_value'] A typical query contains a range of target rec_value, a specific rec_type, and sometimes, a specific rec_prop1. The query action is much more frequently used than the adding record action. My query function is written like this: def find_target(value_from,value_to,type=None,prop1=None): search_set = Record.objects.all() if type: #not None search_set = search_set.filter(rec_type=type) if search_set.count == 0: return [] if prop1: #not None search_set = search_set.filter(rec_prop1=type) if search_set.count == 0: return [] search_list = search_list.filter(rec_value__gte=value_from,rec_value__lte=value_to) result_list = [] for rec in search_list.values(...): #only get useful fields result_list.append(some_runtime_calculation_about_rec) return result_list The code works fine but takes around 7s for each query. No indexing is used currently. I want to improve query performance. I have searched the Internet for solutions and learned to use QuerySet.values() and database indexing. The problem is that rec_type field only has 3 possible values(eg. A, B, C), and the most of the records (around 70%) belong to one of them(eg. A). The rec_value field is filtered in every query so I made … -
Connectionerror - Elasticsearch
I am using Amazon elasticsearch service along with postgress. Elasticsearch works well with every Create, Update operations through django admin. But when I tries to delete from django admin I am getting, ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f9371e200f0>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f9371e200f0>: Failed to establish a new connection: [Errno 111] Connection refused) I have checked many site but all i got is the syncying command, ./manage.py search_index --populate -f But this is not working. Is there any way which allows me to perform delete through django admin without disabling elasticseach service -
django.db.utils.OperationalError: FATAL: the database system is in recovery mode
I'm trying to spin up a database with the follwing commands on a mac: init_db: docker-compose run web python manage.py migrate docker-compose run web python manage.py creatersakey I'm getting an error: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/django/db/backends/base/base.py", line 217, in ensure_connection self.connect() File "/usr/local/lib/python3.6/dist-packages/django/db/backends/base/base.py", line 195, in connect self.connection = self.get_new_connection(conn_params) File "/usr/local/lib/python3.6/dist-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection connection = Database.connect(**conn_params) File "/usr/local/lib/python3.6/dist-packages/psycopg2/__init__.py", line 126, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) psycopg2.OperationalError: FATAL: the database system is in recovery mode The above exception was the direct cause of the following exception: Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.6/dist-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python3.6/dist-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/usr/local/lib/python3.6/dist-packages/django/core/management/base.py", line 83, in wrapped res = handle_func(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/django/core/management/commands/migrate.py", line 87, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "/usr/local/lib/python3.6/dist-packages/django/db/migrations/executor.py", line 18, in __init__ self.loader = MigrationLoader(self.connection) File "/usr/local/lib/python3.6/dist-packages/django/db/migrations/loader.py", line 49, in __init__ self.build_graph() File "/usr/local/lib/python3.6/dist-packages/django/db/migrations/loader.py", line 212, in build_graph self.applied_migrations = recorder.applied_migrations() File "/usr/local/lib/python3.6/dist-packages/django/db/migrations/recorder.py", line 73, in applied_migrations if self.has_table(): File "/usr/local/lib/python3.6/dist-packages/django/db/migrations/recorder.py", line 56, in has_table return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()) File … -
Testing if logged-in users see unpublished questions
I am writing tests for the django polls app tutorial. I want to write a test which which logs in a user, creates an instance of the question model with a publish date in the future, and ensures that this logged in user can see this question. I've tried using self.assertContains('Please review these unpublished questions: ') in the test method because my template looks like this: {% if user.is_authenticated %} <p>Hello, {{ user.username }}. Please review these unpublished questions: </p> {% if unpublished_question_list %} etc but even though self.assertEqual(response.context["user"], user) passes testing after self.client.login(username=my_admin.username, password=password) my template doesn't seem to be rendering properly to the test client. Some help would be much appreciated! AssertionError: False is not true : Couldn't find 'Please review these unpublished questions: ' in response -
HTMLCalendar in Django app: missing arguments
I am trying to replicate this Link in my Django app Views.py from calendar import HTMLCalendar from datetime import date from itertools import groupby from django.utils.html import conditional_escape as esc from django.shortcuts import render_to_response from django.utils.safestring import mark_safe class WorkoutCalendar(HTMLCalendar): def __init__(self, workouts): super(WorkoutCalendar, self).__init__() self.workouts = self.group_by_day(workouts) def formatday(self, day, weekday): if day != 0: cssclass = self.cssclasses[weekday] if date.today() == date(self.year, self.month, day): cssclass += ' today' if day in self.workouts: cssclass += ' filled' body = ['<ul>'] for workout in self.workouts[day]: body.append('<li>') body.append('<a href="%s">' % workout.get_absolute_url()) body.append(esc(workout.title)) body.append('</a></li>') body.append('</ul>') return self.day_cell(cssclass, '%d %s' % (day, ''.join(body))) return self.day_cell(cssclass, day) return self.day_cell('noday', '&nbsp;') def formatmonth(self, year, month): self.year, self.month = year, month return super(WorkoutCalendar, self).formatmonth(year, month) def group_by_day(self, workouts): field = lambda workout: workout.performed_at.day return dict( [(day, list(items)) for day, items in groupby(workouts, field)] ) def day_cell(self, cssclass, body): return '<td class="%s">%s</td>' % (cssclass, body) def calendar(request, year, month): my_workouts = Quiz.objects.orderby('scheduled_date').filter(owner_id=request.user.pk, my_date__year=year, my_date__month=month).annotate(c=Sum('weight')).values('c') print("my_workouts", my_workouts) cal = WorkoutCalendar(my_workouts).formatmonth(year, month) return render_to_response('classroom/teachers/graph_tot_trucks.html', {'calendar': mark_safe(cal),}) Urls.py path('abc/', teachers.calendar, name='cal'), foo.html <head> {{calendar}} </head> When I run this it results in calendar() missing 2 required positional arguments: 'year' and 'month' What is it that I am doing differently than the … -
How to use jinja tag inside jinja tag
this is my code {% if {{post.author.profile.image.url}} is None %}.When i run this code i get:Could not parse the remainder: '{{post.author.profile.image.url}}' from '{{post.author.profile.image.url}}' How to solve this?And how to use a jinja tag inside jinja tag