Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Docker with Django - What are the best practices?
What are the things to keep in mind when using docker for production for an app written in Django ? Can someone point me toward any examples of the same ? Thanks -
onclick auto executing in djnago template
I'm having a little trouble with my python/django web app. I'm trying to be able to enable and disable something in the admin area so that in the front end will either show it or not. Once the link is clicked I want the function called updatevisibilitymain to execute with passing in the main.id. The issue is it auto fires on page loads along with if you click one link all three fire and update each main item respectively according to the main.id. I only want one link to fire at a time along with not having it auto fire on a page load. My issue is my link. <a href="" id="{{main.id}}" onclick="{% updatevisiblitymain main.id %}" class="toggler"><i class="{% isvisible main.is_visible %}" aria-hidden="true"></i></a> When I load the page the onclick its auto called and disables and or enables every page load. On top of that I have two more links for that are similar as they are created in a for loop. And if I click any of the three they all will execute and either disable or enable the object. Any one have any ideas on how to fix this? I've tried putting a # inside the href area and β¦ -
Unexplainable 500 Internal Server error running Django App service
Here are the steps I followed to set it up. I created a boilerplate Django app service on the Azure portal. It worked perfectly and a blank django app appeared at the URL of my app service. I then copied all of the following configuration files from their boilerplate: https://github.com/azureappserviceoss/DjangoAzure .skipPythonDeployment azuredeploy.json ptvs_virtualenv_proxy.py web.config (modified this to point to my actual project settings and wsgi) web.debug.config After pushing these config files to my own django project, I setup the App service on azure to point to my github repository instead of their boilerplate repository which I linked to above. It was successful in setting up continuous deployment and fetching/building the repository. My app page now shows nothing but the text: The page cannot be displayed because an internal server error has occurred. The application log stream returns the following: <div id="content"> <div class="content-container"> <h3>HTTP Error 500.0 - Internal Server Error</h3> <h4>The page cannot be displayed because an internal server error has occurred.</h4> </div> <div class="content-container"> <fieldset><h4>Most likely causes:</h4> <ul> <li>IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was β¦ -
Don't reload the view Django
I'm doing a set of questions, every question is answered with yes or no. Depends of answer will be other different question and this process would be repeat several times. The problem is that every time that the user sends the answer the view is reloaded and always show the first question. I'm new in Django and web programming. Thanks for your answers. class ExpertoView(FormView): template_name = "SisExperto.html" form_class = FormExpert success_url = 'SisExperto' def __init__(self): self.arbol = eval(self.fileToStr('SisExperto/enfermedades.txt')) #evalua el archivo self.Nodoactual = self.arbol self.pregunta = self.Nodoactual[0] def form_valid(self, form): #This method is calle when valid for data has been POSTED #It should return an HttpResponse if len(self.Nodoactual) == 3: [self.pregunta, yesNode, noNode] = self.Nodoactual if form.is_valid(): form_data = form.cleaned_data respuesta = form_data.get('campo') if respuesta == 'y': self.Nodoactual = yesNode else: self.Nodoactual = noNode self.pregunta = self.Nodoactual[0] #el siguiente return es obligatorio return super(ExpertoView, self).form_valid(form) def get_context_data(self, **kargs): """ Use this to add extra context """ context = super(ExpertoView, self).get_context_data(**kargs) context["pregunta"] = self.pregunta return context -
Django - Optimizing displaying each group of rows that sums to a specific amount
I am looking for the optimal solution to the following problem: Let's say you have a group of people, each spending different amounts of money on different transactions. Transactions are stores in the following table: class Transactions(models.Model): amount = DecimalField(max_digits=12, decimal_places=2) created_on = DateField(auto_now_add=True) t_person = ForeignKey('Person') Given a specific date, I would like to find each person that spends over a certain amount in the 30 days following that date. More specifically, I would like to return a list of each transaction a user made, grouped by user, along with the total amount that they spent. Here is my first attempt: def get_transaction(amount, month_start, month_end): total_transactions = Transaction.objects.filter(created_on__gte=month_start, created_on__lte=month_end) distinct_people = total_transactions.distinct('t_person').values('t_person') amounts = [] query = [] for p in distinct_people: transactions = total_transactions.filter(t_person=p['t_person']) p_sum = transactions.aggregate(Sum('amount')) if p_sum['amount__sum'] >= float(amount): amounts.append(p_sum['amount__sum']) query.append(transactions) return zip(amounts, query) This works fine for now, but my fear is that this is an inefficient way to accomplish something that can hopefully be done simpler. Is there an easier way to get this done? -
[Django]Check if e-mail already exists while using Google+ Auth (Python-Social-Auth)
I am using python-social-auth to register my website users. My own login system can be done using the username or the e-mail. The is that my code is accepting two similar e-mails. Ex: Jonh register: username; John123 email: foo@gmail.com Paul register using his gmail foo@gmail.com In my DB I will end up heving two e-mails (which I allow them to login using it), besides other problems it can generate. So, how can I check if the e-mail already exists when the user login/register through goolgle+ api? Thanks -
Error when i send HTML mail template on Django
I am trying to send email using a template HTML on Django, but i having a problem with encode error My code # -*- coding: utf-8 -*- from django.core.mail import EmailMultiAlternatives from django.template.loader import get_template from django.template import Context d = Context({'nome' : 'Gerento'}) htmly = get_template('teste_template.html') html_content = htmly.render(d) msg = EmailMultiAlternatives('dhfusafi', 'teste', 'no-reply@teste.com', ['guilherme@teste.com']) msg.attach_alternative(html_content, 'html/text') msg.send() When i run it, i get it: Traceback (most recent call last): File "<console>", line 1, in <module> File "teste.py", line 12, in <module> msg.send() File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/core/mail/message.py", line 292, in send return self.get_connection(fail_silently).send_messages([self]) File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 107, in send_messages sent = self._send(message) File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 121, in _send message = email_message.message() File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/core/mail/message.py", line 256, in message msg = self._create_message(msg) File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/core/mail/message.py", line 444, in _create_message return self._create_attachments(self._create_alternatives(msg)) File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/core/mail/message.py", line 454, in _create_alternatives msg.attach(self._create_mime_attachment(*alternative)) File "/home/guilherme/.virtualenvs/martizi-api/local/lib/python2.7/site-packages/django/core/mail/message.py", line 387, in _create_mime_attachment Encoders.encode_base64(attachment) File "/usr/lib/python2.7/email/encoders.py", line 45, in encode_base64 encdata = _bencode(orig) File "/usr/lib/python2.7/email/encoders.py", line 32, in _bencode value = base64.encodestring(s) File "/usr/lib/python2.7/base64.py", line 315, in encodestring pieces.append(binascii.b2a_base64(chunk)) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 11: ordinal not in range(128) I did a simple test: i change my template html with a lot style to a simple html, just a β¦ -
Django core exception on Celery worker run
Django version 1.9.7. My current project structure is: vehicles/ βββ etl β βββ etl β βββ manage.py β βββ pipeline β βββ bku βββ web βββ db.sqlite3 βββ manage.py βββ profiles βββ projects βββ reverse βββ static βββ templates βββ bku β βββ admin.py β βββ admin.pyc β βββ apps.py β βββ migrations β βββ models.py β βββ static β βββ templates β βββ tests.py β βββ urls.py β βββ views.py β βββ views.pyc βββ rocket βββ celery.py βββ __init__.py βββ settings β βββ base.py β βββ dev.py β βββ __init__.py β βββ local.py β βββ production.py β βββ test.py βββ urls.py βββ wsgi.py Now I want to use Celery in the bku Django app. But when I run the worker celery -A rocket worker -l info I get the following error django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.. I have multiple settings files and I didn't have this error before trying Celery. How can I run the worker? rocket/celery.py from __future__ import absolute_import, unicode_literals import os from celery import Celery os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'rocket.settings') app = Celery('rocket') app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks() @app.task(bind=True) def debug_task(self): print('Request: {0!r}'.format(self.request)) rocket/init.py from __future__ import absolute_import, unicode_literals from .celery import app as celery_app __all__ = ['bku'] -
Django - Filter objects for form
I am making a registration form but I don't know how to filter my objects right. I am logged in as a user and I have created a team that is associated to my user-account by the foreignkey. The fighters have a foreignkey too and they are associated to the owners team. Maybe a bit overdone. So when I write my view, I want to see only "my fighters" and not the fighters of another user's account. Can you please help me. models.py class Event(models.Model): """An event, where the users can register fighters.""" name = models.CharField(max_length=50) # ... owner = models.ForeignKey(User) class Team(models.Model): name = models.CharField(max_length=30) # ... owner = models.ForeignKey(User) class WeightClass(models.Model): name = models.CharField(max_length=30) weight = models.IntegerField() class Fighter(models.Model): team = models.ForeignKey(Team) first_name = models.CharField(max_length=30) # ... owner = models.ForeignKey(User) class Registration(models.Model): event = models.ForeignKey(Event) fighter = models.ForeignKey(Fighter) weightclass = models.ForeignKey(WeightClass) date_added = models.DateTimeField(auto_now_add=True) owner = models.ForeignKey(User) forms.py class RegistrationForm(forms.ModelForm): class Meta: model = Registration fields = ['fighter', 'weightclass'] labels = {'fighter': 'KΓ€mpfer', 'weightclass': 'GWK'} views.py @login_required def registration_new(request, event_id): """Add a new registration for an event.""" event = Event.objects.get(id=event_id) fighters = Team.objects.get(owner=request.user) # <=== DOES NOT WORK if request.method != 'POST': # No data submitted; create a β¦ -
Django startproject doesn't create folder in virtualenv
I'm following the tutorial at http://djangobook.com/installing-django/ to setup Django. I created a new virtualenv and installed Django in it. I activate it through: source env_mysite/bin/activate After this I see (env_mysite) before my computer name in my terminal. Then I run django-admin startproject mysite And here the tutorial says: This will create a mysite directory in your current directory (in this case \env_mysite). But my folder get created in my user root folder, not in my env_mysite folder. Why this is happening? -
Django - create form fields array
I need to have an array of form fields in Django. This is my form class: class ReportNewForm(forms.Form): monitors_website = Site24MonitorInfo.many( And(Q.state == 0, Q.type == 'URL'), sort=[('display_name', ASC)] ) MONITORS_CHOICE = [] for monitor in monitors_website: MONITORS_CHOICE.append((monitor['_id'], monitor['display_name'])) website_site24_monitors = forms.ChoiceField( label='Site24x7 Monitor', choices=MONITORS_CHOICE, widget=forms.Select( attrs={ 'class': 'form-control', 'id': 'website_site24_monitors[]', 'name': 'website_site24_monitors[]', 'data-parsley-required': "true", 'data-parsley-required-message': "This field is required." } ) ) This is my template <fieldset> <legend>Websites</legend> <div class="input_fields_wrap"> <button class="btn btn-success add_field_button">Add More Websites</button> <fieldset> <label>Website 1</label> <div class="form-group"> <label class="control-label" for="{{ form_report_new.website_site24_monitors.id_for_label }}">{{ form_report_new.website_site24_monitors.label_tag }}</label> {{ form_report_new.website_site24_monitors }} </div> <div class="form-group"> <label class="control-label" for="{{ form_report_new.website_site24_analyzers.id_for_label }}">{{ form_report_new.website_site24_analyzers.label_tag }}</label> {{ form_report_new.website_site24_analyzers }} </div> <div class="form-group"> <label class="control-label" for="{{ form_report_new.website_ssllabs.id_for_label }}">{{ form_report_new.website_ssllabs.label_tag }}</label> {{ form_report_new.website_ssllabs }} </div> </fieldset> </div> </fieldset> And this is the associated js block <script type="text/javascript"> $(document).ready(function() { var max_fields = 7; //maximum input boxes allowed var wrapper = $(".input_fields_wrap"); //Fields wrapper var add_button = $(".add_field_button"); //Add button ID var x = 1; //initlal text box count $(add_button).click(function(e){ //on add input button click e.preventDefault(); if(x < max_fields){ //max input box allowed x++; //text box increment $(wrapper).append( '<div id="webserver-' + x + '" class="webserver-' + x + '">' + `<fieldset> <label>Website ` + x + `</label> β¦ -
Django Ldap : AUTH_LDAP_USER_FLAGS_BY_GROUP
AUTH_LDAP_USER_FLAGS_BY_GROUP = { "is_u_in_dev": "CN=G_QT1_DEV, OU=FileAccess, OU=Groups, DC=ab, DC=cd, DC=net", "is_u_in_uat": "CN=G_QT1_UAT, OU=FileAccess, OU=Groups, DC=ab, DC=cd, DC=ef", "is_u_in_prod": "CN=G_QT1_PROD, OU=FileAccess, OU=Groups, DC=ab, DC=cd, DC=ef" } I am trying use the above flags in views.py, But unable to find a way? if user.is_u_in_dev == True : print("found in dev group") -
How to set dynamic path links to a file in django
I working in a project that User (customer) can login and can view information about his invoices, download them ( in Pdf format ) etc. When user setted up in admin panel, his pdf files is uploaded ( User can have many Pdf files ) When Pdfs is uploaded a function create folders based on his id, and put them in, so i have to create a dynamicaly function that downloads the correct pdf file. This is my Download Function: def DownloadPdf(request): with open(os.path.join(settings.MEDIA_ROOT, 'user_3/Invoice_343.pdf'), 'rb') as fh: response = HttpResponse(fh.read(), content_type="application/pdf") response['Content-Disposition'] = 'filename=invoice.pdf' return response Even i try to create a function that sets the path dynamicaly and converting it to a string django tells me that expects a string and not a function. Is there any possible way to hadle dynamicaly the path with a function? Thnx in advance guys. -
jquery audio.js still creating more than 1 player
i've got a Problem. I want to add my music Source which i get from my database ( Soundcloud Music srces) to the audiojs player. But everytime i'm clicking on my Link button it creates 1 more Audioplayer into the Audioplayer. My Code: `function get_song(url, title, img_url) { $("#audio_url").attr("src", url); $("#song_img").attr("src", img_url); $('#song_title').text(title); console.log(img_url); var a = audiojs.createAll(); var audio = a[0]; this.preventDefault(); $(this).addClass('playing').siblings().removeClass('playing'); audio.load($('a', this).attr('data-src')); audio.play(); removeClass('#audiojs'); } ` This is my CODE IN MY JS FILE AND THIS IS HOW I CHANGE SRC: </div> <form method="post"> {% csrf_token %} <div class="songs_list"> <ul> {% for songs in playlist_songs %} <li class="list_settings"> <a onclick="get_song('{{ songs.url }}', '{{ songs.title }}', '{{ songs.song_image_url }}')" class="song_set">{{ songs.title }}</a> <button name="delete_song" value="{{ songs.id }}" class="btn_delete"><i class="fa fa-trash" aria-hidden="true"></i></button></li> {% endfor %} </ul> </div> </form> </div> <!-- AUDIO_PLAYER --> <audio > <source id="audio_url" src=""> </audio>` -
Django Rest framework pagination performance issue
I have a view that inherits from ListAPIView and displays a list of objects. For performance reasons, i am trying to implement pagination. So : from rest_framework.pagination import PageNumberPagination class LargeResultsSetPagination(PageNumberPagination): page_size = 2 page_size_query_param = 'page_size' max_page_size = 2 class RaceEventListView(CallSerializerEagerLoadingMixin, ListAPIView): serializer_class = RaceEventListSerializer queryset = RaceEvent.objects.all() pagination_class = LargeResultsSetPagination Following documentation http://www.django-rest-framework.org/api-guide/pagination/ Without pagination only one query is made. The Select * from raceevent With pagination two queries are made. The Select * from raceevent and the Select * from raceevent LIMIT 2 . As a result, I could not achieve better performance. What should i do, in order to limit to 1 the queries when using pagination -
Python Django- get or post?
I have a Django project, and on one of the webpages, I want to collect some information for a project. One of the fields has a drop down list, from which the user can select the name of a member of the team involved in the project. This drop down list has a number of pre-defined choices, and also gives the option to select 'Other'. If the user selects 'other', the 'drop down list' field changes to a 'text box', and the user can type in the name of the person they want to select. As they start typing, the database is queried based on the letters that they have typed so far, and a list of the available options (matching the letters typed) is displayed below the text box. For example, if the user had typed "D", the list of available options that would be displayed might include: 'Dan', 'Dave', 'Debbie', but if they had typed "Da", the list of available options that would be displayed would only include: 'Dan'& 'Dave'. When the user first loads this page on a project, the 'name' field is empty. When I start typing in that field, and select an option from the β¦ -
SB Admin 2 Sidebar Not collapsing
Ok so I am trying to load sb-admin-2 and the menu is not collapsing, I browsed for some solutions and none of them work for me, also as you can see the data-table is not working too and my tags looks like this: <script type="text/javascript" src="{{STATIC_URL}}/static/lib/angular.min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/bootstrap.min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/angular-resource.min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/angular-ui-router.min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/angular-animate.min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/angular-messages.min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/angular-ui-validate.min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/angular-cookies.min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/ng-file-upload-shim.min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/ng-file-upload.min.js"></script> <!--SB ADMIN FILES--> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/metisMenu.min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/jquery.dataTables.min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/dataTables.bootstrap.min.js"></script> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/dataTables.responsive.js"></script> <script type="text/javascript" src="{{STATIC_URL}}/static/lib/sb-admin-2.min.js"></script> can you help me out guys. ps: I am loading sb-admin through angularjs and django -
Django : NameError at /approved/filter/7/ - name 'testElement' is not defined
I am new to Django and I am trying to send a different context variable depending on which if statement is satisfied. This is my view: class FilterSearch(View): template_name = 'approved/approvedElementsSEView.html' def post(self,request,testPlanId): elemType = request.POST.get('testElementType'); elemCategory = request.POST.get('category'); if(elemCategory=='routing'): global testElement; testElement=ApprovedTestElement.objects.filter(testElementType=elemType, routing='y'); return testElement elif(elemCategory=='switching'): global testElement; testElement = ApprovedTestElement.objects.filter(testElementType=elemType, switching='y'); return testElement return render(request,self.template_name,{'testElement':testElement,'testPlanId':testPlanId}) I was initially getting an UnboundLocalError:local variable 'testElement' referenced before assignment , which I tried fixing by defining testElement as a global variable, Now I am getting a NameError: name 'testElement' is not defined. Any Help will be greatly appreciated! -
Error loading MySQLdb module: /usr/lib64/libperconaserverclient.so.18: version `libperconaserverclient_16' not found
I'm suddenly getting the following error on my hosted Django website: django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: /usr/lib64/libperconaserverclient.so.18: version `libperconaserverclient_16' not found (required by /home1/reconess/python/lib/python2.7/site-packages/_mysql.so) The site was working fine last week, then this week (with no changes made by us), we're getting that error. I'm thinking it might be a change to the MySQL setup done by the host (perhaps some update to Percona?), but given that I have very little idea of what Percona is, let alone how Django, MySQL, and Percona interact I'm having some problems figuring out what's gone wrong and how to fix it. The file /usr/lib64/libperconaserverclient.so.18 definitely exists. Thanks for any help. -
How to generate unique filename for django model.FileField
I am working on a django/python project. This project use a model that contains a FileField. This model is feeded by a web formular. Everything works great: Django automatically renames the file if an existing file with the same name already exists. I have a second Model that also contains a FileField. But this file is not uploaded via a web form. This file content is generated on the file by a python program. What i want to do is provide a file name when inserting it. And i want django/python to rename automatically as it does no the web form. How should i do ? Thanks -
Django Query to find number of rows with a certain value greater than zero, grouped by user
I have a dataset such that each user has an integer as a score for each date in a certain date range. I want to find for each user, the number of days on which he/she had a greater than zero score - so, I want to group by user and count number of scores greater than zero for each user. How do I write such a query in Django 1.10? -
Sequelize MySql Insert: Node js vs Django
DB inserts from Sequelize take minimum thrice the time as compared to inserts by Django. Sometimes node is around 20x slower than python. (According to newrelic) The SQL fired by Django: Time ~2ms INSERT INTO `table` (`created_on`, `updated_on`, `field2`, `field3`, `field1`, `field4`, `field5`, `field6`, `field7`, `fiedl8`) VALUES ('2016-11-03 14:52:31', '2016-11-03 14:52:31', NULL, NULL, 100617299, '68.00', '75.00', '75.00', 0, '1.00') The SQL fired by Node: Time ~6ms INSERT INTO `table` (`id`,`field`,`field2`,`field3`,`field4`,`field5`,`field6`,`field7`,`field8`) VALUES (DEFAULT,'68.00','75.00','75.00',0,1,'2016-11-03 09:46:05','2016-11-03 09:46:05',100617299) I have tried increasing the number of number of connection from Node but it did not help. -
Getting Data from Database Imports not working
I am trying to set up a script that will run every half house or so to sort jobs out into priority's. #from jobs.models import Jobs #from django.db import models #from jobs.states import RepairStates # Get jobs # Get models # Get states Job_set = Jobs.objects.filter(status="invoiced") for jobs in Job_set: print(jobs.status) print("Hello") # Loop through all jobs that do not have a status of "invoiced" # Calculate how many days until Due date / How many days past due date # Check what state the job is in and add or take away points depending on state # return points # Quote Accepted = - 2 # Assigned engineer = -1 # request components = 0 # order fulfilled = 1 # test + 2 # Completed + 3 # for dispatch + 4 # COMPLETED + 100 #Do this every half hour, hour. I have fallen at the first hurdle i cant seem to import the table data i need i have tried many times using different locations but it doesn't seem to work. My directory is something like this twm-- other files(not important) twm-- accounts api component customer engineering goods jobs personal so on.... Now the model is β¦ -
Data Aggregation in Django Model
This is the model concerned: class Order(models.Model): guest = models.ForeignKey('hotel.Guest', on_delete=models.CASCADE) date = models.DateField(auto_now_add=True) amount = models.IntegerField() item = models.ForeignKey('hotel.Item', on_delete=models.CASCADE) price = models.IntegerField(default=1) is_paid = models.BooleanField(default=False) paid_date = models.DateField(blank=True, null=True) My current view returns a list for a specific guest of all unpaid orders: open_orders = Order.objects.filter(guest = guest, is_paid=False). I would now like to aggregate amount and price per item and date for this list in a new list... -
Call method in template without rendering a new page
I wonder if it is possible to call a method in django template without rendering a new page. What I need is to obtain a value from the current html page (myapp/current_page) and run a script from my view using this value. This script must reload the same page (myapp/current_page). Unfortunately, the only way I've found to call a method in my template was this: templates.py <a href="{% url 'myapp:mymethod' value=value %}" class="btn btn-primary">Call my method</a> And, by doing this, I'm redirect to (myapp/mymthod/value)'s template from (myapp/current_page. This, however, makes no sense to my application. The user must not access a page myapp/mymethod/value. I must, instead, reload the current page so that the user never sees what actions my application is doing behind the current page.