Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Is this Hack to work around PASSWORD_RESET_TIMEOUT_DAYS cannot be set to less than one day safe?
Django does not allow the variable PASSWORD_RESET_TIMEOUT_DAYS to be set to less than one day. As a workaround, I am thinking of sending the timestamp in the password reset activation URL, using this format: path('activate/<uidb64>/<timestamp>/<token>/', views.activate, name='activate') Using the timestamp, I could then manually check whether the timestamp is within a period of time that is less than one day. Was wondering if doing this is unsafe from a security point of view? -
Form not registering photo Django 3.0
I'm trying to get a photo to upload and the form is not seeing the file and in the form.errors, it says 'this field is required'. I've tried using picture = request.FILES['picture'] to no avail and have also tried picture = form.FILES['picture'] as well as picture = request.POST.FILES['picture'] and picture = form.cleaned_data.get('picture') What am I missing? Let me know if you need anymore information template {% block content %} <h1>Create {{post_type.title}} Post</h1> <form method="post" enctype="multipart/form-data"> {% csrf_token %} {{form.as_p}} <button type='submit'>Submit</button> </form> {% endblock %} forms.py class PicturePostForm(forms.ModelForm): class Meta: model = PicturePost fields = ('description', 'privacy', 'picture', 'categories') views.py @login_required() def picture_post(request): """ Creates new picture post """ if request.method == "POST": form = PicturePostForm(request.POST) print("is post") if form.is_valid(): print("is valid") # this never gets printed because of the 'this field is required' error author = request.user content = form.cleaned_data['description'] category = form.cleaned_data['categories'] picture = form.cleaned_data['picture'] privacy = form.cleaned_data['privacy'] p_post = PicturePost(author=author, description=content, categories=category, picture=picture,privacy=privacy ) p_post.save() #redirect to last page return redirect('home') else: l = [] for i in form.errors.keys(): l.append(form.errors[i]) return HttpResponse(l) else: post_type = 'picture' form = PicturePostForm() return render(request, 'create_post.html', {'form': form, 'post_type': post_type}) The corresponding model field picture = models.ImageField(upload_to=f'profiles/{User}_gallery', max_length=255) -
How can I add animations to my images in my Django app?
I´m trying to add a kind of animation to some images in my Django app, what I want to do is that when the user moves the mouse around the image it gets bigger. I tried adding some code in my CSS but the image won't change Thank you for your help. My index.html {%block contenido %} <div id="container" class="foto_pelicula"> {% for p in peliculas %} {% if p.genero.id == 1 %} <a href="{% url 'detallesPelicula' p.id %}"><img src={{p.urlPortada}} width="289" height="289"/></a></li> {% endif %} {% endfor %} </div> <div id="container" class="foto_pelicula"> {% for p in peliculas %} {% if p.genero.id == 2 %} <a href="{% url 'detallesPelicula' p.id %}"><img src={{p.urlPortada}} width="289" height="289"/></a></li> {% endif %} {% endfor %} </div> <div id="container" class="foto_pelicula"> {% for p in peliculas %} {% if p.genero.id == 3 %} <a href="{% url 'detallesPelicula' p.id %}"><img src={{p.urlPortada}} width="289" height="289"/></a></li> {% endif %} {% endfor %} </div> {% endblock %} The Images SRCs are urls that I take from the internet, I guess it does not really matter whether they are taken from the internet or stored in your proyect. my CSS #container{ width: 290px; overflow: hidden; margin: 5px 4px 0 auto; padding: 0; background: #222; /* … -
Django Category Service Catalog URL Slug
I am trying to create a home page where categories will be displayed and on choosing the category should redirect to another page and pass the variable of the category so I can create service catalogue from where the service is chosen based on what category was chosen. I was able to create the pattern for category but I am not able to do home>category>category sidebar with products>product view and I am currently at the moment able home>category> after that I am lost and also how to filter or pass variable to it category_list_sidebared.html to previously chosen category. from home.html Models: class Category(models.Model): CATEGORY_CHOICES = ( ("PT", "Painting"), ("Pb", "Plumbing"), ("HM", "One Hour Husband"), ("EL","Electronic Wiring") ) category = models.CharField(max_length=2,choices=CATEGORY_CHOICES) photo = models.FileField(upload_to='category',null=True) category_slug = models.SlugField(blank=True) def __str__(self): return self.category def save(self, *args, **kwargs): self.category_slug = slugify(self.category) super(Category, self).save(*args, **kwargs) def get_absolute_url(self): return reverse('category_list', args=[self.category_slug]) class Gig(models.Model): title = models.CharField(max_length=500) category = models.ForeignKey('Category',on_delete=models.PROTECT) description = models.CharField(max_length=1000) price = models.IntegerField(default=6) photo = models.FileField(upload_to='gigs') status = models.BooleanField(default=True) user = models.ForeignKey('User',on_delete=models.PROTECT) create_time = models.DateTimeField(default=timezone.now) product_slug = models.SlugField(blank=True) def __str__(self): return self.title def save(self, *args, **kwargs): self.product_slug = slugify(self.title) super(Gig, self).save(*args, **kwargs) def get_absolute_url(self): return reverse('gig_view', args=[self.product_slug]) Views: def home_authenticated(request,category_slug=None): categories = Category.objects.filter() return … -
Best way to create a SPA using Django
I'm trying to develop a SPA using Django, what is the best way to do that? -
Deploying Django Application to Elastic Beanstalk with Django Cities Light
I am deploying a django application to elastic beanstalk and it uses the django-cities-light package. Right now I have the following elasticbeanstalk config: container_commands: 01_add_cities_light: command: "source /opt/python/run/venv/bin/activate && python manage.py cities_light" leader_only: true But this causes every deployment to run the full cities light package, resulting in deployment times in excess of 10 minutes. When this line is removed, deployment takes less than half the same amount of time with far less RDS utilization. Is there a better way to implement this package to allow for more efficient deployments and scaling? -
create Separate row For every book volume in django
Hello friends in my django web app I have a model called book Contains volume_number field, As you know Some books have More than one volume now I want With any post request, create Separate row For every book volume in database, How can I do this? -
What is the optimal way to write function-based views in Django?
What is the recommended way to write views (as functions) in Django? I am asking in terms of readability, etc. For example: define the template first, then do the translations, then define models and lastly define context. Here is some example code: def index(request): # Landing page, translated to the browser's language (default is english) template = loader.get_template("koncerti/index.html") # Translators: This is the text on the homepage buttons concerts = gettext("Koncerti") band = gettext("Band") # Translators: This is the option in the language-switch box foreignLanguage = gettext("eng") koncertiUrl = '/koncerti/international' # The URL slug leading to 'koncerti' page bandUrl = '/band/international' # The URL slug leading to 'band' page translationMode = '' # The URL slug that is leading to slovenian translation mode context = { 'Concerts' : concerts, 'Band' : band, 'foreignLanguage' : foreignLanguage, 'koncertiUrl' : koncertiUrl, 'bandUrl' : bandUrl, 'translationMode' : translationMode } return HttpResponse(template.render(context, request)) -
Errors after running EB deploy - Your requirements.txt is invalid
The error message I get after running "EB deploy": 2019-12-14 15:37:55 ERROR Your requirements.txt is invalid. Snapshot your logs for details. 2019-12-14 15:37:57 ERROR [Instance: i-05ca9242185a849e6] Command failed on instance. Return code: 1 Output: (TRUNCATED)...) File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call raise CalledProcessError(retcode, cmd) CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI. 2019-12-14 15:37:58 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1]. 2019-12-14 15:37:58 ERROR Unsuccessful command execution on instance id(s) 'i-05ca9242185a849e6'. Aborting the operation. 2019-12-14 15:37:58 ERROR Failed to deploy application. ERROR: ServiceError - Failed to deploy application. Requirements.txt file awsebcli==3.16.0 botocore==1.13.39 cement==2.8.2 certifi==2019.6.16 chardet==3.0.4 colorama==0.3.9 Django==2.1.11 django-appconf==1.0.3 django-classy-tags==0.9.0 django-cms==3.6.0 django-crum==0.7.4 django-dajaxice==0.7 django-debug-toolbar==2.1 django-filer==1.5.0 django-formtools==2.1 django-js-asset==1.2.2 django-mptt==0.10.0 django-polymorphic==2.0.3 django-sekizai==1.0.0 django-treebeard==4.3 djangocms-admin-style==1.4.0 djangocms-attributes-field==1.1.0 djangocms-bootstrap4==1.5.0 djangocms-column==1.9.0 djangocms-file==2.3.0 djangocms-googlemap==1.3.0 djangocms-icon==1.4.1 djangocms-link==2.5.0 djangocms-listyle==0.1.7 djangocms-owl==0.1.11 djangocms-picture==2.3.0 djangocms-snippet==2.2.0 djangocms-style==2.2.0 djangocms-text-ckeditor==3.8.0 djangocms-video==2.1.1 docutils==0.15.2 easy-thumbnails==2.6 future==0.16.0 html5lib==1.0.1 idna==2.7 jmespath==0.9.4 jsonfield==2.0.2 mysqlclient==1.4.2 nano==0.9.4 pathspec==0.5.9 Pillow==6.1.0 psycopg2==2.8.4 pypiwin32==223 python-dateutil==2.8.0 pytz==2019.2 pywin32==227 PyYAML==3.13 requests==2.20.1 semantic-version==2.5.0 six==1.11.0 sqlparse==0.3.0 stripe==2.33.2 termcolor==1.1.0 Unidecode==1.0.23 urllib3==1.24.3 wcwidth==0.1.7 webencodings==0.5.1 There are a ton of log files to peruse through, and I haven't the slightest where to start looking, but I did find this - which makes … -
Python xmltodict with multiple OrderedDictkeys
Is there any way to create xml output that given a multiple OrderedDict like this data = OrderedDict([ ... ('addresses', OrderedDict([ ('address', OrderedDict([ ('city', 'Washington') ])), ('address', OrderedDict([ ('city', 'Boston') ])) ])) ]) When i try this xmltodict covers last address not both. -
404 On Using Azure Storage In Django Application
I am trying to deploy a Django application on Microsoft Azure. I am using nginx + gunicorn on a Azure Virtual Machine. For serving static and media files, I have decided to use Azure Blobs available in Azure Storage. I am using the following library to integrate a Markdown + MathJax editor in my application - django-mdeditor. Now, this library comes with its own JS and CSS files. I am having no problem on using this library in the following scenarios - Local Development. Deployment on Heroku (production). Deployment on Azure Virtual Machine using nginx + gunicorn (production). In this case, I am serving the static files using nginx as mentioned in various tutorials, such as this one. However, as soon as I shift to Azure Storage as my storage back-end. I am getting the following errors - Failed to load resource: the server responded with a status of 404 (The specified blob does not exist.) codemirror.min.js:1 Failed to load resource: the server responded with a status of 404 (The specified blob does not exist.) codemirror.min.css:1 Failed to load resource: the server responded with a status of 404 (The specified blob does not exist.) dialog.css:1 Failed to load resource: the … -
Seaching dishes from nearest restaurant and one dish from a chain
my django model relationship is like below. class Chain(DatesModel): name = models.CharField(max_length=300, db_index=True) class RestaurantModel(models.model): name = models.CharField(max_length=300, db_index=True) address = models.TextField(null=True, blank=True) latitude = models.DecimalField(max_digits=10, decimal_places=7, default=40.7128) longitude = models.DecimalField(max_digits=10, decimal_places=7, default=74.0060) location = GisModels.PointField(geography=True, srid=4326, default=Point(-73.935242, 40.7306)) chain = models.ForeignKey(Chain, related_name="restaurant_chain", on_delete=models.DO_NOTHING, null=True, blank=True) class DishModel(models.model): dish_name = models.CharField(max_length=100, help_text="Dish Name") restaurant = models.ManyToManyField(RestaurantModel, null=True, blank=True) chain = models.ForeignKey(Chain, related_name="restaurant_chain", on_delete=models.DO_NOTHING, null=True, blank=True) chain is like McDonald's, Burger King, KFC. Now problem is searching a nearest dish with restaurant and there will be on dish from a chain. how this relationship can be managed in Elasticsearch or alternate solution. -
Django project in docker container unable to run manage.py runserver
I'm new to docker, and struggle a bit to wrap my head around container/image/service concept. I am unable to start container with django image. Here is my Docker file: FROM python:3.6 ENV PYTHONUNBUFFERED 1 RUN mkdir /django-ex COPY /django-ex /django-ex WORKDIR /django-ex RUN pip install -r requirements.txt 'Build' works fine no errors. But 'up' fails with error: web_1 | python: can't open file '/django-ex/manage.py': [Errno 2] No such file or directory maria-ra-staff_web_1 exited with code 2 Here is my docker-compose.yml: version: '3.6' services: db: image: postgres web: build: . command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/django-ex ports: - "8000:8000" depends_on: - db I don't understand why 'up' doesn't have my project files. Did I miss something in the process? -
psycopg2.IntegrityError: duplicate key value violates unique constraint "engine_attackimage_pkey" DETAIL: Key (id)=(19) already exists
I am not manually setting the primary key. How could this be happening? I've been usign Django for 5 years and never encountered anything like this. Can someone help? -
Sending email via Django causes Server Error (500)
I'm trying to send email from admin to users who fill form and as result getting Server Error (500). How can I fix this error ? Here are my codes: (btw everything works very well when I'm running my application on my local server, but on IP it results with an error) views.py: from django.shortcuts import render from .models import Question, Message from django.core.mail import send_mail from django.conf import settings def index(request): context = { 'questions': Question.objects.all() } if request.method == "POST": if request.POST.get('message_text'): Message.objects.create( sender_name = request.POST.get('sender_name'), sender_email = request.POST.get('sender_email'), message_text = request.POST.get('message_text')) if request.method == 'POST': sender_email = request.POST.get('sender_email') sender_name = request.POST.get('sender_name') subject = 'Welcome !' message = 'Dear ' + str(sender_name) + '! \n We will back to you.' from_email = settings.EMAIL_HOST_USER recipient_list = [sender_email] send_mail(subject, message, from_email, recipient_list) return render(request, 'index.html', context) settings.py: EMAIL_HOST = 'smtp.gmail.com' EMAIL_USE_TLS = True EMAIL_PORT = 587 SERVER_EMAIL = 'hi@mail.com' EMAIL_HOST_USER = 'hi@mail.com' EMAIL_HOST_PASSWORD = '******' -
How to group result by query in orm
Can i group results on the basic of field in User model. models.py class User(AbstractUser): USERTYPE = (('1','type_1'),('2','type_2'),....) user_type = models.CharField(max_length=2,choices=USERTYPE) ..... views.py User.object.all().values('first_name','last_name') How can i get all users data with groupby there type in below format by using django ORM query only.. { "type_1":[ { "first_name":"abc", "last_name":"xzy" }, { "first_name":"abcd", "last_name":"wxzy" } ], "type_2":[ { "first_name":"abcdd", "last_name":"xzddy" }, { "first_name":"absdcd", "last_name":"wxsdzy" } ] } -
Kill a django process that was initiated using python
I had used python to initiate the django server. After it started, I worked upon my project and finally decided to stop the server. It could be done by using the the task manager. But it requires administrative privileges to stop it. I wish to use CLI to stop the server and that to without giving it special administrative privileges. (Favorably by changing the code of the python file below). #Python code below from subprocess import Popen Popen("workon Test & cd C:/Users/HP/Desktop/Keshav/PureTest/trial & python manage.py runserver", shell = True) Thanks in advance and sorry for my poor english. -
Error while deploying Django app on cpanel(shared hosting)
I m new to django. I created a web with dajngo,and successfully deployed it in the server The python app has been successfully setup and virtual environment has been setup. but while running the web it gives me "Server Error (500)" I don't know whats the problem. I think error is in "wsgi.py" file but i'm unable to idenify it. My wsgi file: import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'karan_web.settings') application = get_wsgi_application() can someone help me with it; -
Can't combine different query sets and render them in django
So i have to render a table on html template which combines columns from 2 different base models. But the table doent seem to render well. Entries from other table are shown in different rows. here is the screenshot of the table that has rendered -I used the chain method from ittertools for this purpose. Not sure where I messed up. Models.py: class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) image = models.ImageField(upload_to='profile_pics') dob = models.DateField() email = models.EmailField(max_length=50, unique=True) class Placement(models.Model): student = models.OneToOneField(User, on_delete=models.CASCADE) company = models.CharField(max_length=40) position = models.CharField(max_length=40) city = models.CharField( max_length=40) bond = models.CharField( max_length=40) ctc = models.CharField( max_length=40) my Views.py: def mentorintern(request): table = Placement.objects.all() name_student = Profile.objects.all() in_table = list(chain(table, name_student)) return render(request, 'mentorinternship.html', {'in_table': in_table }) HTML template used to render the table: <table class="table align-items-center table-flush table-hover" id="dataTableHover"> <thead class="thead-light"> <tr> <th>Name of Student</th> <th>Company</th> <th>Position</th> <th>City</th> <th>CTC</th> <th>Bond</th> </tr> </thead> <tbody> {% for std in in_table %} <tr> <td>{{std.first_name}}</td> <td>{{std.company}}</td> <td>{{std.position}}</td> <td>{{std.city}}</td> <td>{{std.ctc}}</td> <td>{{std.bond}}</td> </tr> {% endfor %} </tbody> </table> -
DB connection stopped working in docker-compose file
This docker-compose file was working fine six months ago. But recently I tried to use it to test my app and received this error: conn = _connect(dsn, connection_factory=connection_factory, **kwasync) django.db.utils.OperationalError: could not translate host name "db-test" to address: Name or service not known I read through some other stack overflow answers and tried adding 'restart: always' to the web service. I also tried adding a local network to the compose file, and nothing has worked. Any ideas what I am doing wrong? Here is my compose file: version: '3' services: # postgres database db-test: image: postgres:10.9 environment: - POSTGRES_PASSWORD=example volumes: - pg-test-data:/var/lib/postgresql/data # main redis instance, used to store available years for each organization redis-test: image: redis:5.0.4 volumes: - redis-test-data:/data # redis cache used for caching agency pages like /agencies/salaries/ redis_cache-test: image: redis:5.0.4 # search engine elasticsearch-test: image: elasticsearch:5.6.10 volumes: - elasticsearch-test-data:/usr/share/elasticsearch/data # web app web-test: build: . environment: - DATABASE_URL=postgresql://postgres:example@db-test/postgres - ENVIRONMENT=development - REDIS_URL=redis://redis-test:6379 - REDIS_CACHE_URL=redis://redis_cache-test:6379 - ELASTIC_ENDPOINT=elasticsearch-test:9200 env_file: docker.env depends_on: - db-test - redis-test - redis_cache-test - elasticsearch-test volumes: - .:/code # worker instance for processing large files in background worker-test: build: . command: python run-worker.py environment: - DATABASE_URL=postgresql://postgres:example@db-test/postgres - ENVIRONMENT=development - REDIS_URL=redis://redis-test:6379 - REDIS_CACHE_URL=redis://redis_cache-test:6379 - ELASTIC_ENDPOINT=elasticsearch-test:9200 env_file: … -
How do I change my CELERY_BROKER_URL in an already daemonized Celery process?
I'm daemonizing my Celery worker using Supervisord. The issue is I had a typo in my CELERY_BROKER_URL and the worker is not properly connecting to RabbitMQ. When I run celery -A mysite report it shows the old environment variable. My /etc/supervisor/conf.d/celery.conf file does not include the environment variables: [program:celery] command=/webapps/mysite/scripts/celery/celery_start autostart=true autorestart=true user=myuser stdout_logfile=/webapps/mysite/logs/celery.log redirect_stderr = true The environment variables are picked up via my virtual environment in the celery_start script: #!/bin/sh DJANGODIR=/webapps/mysite/mysite # Activate the virtual environment. cd $DJANGODIR . /webapps/mysite/bin/activate . /webapps/mysite/bin/postactivate # Programs meant to be run under supervisor should not daemonize themselves # (do not use --daemon). exec celery -A mysite worker -E -l info --concurrency=2 When I check the CELERY_BROKER_URL environment variable after activating the environment it is correct. I've tried supervisorctl restart celery which doesn't pick up the new environment variable (celery -A mysite report shows the old CELERY_BROKER_URL). I've tried supervisorctl shutdown and then supervisord which also won't pick up the new environment variable. When I run ps aux | grep 'celery worker' I don't see anything, presumably because Celery is daemonized by Supervisor, so I'm not sure of a way to completely destroy the current Celery process. No matter what, it feels … -
Django ORM Query multple keywords and retrun multiple list of of objects with single query
These are my model: class Topic(models.Model): name = models.CharField( max_length=50 ) class Question(models.Model): title = models.CharField( max_length=100 ) topic = models.ForeignKey( Topic, on_delete=models.CASCADE ) For example, I have many questions with the topic from many topics, I am trying to query english, biology topic-related question. and this my current query: question = Question.objects.filter( topic__name__in=["english", "biology"] ).values('title', 'id', 'topic') It returns all the biology and english related question. I dont want exactly like this. I want, it will return all the question that english and biology related questions but should be with group, like, all the English related objects should be in a separate lists and all the biology-related objects should be another separate list. there can be many topics, and all the query should be retrun in a list and in that list, there should be multiple list of objects based on the topic. the output look like this: [ { 'english': [here will be all the biology related objecs in list], 'biology': [here will be all the biology related objects in list] } ] I hope you got problem. Can anyone help me in this case? -
Restricted group user to use a specific apps on Django
I have three apps in my Django's Portal. I like to allow the specific group users to use a specific apps. For Example: app1 --> group user 1 app2 --> group user 2 app3 --> all users So, group user 1 can use app1, but they can't use app2, and so on. How can I do this? Thanks! -
Accounts activation with Djoser and Django Rest Framework
Am using Djoser for authentication in my project. Have been struggling to add email activation for over 4 days now but seems have failed to grab it fine as the documentation is a little hard for me to understand. This is my code settings.py #change auth model to custom model AUTH_USER_MODEL = 'userauth.User' #setting up email server EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'okumujustine01@gmail.com' EMAIL_HOST_PASSWORD = 'codemanuzmaster' EMAIL_PORT = 587 EMAIL_USE_TLS = True DEFAULT_FROM_EMAIL = 'okumujustine01@gmail.com' #djoser login settings DJOSER = { 'DOMAIN': 'localhost:8000', 'SITE_NAME': 'net', 'LOGIN_FIELD':'email', 'USER_CREATE_PASSWORD_RETYPE':True, 'ACTIVATION_URL': '#/users/activate/{uid}/{token}', 'SEND_ACTIVATION_EMAIL': True, 'SERIALIZERS':{ 'user_create':'userauth.serializers.UserCreateSerializer', 'user':'userauth.serializers.UserCreateSerializer', 'activation': 'djoser.email.ActivationEmail', } } here is the email i receive after creating user http://example.com/auth/users/activate/MQ/5c9-26bcab9e85e8a967731d It shows example.com but i want it to change the web url to localhost:8000 instead You're receiving this email because you need to finish activation process on example.com. Please go to the following page to activate account: http://example.com/auth/users/activate/MQ/5c9-26bcab9e85e8a967731d And if i change the web url manually to http://127.0.0.1:8000/users/activate/MQ/5c9-26bcab9e85e8a967731d it keeps returning { "detail": "Authentication credentials were not provided." } I really request you people to help me. -
How can I add a button to download a file in django?
I'm making a file management website in django. I made some templates, and the ability to upload files to the django admin. Easy stuff. In one of my templates I want to add a button to download one of my uploaded files... I've tried many different stackoverflow questions, but nothing worked for me. This is my django admin page from where I want to download my file... This is my template: {% load static %} <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="{% static 'css/pages/fthpage.css' %}"> <title></title> </head> <body> <h1>FTH Page</h1> <button class="dwnldbtn"> <h1>FTH</h1> <p>Download<br>excel file</p> </button> </a> </body> </html> Any sort of suggestion is very muh appreciated!! Thanks in advance!