Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
django way to redirect on timeout
I want to understand if the approach I've used to redirect to another page on timeout is a proper one, or if there is a more adequate way in Django. This is my template: {% extends "base.html" %} {% block content %} <h1>Thanks for visiting, come back soon!</h1> <script type="text/javascript"> setTimeout(function() { window.location.href = '/home/'; }, 2000); </script> {% endblock %} This is my urls.py: url(r"^$", views.HomePage.as_view(), name="home"), url(r"^home/$", views.HomePage.as_view()), Would it be possible to combine the two lines in one? (I'm thinking of the "Don't repeat yourself" principle) -
Get all input values into a list javascript
When the response page renders, it renders various input fields. I am trying to get this into a list which, using ajax will be sent back to the django view. here is the html and javascript i am trying to use to achieve this. <div id ='answers'> {% for q in questions %} {{q.question.numeric}} {% if q.question.numeric%} <div class = 'numeric_answer'> {{ q.question.question_text }}<br> <select name="Score"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </div> {% else %} <div class = 'text_answer'> {{ q.question.question_text }}<br> <input type="text" class="question_text"/><br> </div> {% endif %} {% endfor %} </div> <button id="send">Submit</button> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script> <script type="text/javascript"> $(document).ready(function() { var button = $("#send"); $(button).click(function() { var vals = []; $("#answers :input").each(function(index) { vals.push(this.val); }); vals = JSON.stringify(vals); console.log(vals); }); }); </script> Currently, no matter what is entered, I get a list which just contains 'nulls' eg [null, null, null] when I want a list like ['hey', 'asdasd', 5, 'ásdas'] -
Django error: Reverse for 'password_reset_confirm' with no arguments not found
I am using Django 1.11 to build an user account application. My urls for my account app is as Code 1 as below. And also I have a templates/registrations folder and several template files there: enter image description here After I input the email address and I receive the email with the following link: http://127.0.0.1:8000/account/password-reset/confirm/MQ/4ra-66d3672f1d340589fbf9/ I click the above link and the browser redirects to this link: http://127.0.0.1:8000/account/password-reset/confirm/MQ/set-password/ And the error prompts: NoReverseMatch at /account/password-reset/confirm/MQ/set-password/ Reverse for 'password_reset_confirm' with no arguments not found. 1 pattern(s) tried: ['account/password-reset/confirm/(?P[-\w]+)/(?P[-\w]+)/$'] Request Method: GET Request URL: http://127.0.0.1:8000/account/password-reset/confirm/MQ/set-password/ Django Version: 1.11.7 Exception Type: NoReverseMatch Exception Value: Reverse for 'password_reset_confirm' with no arguments not found. 1 pattern(s) tried: ['account/password-reset/confirm/(?P[-\w]+)/(?P[-\w]+)/$'] Please help me how to solve this problem. It seems that after I click the link, the Django fails to render the password_reset_confirm.html under templates/registration folder. Code 1: # restore password urls url(r'^password-reset/$', auth_views.PasswordResetView.as_view(), name='password_reset'), url(r'^password-reset/done/$', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'), url(r'^password-reset/confirm/(?P<uidb64>[-\w]+)/(?P<token>[-\w]+)/$', auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'), url(r'^password-reset/complete/$', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'), -
Django post method returns only blank values for checkboxes
I have tried to look around for this specific query on SO, but could not find one. I am new to Django and am using version 1.10 and python 3.4. For the checkboxes I am using them in the template itself. For some reason I am hesitant in using the checkbox widget in the forms.py file, I think it will disturb my existing UI(please correct me if I am wrong). When I submit the form, the template returns blank quotes for the number of checkboxes I have ticked. Here is my model: class UsrGrpMaster(models.Model): SrNo =models.IntegerField(unique=True) UsrGrpID = models.AutoField(primary_key=True) GrpName = models.CharField(max_length=50) Purch = models.BooleanField(default=False) PurchMod = models.BooleanField(default=False) Sales = models.BooleanField(default=False) SalesMod = models.BooleanField(default=False) Stock = models.BooleanField(default=False) StockMod = models.BooleanField(default=False) JV = models.BooleanField(default=False) JVMod = models.BooleanField(default=False) DelPurch = models.BooleanField(default=False) DelSales = models.BooleanField(default=False) DelJV = models.BooleanField(default=False) class Meta: db_table = "UsrGrpMaster" Here is my template: <div class="body-set"> <div id="form"> <form class="form-horizontal" method="POST" action="{% url 'creategroup' %}"> <div class="form-group" align="center"> <label class=""><font size="6">Create a New User Group</font></label>{% if errormsg %}<br /> <font size="3" color="#FF0000">{{ errormsg }}</font>{% endif %} </div> <div class="form-group"> <label class="control-label col-sm-4" for="text">Name of the User Group:</label> <div class="col-sm-5"> <input type="text" class="form-control" id="grpname" placeholder="Type in the new User Group Name" … -
uWsgi does not see django as www-data user
When I start uWsgi as me (uid=<my_username>) everything works. However, if I do it as www-data user to link uwsgi with nginx, uwsgi prints ModuleNotFoundError: No module named 'django' My uWsgi config: [uwsgi] plugins=python3 chdir=%d home=%dBASE_ENV socket=%duwsgi.sock virtualenv=./BASE_ENV pythonpath=%dBASE_ENV/lib/python3.6 module=reactTest.wsgi:application env=DJANGO_SETTINGS_MODULE=reactTest.settings master=true enable-treads=True processes=1 threads=%k logyo=/var/log/reactTest/reactTest.uwsgi.log chmod-socket=750 chown-socket=daneal:www-data uid=www-data gid=www-data vacuum=true http=:8000 -
In python, how to manage importing and using different class functionality?
I have two python classes, 'x', 'A' and 'B'. Here I am using class x's method in class A and class B class x: def display(self): print ("Hello python") class A: **# case 1** from . import x **# class level import** x_object = x() **# class level object** def my_method(self): x_object.display() class B: **#case 2** def my_method(self): from . import x **# method level import** x_object = x() **# method level object** So,in above scenarios I used class level import and object creation and method level import and object creation, my questions are as- which is best approach considering performance? how memory utilization work for both scenario? In above scenario, if I am using "my_method()" very frequently from django view. There will be 10000 concurrent requests accessing view from which method "my_method" is being called? is there any best way to use different class functionality in django view which give max performance and best memory management Thanks in advance. -
django.db.utils.ProgrammingError: column "projectfinancialtype" of relation "WorldBank_projects" does not exist
I'm working on a Django application which fetches JSON data from an API and stores it in PostgreSQL database. But while running 'python manage.py fetch' I am getting this error: django.db.utils.ProgrammingError: column "projectfinancialtype" of relation "WorldBank_projects" does not exist Here's the traceback: Traceback (most recent call last): File "/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 65, in execute return self.cursor.execute(sql, params) psycopg2.ProgrammingError: column "projectfinancialtype" of relation "WorldBank_projects" does not exist LINE 1: INSERT INTO "WorldBank_projects" ("project_id", "projectfina... ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line utility.execute() File "/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 355, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/python/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/python/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/app/aggregator/WorldBank/management/commands/fetch_wb.py", line 60, in handle Projects.objects.create(**pdata) File "/python/lib/python3.6/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/python/lib/python3.6/site-packages/django/db/models/query.py", line 394, in create obj.save(force_insert=True, using=self.db) File "/python/lib/python3.6/site-packages/django/db/models/base.py", line 807, in save force_update=force_update, update_fields=update_fields) File "/python/lib/python3.6/site-packages/django/db/models/base.py", line 837, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/python/lib/python3.6/site-packages/django/db/models/base.py", line 923, in _save_table result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "/python/lib/python3.6/site-packages/django/db/models/base.py", line 962, in _do_insert using=using, raw=raw) File "/python/lib/python3.6/site-packages/django/db/models/manager.py", line 85, … -
Django 1.10 Need help using CreateView to add data in model which has relationship with other models(e.g. Classroom->School->User)
My django version is 1.11 and new to Django using CreateView for multiple tables. I have been trying to link the 3 models i.e. User(django built-in), School and Classroom. I need to create a new classroom which has relationship with the School and User model so how can add them to the Classroom model when creating a new class. I have the following simplied version of the code, In urls.py of app named basic_app, url(r'^login/$', views.user_login, name='user_login'), url(r'^class/(?P<pk>\d+)/$',views.ClassroomView,name='classroom_list'), url(r'^class/create/(?P<pk>\d+)$',views.ClassroomCreateView.as_view(),name='createClassroom'), In models.py, from django.contrib.auth.models import User from django.db import models from django.core.urlresolvers import reverse class School(models.Model): #1-1 relationship with django built-in User model user = models.OneToOneField(User, on_delete=models.CASCADE) name = models.CharField(max_length=256) principal = models.CharField(max_length=256) location = models.CharField(max_length=256) def __str__(self): return self.name def get_absolute_url(self): return reverse("basic_app:detail",kwargs={'pk':self.pk}) class Classroom(models.Model): school = models.ForeignKey(School, on_delete=models.CASCADE) class_name = models.CharField(max_length=256) desc = models.CharField(max_length=256) def __str__(self): return self.class_name When the user click on the following link after login, <a href="{% url 'basic_app:createClassroom' pk=user.pk %}">Create Classroom In views.py, def user_login(request): if request.method == 'POST': # First get the username and password supplied username = request.POST.get('username') password = request.POST.get('password') # Django's built-in authentication function: user = authenticate(username=username, password=password) if user: #Check it the account is active if user.is_active: # Log the … -
AttributeError: 'Options' object has no attribute 'get_all_related_objects'
I am trying to implement https://github.com/tomwalker/django_quiz in my project. When I am running server I am getting this error. I am beginner please help. File "C:\Python36-32\lib\site-packages\model_utils\managers.py", line 106, in _get_subclasses_recurse rel for rel in model._meta.get_all_related_objects() AttributeError: 'Options' object has no attribute 'get_all_related_objects' -
Removing # from url of angularJS for SEO with backend as Django
I know removing hash from AngularJS is pretty straightforward but the problem is that the backend is in Django. So, the app works unless the page is refreshed using "F5". so, http://127.0.0.1:8000/account works if the button is clicked but refreshing the page gives me Page not found as the server searches for it in urls.py file Can someone please suggest me any fix for this ? -
How to integrate Vue cordova mobile app with django rest & django channels as backend?
i have a real time web app chat created using django, django rest framework and django channels. And now i want to create android and ios app, is it possible to connect with cordova and framework7 and vue in mobile app? how to integrate it? thanks for your help -
In django, Is it ok to write duplicate methods in different applications if method code is small?
I am working on web api using django. In this I have categorized functionality with different applications. I need suggestion for following scenario- Suppose I have three applications in a project, app1, app2 and app3 There is one function with name func(), func() require in app1 and app2 and may require in app3 in future. This function has same code, require same parameters. So, should I write func() in app1 and app2, also if require in app3. or write in only app1 and call it into app2. which is best approach for above scenario? does creating class object of class from app1 and calling method func() from another application cause performance issue if that class contains lot of code? or simply write a new method in application even though it is redundant Please suggest me best approach. Thanks in advance -
NoReverseMatch: Django URL
I Had everything Linking the way it should. Now I cannot display the products in the product detail view. I added in CreateView, UpdateView, DeleteView to edit the database. Now the CreateView, UpdateView, DeleteView all work fine but the actual links to the detailed product view gives me the Error: Reverse for 'category_detail' with arguments '('',)' not found. 1 pattern(s) tried: ['products/categories/(?P<pk>\\d+)$'] The Information shows up fine in list view urls.py url(r'^$', views.index, name='index'), url(r'^products/$', views.ProductListView.as_view(), name='products'), url(r'^products/(?P<pk>\d+)$', views.ProductDetailView.as_view(), name='product_detail'), url(r'^categories/$', views.CategoryListView.as_view(), name='categories'), url(r'^categories/(?P<pk>\d+)$', views.CategoryDetailView.as_view(), name='category_detail'), url(r'^categories/create/$', views.CategoryCreate.as_view(), name='category_create'), url(r'^categories/(?P<pk>\d+)/update/$', views.CategoryUpdate.as_view(), name='category_update'), url(r'^categories/(?P<pk>\d+)/delete/$', views.CategoryDelete.as_view(), name='category_delete'), url(r'^products/create/$', views.ProductCreate.as_view(), name='product_create'), url(r'^products/(?P<pk>\d+)/update/$', views.ProductUpdate.as_view(), name='product_update'), url(r'^products/(?P<pk>\d+)/delete/$', views.ProductDelete.as_view(), name='product_delete'), ] models.py class Category(models.Model): """ Model For a product category """ c_name = models.CharField(max_length=200, help_text="Enter a Product Category: ") def __str__(self): """ String Representation for the Model object """ return self.c_name def get_absolute_url(self): """ Return an absolute URL to access a product instance """ return reverse('category_detail', args=[str(self.id)]) class Product(models.Model): p_name = models.CharField(max_length=200) description = models.TextField(max_length=4000) price = models.DecimalField(max_digits=6, decimal_places=2) category = models.ForeignKey(Category, on_delete=models.CASCADE, related_name='products') quantity = models.PositiveIntegerField() featured_image = models.CharField(max_length=300) def __str__(self): """ String Representation for the Model object """ return str(self.p_name) + "€" + str(self.price) def get_absolute_url(self): """ Return an absolute URL to access a … -
Adding functions to makemigration in Django (Elasticsearch Index)
I am trying to create a project that combines Django and Elasticsearch. What I want to do is create or update an Elasticsearch Index when a Django migrations file is created. The brute way would be to detect any changes in the migrations folder and execute a function that will create/update the Elasticsearch Index accordingly, but I want to create something that will directly respond to the makemigrations command, as that is more intuitive. Looking at the migrations doc in Django, I can't really find useful information on how the migrations file is created. Thank you for all the help. -
How to make a code that alters database in background Django
I'm making an elimination style voting website. People log in, vote for their least favorite participant, and at the end of the day the person with the most votes goes inactive. Almost everything works: The log in, the voting, etc. But I have no idea how to make a program that checks for the most votes and alters the database to change the status of a participant at a particular time without needing a user to enter the website. I don't even know where to put the code. And how would I make sure it's constantly running? The way I see it, views.py only works when a user goes to the URL, so if no one visited the website at the time of vote recopilation it wouldn't work, so that's a no no. I could make a script outside of the Django project that does this, and then run it with nohup &, but then I'd lose on the model notation and would have to make manual queries, plus I'm sure there's a better, more Django way to do this. Any solutions to this problem? Or maybe some direction you can point me in? -
Reservation message in django
I am making a chatbot using a messenger called KakaoTalk. I wrote a function that sends a message when the current request is received. However, I can not implement the function of sending notification characters in the morning. I need your help. Here is my code sample. def message(request): json_str = ((request.body).decode('utf-8')) received_json_data = json.loads(json_str) content = received_json_data['content'] data_will_be_send = { 'message': { 'text': connect_apiai.get_apiai(papago.get_papago(content)) } } return JsonResponse(data_will_be_send) How can I send JsonResponse without a request? -
Python - Basic validation of international names?
Given a name string, I want to validate a few basic conditions: -The characters belong to a recognized script/alphabet (Latin, Chinese, Arabic, etc) and aren't say, emojis. -The string doesn't contain digits and is of length < 40 I know the latter can be accomplished via regex but is there a unicode way to accomplish the first? Are there any text processing libraries I can leverage? -
Using database server in Docker container based architecture
Im learning Docker and for test purposes Im running a Django App in it. Everything is OK and running. But now i want to use database(Postgres) in my containerised architecture. As we know, If a container stops, All data will be reseted and because of that I can't put my database in container, Right? Im confused about this. Should I run database server outside of container? Then how App inside container should talk with that? Or I have to run database service in the container and read database dump files from external source? Im confused about architecture! Containers are just for Apps and codes no just database servers? Or I can use database inside the container? I love containers idea and i want to do my project as a package that runs everywhere... But when im using database server, is this possible? -
django TemplatSyntaxError at / when passing variable to html file
using django, i'm getting a blank page when executing this code {% block content %} {% for c in content %} <p1>{{c}}</p1> {% endfor %} {% endblock %} the page title is 'TemplatSyntaxError at' i'm new to html so it is likely a simple fix thank you. x -
Django - Celery 4.1 with django-celery-beat/rabbitmq : Nothing?
I followed the tutorial on http://docs.celeryproject.org/en/latest/ and when I started the daemonization with the init-script: celerybeat (with /etc/default/celeryd config file) [2017-11-19 01:13:00,912: INFO/MainProcess] beat: Starting... and nothing more after. Do you see what could I make wrong ? My celery.py: from __future__ import absolute_import, unicode_literals import os from celery import Celery # set the default Django settings module for the 'celery' program. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'oscar.settings') app = Celery('oscar') # Using a string here means the worker doesn't have to serialize # the configuration object to child processes. # - namespace='CELERY' means all celery-related configuration keys # should have a `CELERY_` prefix. app.config_from_object('django.conf:settings', namespace='CELERY') # Broker settings app.conf.broker_url = 'amqp://oscar:oscar@localhost:5672/oscarRabbit' # Load task modules from all registered Django app configs. app.autodiscover_tasks() some_app/tasks.py: from __future__ import absolute_import, unicode_literals from oscar import celery_app from celery.schedules import crontab from .models import HelpRequest from datetime import datetime, timedelta import logging """ CONSTANTS FOR THE TIMER """ # Can be changed (by default 1 week) WEEKS_BEFORE_PENDING = 0 DAYS_BEFORE_PENDING = 0 HOURS_BEFORE_PENDING = 0 MINUTES_BEFORE_PENDING = 1 # http://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html # for schedule : http://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html#crontab-schedules @celery_app.on_after_configure.connect def setup_periodic_tasks(sender, **kwargs): sender.add_periodic_task( crontab(minute=2), set_open_help_request_to_pending ) @celery_app.task(name="HR_OPEN_TO_PENDING") def set_open_help_request_to_pending(): """ For timedelay idea : https://stackoverflow.com/a/27869101/6149867 """ logging.info("RUNNING CRON TASK FOR STUDENT … -
UserProfile as a foreign key in xadmin didn's dispaly option selection
class UserProfile(AbstractUser): nick_name=models.CharField(max_length=50,verbose_name='昵称') birthday=models.DateTimeField(verbose_name='生日',null=True,blank=True) gender=models.CharField(max_length=50,choices=(('male',u'男'),('female',u'女')),default=('male',u'男')) address=models.CharField(max_length=100,default=u'') mobile=models.CharField(max_length=11,null=True,blank=True) image=models.ImageField(upload_to='image/%Y/%m',default=u'image/default.png',max_length=100) class Meta: verbose_name=u'用户信息' verbose_name_plural=verbose_name def __unicode__(self): return self.username class UserCourse(models.Model): user = models.ForeignKey(UserProfile, verbose_name=u'用户') course = models.ForeignKey(Course, verbose_name=u'课程') add_time=models.DateTimeField(default=datetime.now, verbose_name=u'添加时间') class Meta: verbose_name = u'用户课程' verbose_name_plural = verbose_name the filter filed is search ,why is it option list? they are all foreign key, why the first line are search and second line are option? -
Ajax prost request return empty querydict
i'm trying to send a post request and authenticate a user based on that information. however even though i have checked the result from $('#sign_in').serialize() and it returns something like username=test&password=test it still returns <QueryDict: {}> when i run print(request.POST) inside my views.py. What am i doing wrong and why is it not passing the parameters? ajax function function logIn() { var username = $('#id_username').val(); var password = $('#id_password').val(); console.log($('#sign_in').serialize()) $('#sign_in_btn').text('Logger ind...'); $.ajax({ url: "/account/login/", type: "POST", dataType: 'json', contentType: 'application/json', data: $('#sign_in').serialize(), success: function (data) { console.log(data) }, error: function (error) { } }); } views.py def login(request): print(request.POST) if request.method == "POST": form = SignInForm(data=request.POST) response_data = {} if form.is_valid(): username = request.POST.get("username", False) password = request.POST.get("password", False) user = authenticate(username=username, password=password) auth_login(request, user) if user: response_data['success'] = True response_data['message'] = 'Brugeren er blevet oprettet!' else: #invalid case response_data['success'] = False response_data['message'] = 'Forkert brugernavn/kodeord. Prøv venligst en anden kombination eller tryk på glemt kodeord!' print(form.errors) return HttpResponse(json.dumps(response_data), content_type='application/json') else: form = SignInForm() return render(request, 'login.html', {'form': form}) -
django querysets in templates
I am trying to make specific queries by using some model entry fields. I have the following model entry: models.py class Work(models.Model): categories =( ('cat1', 'cat1'), ('cat2', 'cat2'), ('cat3', 'cat3'), ('cat4', 'cat4'), ('cat5', 'cat5'), ) title = models.CharField(max_length=200) description = RichTextUploadingField(config_name='awesome_ckeditor') date = models.DateTimeField(default=timezone.now) category = models.CharField(max_length=200, choices = categories, default = 'projects') thumb = models.ImageField(upload_to = 'works/thumbs', blank = True) content = models.FileField(upload_to = 'works/content_media', blank = True) published = models.BooleanField() def __str__(self): return self.title def get_absolute_url(self): return reverse("work_detail",kwargs={'pk':self.pk}) @property def thumb_url(self): if self.thumb and hasattr(self.thumb, 'url'): return self.thumb.url @property def content_url(self): if self.content and hasattr(self.content, 'url'): return self.content.url here is the view: views.py class WorksListView(ListView): template_name = 'template.html' model = Work def get_queryset(self): return Work.objects.filter(published=True).order_by('-date') and I am trying to query first by the category field then by entry in the following template: template.html {% for category in works_list.category %} <ul data-category-name={{category.name}}> {% for work in category.works %} <li data-thumbnail-path={{thumbnail.url}} data-url={{content.url}} > <div> <p class="gallery1DecHeader">{{work.title}}</p> <p class="gallery1DescP">{{work.description}}</p> </div> </li> {% endfor %} {% endfor %} what do I need to change? -
anomaly when overriding bootstrap in django
For the past two hours I've been trying to figure out a strange behavior when trying to override bootstrap in Django. At the beginning, without any custom css file, the result was this: output without any custom css file Then I created a custom css file: my_site/css/master.css .index-jumbotron { background-color: #006DB0; } #main-title { text-align: center; color: white; } It resulted in this: my_site/css/master.css output So far, so good. But now, if I change anything on that same file (even when putting !important and taking good care of the specificity system), the result is always the same as the image immediately above. However, when I indicate my template to point to another file my_site/css/master2.css or css/master.css, indeed the result is as I would have expected: my_site/css/master2.css output I can't get my head around this. Do you have any idea? Do you know if the package django-bootstrap3 could have anything to do with that? I installed it in between my two different version of the custom css file. -
How do you pass Django variables that are passed to an HTML page to modal that is included in that HTML page
I am passing a list of objects to an HTML page. On that HTML page, I can access those objects by writing something like: {{ item.name }} I also included a Bootstrap 4 modal on this HTML page with the following code: {% include 'my_modal.html' %} This modal only appears if a user clicks a button. When the user clicks that button and the modal appears, I want to be able to put {{ item.name }} in that modal, but it doesn't work. How can I use the same objects that I successfully passed to an HTML page in the modal that is included in that HTML page?