Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Can't use multiple Databases in my django project
I'm trying to use two DBs for my django project. The first one is for authentication etc, the second should hold data sent by the user through a form. I added the second DB to my settings.py file, but i keep getting errors, the most recent one is (1146, "Table 'dataset.main_SomeModel' doesn't exist") Indeed, it looks like my Django project can't interact with the db, since there is no table there. Am i doing something wrong? Maybe is it the wrong way to use two DBs here? Here is settings.py, the second db called dataset is the one i'm trying to use: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), }, 'dataset': { 'NAME': 'dataset', 'ENGINE': 'django.db.backends.mysql', 'USER': 'root', 'PASSWORD': 'password goes here' } } Here is the model: class SomeModel(models.Model): data = models.CharField(max_length=100) num = models.Float() def save(self): # ALL the signature super(SomeModel, self).save(using=dataset) And here is the form: class DataForm(forms.ModelForm): class Meta: model = SomeModel fields = ("data", "num") def save(self, commit=True): send = super(DataForm, self).save(commit=False) if commit: send.save() return send Since i added the line using="dataset" shouldn't the data be sent to the dataset db? Or am i doing something else wrong? Any advice is … -
django + Python + IIS. Getting error while reading WSGI handler
I am trying to deploy django app on IIS. I have followed this tutorial https://www.youtube.com/watch?v=CpFU16KrJcQ. But at the end I am getting below error while accessing localhost. Error occurred while reading WSGI handler: Traceback (most recent call last): File "c:\users\jay.desai\appdata\local\programs\python\python37\lib\site-packages\wfastcgi.py", line 791, in main env, handler = read_wsgi_handler(response.physical_path) File "c:\users\jay.desai\appdata\local\programs\python\python37\lib\site-packages\wfastcgi.py", line 622, in read_wsgi_handler env = get_environment(physical_path) File "c:\users\jay.desai\appdata\local\programs\python\python37\lib\site-packages\wfastcgi.py", line 399, in get_environment doc = minidom.parse(web_config) File "c:\users\jay.desai\appdata\local\programs\python\python37\lib\xml\dom\minidom.py", line 1958, in parse return expatbuilder.parse(file) File "c:\users\jay.desai\appdata\local\programs\python\python37\lib\xml\dom\expatbuilder.py", line 911, in parse result = builder.parseFile(fp) File "c:\users\jay.desai\appdata\local\programs\python\python37\lib\xml\dom\expatbuilder.py", line 207, in parseFile parser.Parse(buffer, 0) xml.parsers.expat.ExpatError: not well-formed (invalid token): line 24, column 16 StdOut: StdErr: -
How do I access the inner values of my custom block?
I've created a custom block with nested blocks. How do I access the fields in the inner block? For example, I want to display the icon, title, and description. I have tried several variations of this: {% for block in values %} {% if block.block_type == 'features' %} {{ block.value.feature.title }} This is my block definition: class Features_1_Block(blocks.StructBlock): title = blocks.CharBlock() description = blocks.TextBlock(required=False) features = blocks.StreamBlock([ ('feature', blocks.StructBlock([ ('icon', blocks.CharBlock()), ('title', blocks.CharBlock()), ('description', blocks.TextBlock()) ])) ]) class Meta: template = 'streamfield_blocks/features_1.html' Currently there is no output. -
Django models with tz naive and aware fields
I have USE_TZ = True in django.conf.settings. At the same time I would like to have a timezone-naive datetime field in a model that is responsible for keeping airplane departure/arrival times. These times are always local. How would you recommend implementing a timezone-naive field? Or am I missing an important (non-generic) argument against the idea? -
Django: annotate a query set with the total count of a nested relation
I have a situation similar to the following: class Team(models.Model): pass class Player(models.Model): team = models.ForeignKey(Team) class Point(models.Model): player = models.ForeignKey(Player) For ordering purposes (with django-tables2), I would like to annotate a QuerySet with the team's total point count, something akin to the following: Team.objects.annotate(point_count=Count('player_set__point_set')) \ .order_by('point_count') This, however, does not work. Is there a way to achieve the same? -
I'm creating a table and am coloring the text green or red depending of + or - value, is there a way I can remove the sign from the number
I am trying to remove the '- 'sign from my number when it displays in html because I don't need it any more as I have color coded the text instead. Is this possible and if so how could I remove the - sign if there is one ? Table loop below {% for sale in page_obj %} <tr> <td>{{sale.transaction.currency}}</td> <td>{{sale.amount_sold}}</td> <td>{{sale.amount_per_coin_sold}}</td> <td>{{sale.total_price_sold}}</td> <td>{{sale.transaction.amount_per_coin}}</td> <td>{{sale.date_sold|date:"j N Y"}}</td> {% if sale.profit_loss < 0 %} <td style = "color:red">{{ sale.profit_loss }}</td> {% else %} <td style = "color:green">{{ sale.profit_loss }}</td> {% endif %} {% if sale.profit_loss_percent < 0 %} <td style = "color:red">{{sale.profit_loss_percent}}</td> {% else %} <td style = "color:green">{{sale.profit_loss_percent}}</td> {% endif %} <td><a href="{% url 'sale-detail' sale.id %}">View</a></td> </tr> {% endfor %} -
How to get a 'month' field with query_set?
I have a model and it has a field 'month'. How do I get this field with query_set? Model is returning a field called 'area' and I don't want to change it to month because I need field area for another function's query_set. Field 'month' has name of month ex: 'January'. my model class Report(models.Model): author = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='Created by: ') year = models.IntegerField('Year:', default=2019) month = models.PositiveSmallIntegerField('Month', null=True, choices=MONTHS.items()) area = models.ForeignKey(Area, on_delete=models.CASCADE, null=True, blank=True) country = models.ForeignKey(Country, on_delete=models.CASCADE, null=True, blank=True) new_ministers = models.IntegerField('How many new Ministers <br> in Training?', default=0) dis_course = models.IntegerField('How many are in Discipleship Courses?', default=0) licenced_ministers = models.IntegerField('How many newly Licensed Ministers?', default=0) upgrade_licence = models.IntegerField('How many Upgraded Licenses?', default=0) preaching_place = models.IntegerField('How many New Preaching Places?', default=0) new_churches = models.IntegerField('How many New Churches?', default=0) water_baptism = models.IntegerField('How many were Baptized in Jesus Name?', default=0) holy_ghost = models.IntegerField('How many Received <br> the Holy Ghost?', default=0) constituents = models.IntegerField('Current Constituents:', default=0) total_holy_ghost = models.IntegerField('Total Filled with the Holy Ghost:', default=0) total_baptized = models.IntegerField('Total Baptized in Jesus Name:', default=0) def __str__(self): return '{}'.format(self.area) my views.py or my function: @login_required def report_list(request): areas = Report.objects.all() country = Report.objects.values_list('area__name', flat=True) context = { 'areas':areas, 'country':country } return … -
Save XML data through Django models
I'm trying to save data extract from xml URL to achieve this I make it with Requests and Element Tree. I'm facing two issues. 1 - How save data through my Django model ? 2 - How iterate with multiple parameters with element tree ? Thanks a lot Order models from django.db import models class Order(models.Model): idFlux = models.IntegerField(default=0) order_id = models.IntegerField(default=0) order_mrid = models.IntegerField(default=0) order_refid = models.IntegerField(default=0) Script from orders.models import Order import requests import xml.etree.ElementTree as ET url = 'http://test.lengow.io/orders-test.xml' xml = requests.get(url) xml_raw = ET.fromstring(xml.content) for child in xml_raw.iter('idFlux'): Idflux_child_text = child.text i = Order(Idflux = Idflux_child_text) i.save() -
Pytest: TemplateResponse returned instead of a view
I test an update view with pytest using this test and it runs ok. The lang_src instance is correctly updated. def test_authenticated_staff(self, staff_client, lang_src): url = reverse(self.url, kwargs={'pk': lang_src.pk}) data = {'code': 'it', 'pk': lang_src.pk} resp = staff_client.post(url, data=data) assert resp.status_code == 302 lang_src.refresh_from_db() assert lang_src.code == 'it' If I want to test messages from contrib.messages, I setup folllow=True as following. def test_updated_message(self, staff_client, lang_src): url = reverse(self.url, kwargs={'pk': lang_src.pk}) data = {'code': 'it', 'pk': lang_src.pk} resp = staff_client.post(url, data=data, follow=True) assert resp.status_code == 200 message = list(resp.context.get('messages'))[0] I can't understand why I'm returned a TemplateResponse instead of the expected views. In this case, resp has no url, no context['messages']... What am I missing? -
EmptyPage error when the page already exist in django
i have a problem with django. I have created a pagination function and everything is fine, but when i try to enter to the last page of the pagination, i get the error "EmptyPage this page does not contain results". But that page really exists! there are items left but it doesn´t show me the five last items of the Query. Here is my function: def clasification(request): categoria = Clasificacion.objects.filter(existencia=True) paginator = Paginator(categoria, 5) page = request.GET.get('page') try: items = paginator.page(page) except PageNotAnInteger: items = paginator.page(1) except EmptyPage: items = paginator.page(paginator.num_pages) contexto = {'meta_description':'', 'meta_keywords':'', 'items':items} return render(request, 'adminview/clasification.html', contexto) Everything seems to be fine here... Take a look of the HTML: {% if items.has_next or items.has_previous %} <ul class="pagination"> {% if items.has_previous %} <li class="page-item"><a class="page-link" href="?page={{ items.previous_page_number }}">Anterior</a></li> {% else %} <li class="page-item disabled"><a class="page-link">Anterior</a></li> {% endif %} {% for page in items.paginator.page_range %} <li class="page-item {% if items.number == page %}active{% endif %}"><a class="page-link" href="?page={{ page }}">{{ page }}</a></li> {% endfor %} {% if items.has_next %} <li class="page-item"><a class="page-link" href="?page={{ items.next_page_number }}">Siguiente</a></li> {% else %} <li class="page-item disabled"><a class="page-link" href="?page={{ items.next_page_number }}">Siguiente</a></li> {% endif %} </ul> {% endif %} I dont know why i´m getting this error. … -
How do I increase query speed in django?
I have an application with model that users other model as on of its field (relational onetoone) but as the data grows, I experiences slowness in the query, or when using the django admin to fill in some data. -
Getting error : Reverse for 'update' with arguments '(1,)' in django
when i run the program it gives me error, Reverse for 'update' with arguments '(1,)' not found. 1 pattern(s) tried: ['crud/add/<:id>$'] , I am loading list of the data, but getting error at <td><a href="{% url 'crud:update' page.id %}">Edit</a></td>, here i have added my whole code, can anyone please help me to resolve this issue ? index.html {% load static %} <link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}"> <table> <tr> <th>Page Title</th> <th>Update Date</th> <th>Action</th> </tr> {% if pagelist %} {% for page in pagelist %} <tr> <td>{{ page.title }}</td> <td>{{ page.updated_date }}</td> <td><a href="{% url 'crud:update' page.id %}">Edit</a></td> </tr> {% endfor %} {% else %} <tr> <td colspan="2">Np Pages are available</td> </tr> {% endif %} </table> urls.py from django.urls import path from . import views app_name = 'crud' urlpatterns = [ path('',views.index, name='index'), path('add/',views.add, name='add'), path('add/<:id>',views.add, name='update'), ] -
How to fetch certain field value of related models object and save it to another?
My models Book and ReadList related and I can use them on Django Admin but I want to fetch bookPageCount field of selected object and save it to pageCount field of new object when save. from django.db import models from django.db.models.signals import post_save, pre_save from django.dispatch import receiver # Create your models here. class Book(models.Model): bookname = models.CharField(max_length=200, verbose_name='Kitap Adı') bookAuthor = models.CharField(max_length=100, verbose_name='Yazar Adı') bookPublisher = models.CharField(max_length=100, verbose_name='Yayın Evi') bookPageCount = models.PositiveIntegerField(verbose_name='Sayfa Sayısı') bookAddDate = models.DateField(verbose_name='Kitaplığa Eklenme Tarihi') class Meta: verbose_name = 'Kitap' verbose_name_plural = 'Kitaplar' def __str__(self): return self.bookname class ReadList(models.Model): bookName = models.ForeignKey('kitaplik.Book', related_name='book', on_delete=models.CASCADE, verbose_name='Kitap Adı') readerName = models.ForeignKey('ogrenciler.Students', on_delete=models.CASCADE, related_name='readerName', verbose_name='Okuyan Kişi') dateOfRead = models.DateField(verbose_name='Okuma Tarihi') pageCount = models.PositiveIntegerField(verbose_name='Sayfa Sayısı',blank=True, null=True) class Meta: verbose_name = 'Okuma Günlüğü' @receiver(post_save, sender=ReadList) def get_pageCount(sender, instance, **kwargs): instance.pageCount = instance.book.pageCount instance.save -
How to serialize fields related to a model through another model?
My models are as follows: class Question(models.Model): content = models.CharField( max_length=1000, blank=False, default='', ) def __str__(self): return self.content class OptionGroup(models.Model): question = models.ForeignKey( 'Question', on_delete=models.CASCADE, default='', ) options = models.ManyToManyField('Option') class Option(models.Model): content = models.CharField( max_length=1000, blank=False, default='', ) I am trying to create a Question serializer which will serializer Question.content and all the related Option.content without displaying any fields from OptionGroup. How do I do this? -
How to show relationship in Django Admin
I am using Django 2.1 and I am getting a hard time trying to figure out how to show relationships on Admin. I have two Models Hospital and Units and the third one is Exams. They are setting up like this, Hospital can have many Units and one Units belongs to one Hospital. And the Exam model has the exams attributes like exams name and hospital`s name. class Hospital(models.Model): name = models.CharField(max_length=200) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) def __str__(self): return self.name class Unit(models.Model): unit_name = models.CharField(max_length=200) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) parent_company = models.ForeignKey( Hospital, related_name='unit_parent', on_delete=models.CASCADE, verbose_name="Hospital") class Exam(models.Model): unit_name = models.ForeignKey( Hospital, related_name='hospital_pk', on_delete=models.CASCADE) exam_name = models.CharField(max_length=255, blank=True, null=True, verbose_name="Exam's name") date = models.DateField() time = models.TimeField() def __str__(self): return self.exam_name class CustomExamAdmin(admin.ModelAdmin): model = Exam list_display = ('exam_name', 'time', 'alert', 'document', 'notes', 'report', 'patients_name', 'unit_name') list_filter = ('exam_name', 'time') list_select_related = ('unit_name',) fieldsets = ( ("Hospital's Name:", { 'fields': ('unit_name',)}), ('Types of Exams:', { 'fields': ('exam_name', 'modality', 'model_used')}), ("Patient's name:", { 'fields': ('patients_name',)}), ) So, in Exams page on Admin I am able to select the Hospital name, however I am not able to select the Unit the belongs to the hospital. I need to … -
Crispy_forms_tags not fill form with instance in my update view
My problem about Update View On my UpdateView when I use {{form.as_p}} , Its work. But when I use {% load crispy_forms_tags %} Form not fill with instance. My View.py; def ayarlar (request): userinstance=get_object_or_404(kullaniciBilgileri,id=1) form = KullaniciForm(request.POST or None, instance=userinstance) if form.is_valid(): form.save() context={ 'form':form, } return render(request, 'cek/ayar.html',context) In my template {{forms.as_p}} is working but I wanna this type: <form action="" method="post"> {% load crispy_forms_tags %} {% csrf_token %} <div class="form-row" > <div class="form-group col-md-6"> <label>First Name</label> <input type="text" name='{{ form.firstName.name }}' class="form-control" > </div> <div class="form-group col-md-6"> <label>Last Name</label> <input type="text" name='{{ form.lastName.name }}' class="form-control" > </div> </div> But this type dont fill with instance. How can I solve this problem -
Django error: CSRF verification failed only with Apache (not with development server)
I have a simple page where the user can select from some list and pressing the submit button can download a csv file generated on the fly according to the selection. I am following the examples and tutorials provided by the official Django website (Django version 2.1, Python 3.6) in mytemplate.htm: <div> <form action="{% url 'myurl_to_downloadcsvView' %}" method="post"> {% csrf_token %} {% for obj in object_list %} <input type="radio" name="myname" id="choice{{ forloop.counter }}" value="{{ obj.pk }}"> <label for="choice{{ forloop.counter }}"> {{ obj.name }}</label><br> {% endfor %} <input type="submit" value="Download"> </form> </div> in views.py: class ListView(ListView): template_name = 'mytemplate.htm' model = mymodel def downloadcsvView(request): blahblah (something I create on the fly) response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = 'attachment; filename="somefilename.csv"' writer = csv.writer(response) for r in blahblah: writer.writerow(r) return response in settings.py: MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] When I test it with the development server (i.e. manage.py runserver), it works, but when I start the Apache server, when pressing the submit button, I get the error: FORBIDDEN (403) 'CSRF verification failed. Request aborted.' Reason given for failure: CSRF cookie not set. I can "solve" this only by putting @csrf_exempt before the "downloadcsvView". How can I make it … -
Invalid syntax error in Django Model Class
I am creating my first model with Django. The codes in models.py is as below. from django.db import models Class Topic(models.Model): top_name = models.CharField(max_length=264,unique=True) def __str__(self): return self.top_name But I am getting a syntax error as below. Class Topic(models.Model): ^ SyntaxError: invalid syntax -
How to parse xml and write hierarchy to django database?
I am trying to parse xml file and store the hierarchy in database but it seams that i did it incorrectly especially while creating an objects in database because it takes a lot of time and queries to store this data. I dont't have any idea how to make better, hope you will help me example of xml file: <RECORD><OBL_NAME>Автономна Республіка Крим</OBL_NAME><REGION_NAME></REGION_NAME><CITY_NAME>м.Сімферополь</CITY_NAME><CITY_REGION_NAME></CITY_REGION_NAME></RECORD> <RECORD><OBL_NAME>Автономна Республіка Крим</OBL_NAME><REGION_NAME></REGION_NAME><CITY_NAME>м.Сімферополь</CITY_NAME><CITY_REGION_NAME></CITY_REGION_NAME></RECORD> <RECORD><OBL_NAME>Автономна Республіка Крим</OBL_NAME><REGION_NAME></REGION_NAME><CITY_NAME>м.Севастополь</CITY_NAME><CITY_REGION_NAME>с.Балка</CITY_REGION_NAME></RECORD> <RECORD><OBL_NAME>Автономна Республіка Крим</OBL_NAME><REGION_NAME></REGION_NAME><CITY_NAME>м.Севастополь</CITY_NAME><CITY_REGION_NAME>с.Набережне</CITY_REGION_NAME></RECORD> def data_xml_parser(xml_file): tree = ET.parse(xml_file) # get document root root = tree.getroot() # find all records of data structure = [] s = set() for records in root.iter('RECORD'): obl_name = records.find('OBL_NAME').text region_name = records.find('REGION_NAME').text city_name = records.find('CITY_NAME').text city_region_name = records.find('CITY_REGION_NAME').text d = {'OBL_NAME': obl_name, 'R_NAME': region_name, 'CITY_NAME': city_name, 'CITY_REGION_NAME': city_region_name} # prevent duplicate data t = tuple(d.items()) if t not in s: s.add(t) structure.append(d) return structure and my file where I'm trying to write data to database, like Obl_name->Region_name->City_name->City_region_name : class Command(BaseCommand): help = 'Fill DB with initial data' def handle(self, *args, **options): for entry in get_dataset(): oblast = Place.objects.get_or_create(name=entry.get('OBL_NAME')) region = None city = None if entry.get('REGION_NAME') is not None: region = Place.objects.get_or_create(name=entry.get('REGION_NAME'), parent=oblast) if entry.get('CITY_NAME') is not None and region is not None: city = Place.objects.get_or_create(name=entry.get('CITY_NAME'), parent=region) … -
How to handle multiple files in a post petition to recover them and show them in a view?
I am trying to upload multiple image files with a form in html in django, but when trigger the button only one file is uploaded, how can I recover several files and show them in my view? I get this on python: , , , ]}> -
How can i create detail view for pagination item
I have an application where i am testing a printer and going through a series of test steps. The test steps, I am using pagination 1 step at a time. So you click next to bring up the next step. The problem is, I didnt create a detail view. I just have a view called test step which I can click next to go through the whole queryset. Problem is, that I cant click to go to one specific test, or pause the test without returning to the first step. I tried to create a detail view and split the view up. But I couldnt figure out how to make each step a detail view with the pagination. This is the test detail view and page. from here I click launch test which brings me into the paginated steps in the view below. def test_detail(request, id): test_instance = get_object_or_404(Test, id=id) steps = test_instance.teststep_set.all() printer_status_check = printer_check(test_instance) status = printer_status_check['status'] context = { "test": test_instance, "steps": steps, 'printer_status': status } return render(request, "testing/test_detail.html", context) So this is the view that controls all the functionality through all the steps. I am having to use html forms because I couldnt figure out how … -
How to pass optional params in url in django python
i have 2 type of URL crud/app and other is crud/app/2 here you can see id can be optional, so how to apply this type of URL pattern, here i have added my code, app_name = 'crud' urlpatterns = [ path('',views.index, name='index'), path('add/<:id>',views.add, name='add'), ] -
ValueError when upgrading from Django 1.8 to 1.9
I have recently upgraded a project to 1.9 from 1.8.11, Everything worked fine on 1.8 and I have worked through the deprecation warnings and cleaned a lot of things up within the project. When I try to run the project I get an error ValueError: Cannot create form field for 'country' yet, because its related model 'Country' has not been loaded yet I have been trying to figure this out for a few hours now and would really appreciate some help I have looked through the upgrading instruction on the Django website, upgraded some dependencies which fixed one or two warnings but still not fixed the Issue. class Country(TimeStampedModel): name = models.CharField(max_length=50, unique=True) code = models.CharField(max_length=2, null=True, blank=True, db_index=True) code3 = models.CharField(max_length=3, null=True, blank=True, unique=True) last_updated_by = models.ForeignKey(User, null=True, blank=True, related_name='%(class)s_last_updated_by') created_by = models.ForeignKey(User, default=settings.SYSTEM_USER_ID, related_name='%(class)s_created_by') objects = models.Manager() countries = CountryManager() class Meta: verbose_name = _('country') verbose_name_plural = _('countries') ordering = ['name'] def __str__(self): return self.name -
Django custom user shows in different group in Django adminstrator site
I have created a custom user model extending django's default AbstractUser. I have registered it by admin.site.register(User, UserAdmin). It's working but, customized Users model is shown separately, not with AUTHENTICATION AND AUTHORIZATION tab as in the screenshot. How can I make Users and Groups in the same tab again? Just curious. -
can't display data from database on template
I'm a beginner in django and my problem is : I already have data in my database, but I can't display it on my template. I tried multiples times to change my view's function and the template language but nothing works for me in views.py def my_financial_data(request): mydata = DataItem.objects.all() print(mydata) return render(request, 'home.html', {'mydata': mydata}) in models.py class DataItem(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=100, default='') lastprice = models.CharField(max_length=100, default='') sinceclose = models.CharField(max_length=100, default='') sinceopen = models.CharField(max_length=100, default='') isin = models.CharField(max_length=100, default='') place = models.CharField(max_length=100, default='') in my template <div> <table class="table"> <thead class="bg-dark"> <tr> <th class="text-light">Name</th> <th class="text-light">Last Price</th> <th class="text-light">Change since Close</th> <th class="text-light">Change since Open</th> <th class="text-light">Isin</th> </tr> </thead> <tbody> {% for item in mydata %} <tr> <td class="text-primary"> {{item.name}} </td> <td class="text-dark"> {{ item.lastprice }} </td> <td class="text-dark"> {{ item.sinceclose }} </td> <td class="text-dark"> {{ item.sinceopen }} </td> <td class="text-dark"> {{ item.isin }} </td> </tr> {% endfor %} </tbody> </table> </div> What I want is, when I open my site, the data saved is displayed. Thank you very much for your help ^^