Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
CSV import into empty Django database with foreign key field
I'm a little new to this, and figuring it out as I go. So far so good, however I have having trouble importing a field that has a foreign key. I have about 10,000 rows in a csv file that I want to add to the database. As you can imagine, entering 10,000 items at a time is too labour intensive. When I try for an import I get this error: ValueError: invalid literal for int() with base 10 This is because (i think) it is trying to match the related model with the id. However the database is empty, so there is no id, and furthermore, the "author" field in my csv (the one with the foreign key) doesn't have an id yet. ( i assume this is created when the record is). Any suggestions? Sorry in advance for the newbie question. -
How can I access request object in the wagtail Page model?
I wanna dynamically set default value of the field to the currently logged in user: class SimplePage(Page): author = models.CharField(max_length=255, default=request.user) I know about get_context, but class attributes cannot call instance methods. def get_context(self, request, *args, **kwargs): return { PAGE_TEMPLATE_VAR: self, 'self': self, 'request': request, } Any more ideas? Essentially whoever is logged in into the admin should be added to the author field. -
Django Image kit/boto/django-stroages - s3 forbidden for ImageKit files
im using s3 as my backend for media files and am receiving the below error, Im not sure I this an issue with imagekti, boto, or Django storages? I am running the below versions: boto==2.48.0 boto3==1.5.22 botocore==1.8.36 django-storages==1.6.5 django-imagekit==4.0.2 pilkit==2.0 Pillow==5.0.0 im not sure how to troubleshoot this as im not sure which component could be failing? this is in my dev env, my live envoirment works and is using the following versions: boto==2.48.0 boto3==1.4.7 botocore==1.7.35 django-storages==1.6.5 django-imagekit==4.0.1 pilkit==2.0 Pillow==4.3.0 settings.py AWS_ACCESS_KEY_ID = os.environ['AWS_LIVE_KEY_ID'] AWS_SECRET_ACCESS_KEY = os.environ['AWS_LIVE_KEY_PASS'] AWS_DEFAULT_ACL = 'private' # Tell django-storages that when coming up with the URL for an item in S3 storage, keep # it simple - just use this domain plus the path. (If this isn't set, things get complicated). # This controls how the `static` template tag from `staticfiles` gets expanded, if you're using it. # We also use it in the next setting. AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME STATICFILES_LOCATION = 'static' STATICFILES_STORAGE = 'itapp.functions.StaticStorage' STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION) MEDIAFILES_LOCATION = 'media' MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION) DEFAULT_FILE_STORAGE = 'itapp.functions.MediaStorage' DOCUMENT_ROOT = '/documents/' LOGIN_REDIRECT_URL = '/' LOGIN_URL = '/login/' THUMBNAIL_ALIASES = { '': { 'thumb': {'size': (200, 150), 'crop': True}, }, … -
Django 2.0 Static Files not recognized in Apache2
My website is online, but it can't find the static files ;/ The configurations seem to be all ok, can't find the error... I don't have admin permission on the server, so it kind'a sucks.. but, at least they pass me the configurations they've put.. Apache Configuration: <VirtualHost *> ServerAdmin suporte@pop-rs.rnp.br DocumentRoot /home/metis/public_html/ ServerName agata.pgie.ufrgs.br ServerAlias www.agata.pgie.ufrgs.br #ErrorLog /var/log/apache2/agata-error.log #CustomLog /var/log/apache2/agata-access.log common <Directory /home/metis/public_html/static> Require all granted </Directory> <Directory /home/metis/public_html/AGATA/textMiningProject> <Files wsgi.py> Require all granted </Files> </Directory> WSGIDaemonProcess agata python-path=/home/metis/public_html/AGATA python-home=/home/metis/public_html/AGATA/agataenv WSGIProcessGroup agata WSGIScriptAlias / /home/metis/public_html/AGATA/textMiningProject/wsgi.py </VirtualHost> Django Version: 2.0 settings.py Static files (CSS, JavaScript, Images) https://docs.djangoproject.com/en/1.11/howto/static-files/ STATIC_PATH = os.path.join(BASE_DIR,'static') STATIC_URL = '/static/' # You may find this is already defined as such. STATIC_ROOT = '/home/metis/public_html/static' STATICFILES_DIRS = [ STATIC_PATH ] MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' And it was asked to the admins to insert the following, no changes in the result tho.. Alias /media/ /products/static Alias /static/ /products/static <Directory /products/static> Order allow,deny Allow from all </Directory> can someone help? -
Django: How do I do order_by for this model and is all() efficient for this query?
New to Django. I have these models: class ClinicDoctor(models.Model): doctor = models.ForeignKey('User', related_name='doctorsF') clinic = models.ForeignKey(Clinic, related_name='clinicsF') class Day(models.Model): day = models.CharField(max_length=20) class Shift(models.Model): shift = models.CharField(max_length=20) days = models.ManyToManyField(Day, through='DayShift', related_name='to_day_shift') class DayShift(models.Model): time = models.TimeField() day = models.ForeignKey(Day, related_name='to_day') shift = models.ForeignKey(Shift, related_name='to_shift') clinics_doctors = models.ManyToManyField(ClinicDoctor, through='ClinicDoctorDayShift', related_name='clinicDoctor_dayShift') class ClinicDoctorDayShift(models.Model): clinic_doctor = models.ForeignKey(ClinicDoctor, related_name='to_clinicDoctor') day_shift = models.ForeignKey(DayShift, related_name='to_dayShift') How do I order_by this query visitingQuerySet = ClinicDoctor.objects.filter(doctor_id = doctor_id).prefetch_related('clinicDoctor_dayShift').order_by('doctor__full_name', 'clinic__name') by day in the Day model and shift in Shift model. name and full_name are working but can't get it to work with others. I tried few variations but none works. Another question related to that `querySet' after that query I have this piece of code after it. for vqs in visitingQuerySet: for ab in vqs.clinicDoctor_dayShift.all(): Is that query with all() working on prefetched data or it is making new request to to DB? Is it efficient? Thank you -
How to use Django reverse in tests?
I don't know how to use the reverse function in django.I am getting this, ValueError: dictionary update sequence element #0 has length 1; 2 is required I could hardcode the urls directly that worked fine, but i wanted to do it in standard way. main urls.py urlpatterns = [ url(r'^nmailadmin/', admin.site.urls), url(r'^api/v1/',include('Core.Login.urls',namespace='login')), url(r'^api/v1/mail/',include('Core.Mail.urls',namespace='mail')), ] I have given namespace for login and mail API. When I try to access mail urls like this def test_0list_folders(self): url = reverse('mail:folder_list', kwargs={'server':0}) response = self.client.get('/api/v1/mail/folder_list/0/', follow=True) self.assertEqual(status.HTTP_200_OK, response.status_code) I am getting error like this. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/next/PycharmProjects/Nmail/Nmail-Server/Core/Mail/tests.py", line 25, in test_0list_folders print(":::::::::::::::::::::: ", reverse('mail:auth_login')) File "/home/next/venv/NmailVenv/lib/python3.6/site-packages/django/urls/base.py", line 91, in reverse return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))) File "/home/next/venv/NmailVenv/lib/python3.6/site-packages/django/urls/resolvers.py", line 436, in _reverse_with_prefix self._populate() Preserving test database for alias 'default'... File "/home/next/venv/NmailVenv/lib/python3.6/site-packages/django/urls/resolvers.py", line 309, in _populate dict(defaults, **pattern.default_kwargs), ValueError: dictionary update sequence element #0 has length 1; 2 is required ---------------------------------------------------------------------- This is my urls file of mail app. urlpatterns = [ url(r'folder_list/(?P<server>\d+)/$', folder_list,name='folder_list'), ] -
Django 1.11 TinyMCE attrs, how correct change attrs cols and rows?
how fix cols and rows in HTMLField from TinyMCE package ? class ProjectCat(models.Model): title = models.CharField(max_length=30, unique=True, verbose_name='название') slug = models.SlugField(unique=True) desc = HTMLField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}), verbose_name='описание') -
Django can't find a specific static file
I'm getting a 404 when trying to load 'irpf.jpg' which is in the same folder as 'jumbotron.jpg'. Other files are served normally as well, just the 'irpf' can't be found at all. Tried to run collectstatic but it says that no changes where detected. Any ideas? Thanks, The first one loads, the second don't static files structure <div class="col"> <img src="{% static 'appStaticSite/jumbotron.jpg' %}" alt="Imposto de Renda"> <img src="{% static 'appStaticSite/irpf.jpg' %}" alt="Imposto de Renda"> </div> </div> -
How to filter joined models in Django?
I have the following models: class Street(models.Model): name = models.CharField(max_length=40) class House(models.Model): street = models.ForeignKey(Street, models.PROTECT) number = models.CharField(max_length=10) class Meta: unique_together = ('street', 'number') class Room(models.Model): house = models.ForeignKey(House, models.PROTECT) number = models.CharField(max_length=10) class Meta: unique_together = ('house', 'number') I already know the ID of a Street and would like to get all the rooms of all the houses in that street. In SQL that is easy: SELECT * FROM room JOIN house ON house.id = room.house_id WHERE house.street_id = xyz; Now how do I do this in Django? I tried Room.objects.select_related('house').filter(street=xyz) But I get an exception saying I can't access this field: django.core.exceptions.FieldError: Cannot resolve keyword 'street' into field. Choices are: house, house_id, id, number Because of the amounts of data I am facing, I would really like to be able to join and filter using a single query! When giving up one or the other, I would have to resort to either making multiple queries or filtering in Python, both of which are inherently inefficient. An alternative would be raw queries, I guess... -
How to save url of the image in database with Django
i am new in Django, how to save url of the image in db using django. Thank you very much, sorry my english, i am learning too. views.py from django.shortcuts import render from django.views.decorators.http import require_POST from .models import Cad_component from django import forms from django.views.decorators.http import require_http_methods class register_data(forms.ModelForm): class Meta: model = Cad_component fields = ('title','slug','description','start_date','imagviewe') def home(request): imagesData = Cad_component.objects.all() template_name = 'index.html' context = { 'imagesData': imagesData } return render(request, template_name, context) def register(request): if request.method == "POST": form = register_data(request.POST) print (form) if form.is_valid(): datas = form.save(commit=True) #datas.image.save(request.read['title'],request.read['image']) datas.save() else: form = register_data() return render(request, 'register.html', {'form': form}) models.py from django.db import models import datetime class ComponentManager(models.Manager): def search(self, query): return self.get_queryset().filter( models.Q(name__icontains=query) | \ models.Q(description__icontains=query) ) class Cad_component(models.Model): title = models.CharField('Title', max_length=100) slug = models.SlugField('Link') description = models.TextField('Description', blank=True) start_date = models.DateField('Data: ', null=True, blank=True) image = models.ImageField(upload_to='img', verbose_name='Imagem', null=True, blank=True) created_at = models.DateTimeField('Criado em ', auto_now_add=True) updated_at = models.DateTimeField('Atualizado em', auto_now=True) objects = ComponentManager() def __str__(self): return self.title -
How can i see what is in the cart ? Django
I can't display the cart items. In the previous project i used django 1.8 and that code and all worked . But now i use django 2.0 and i don't know is that i made a mistake somewhere or it is something new in django. Cart.py in cart app from decimal import Decimal from django.conf import settings from shop.models import Product class Cart(object): def __init__(self, request): self.session = request.session cart = self.session.get(settings.CART_SESSION_ID) if not cart: cart = self.session[settings.CART_SESSION_ID] = {} self.cart = cart def add(self, product, quantity=1, update_quantity=False): product_id = str(product.id) if product_id not in self.cart: self.cart[product_id] = {"quantity": 0, "price": str(product.price)} if update_quantity: self.cart[product_id]["quantity"] += quantity self.save() def save(self): self.session[settings.CART_SESSION_ID] = self.cart self.session.modified = True def remove(self, product): product_id = str(product.id) if product_id in self.cart: del self.cart[product_id] self.save() def __iter__(self): product_ids = self.cart.keys() products = Product.objects.filter(id__in=product_ids) for product in products: self.cart[str(product.id)]["product"] = product for item in self.cart.values(): item["price"] = Decimal(item["price"]) item["total_price"] = item["price"] * item["quantity"] yield item def __len__(self): return sum(item["quantity"] for item in self.cart.values()) def get_total_price(self): return sum(Decimal(item["price"]) * item["quantity"] for item in self.cart.values()) def clear(self): del self.session[settings.CART_SESSION_ID] self.session.modified = True views.py from django.shortcuts import render, redirect, get_object_or_404 from django.views.decorators.http import require_POST from shop.models import Product from .cart … -
Checkbox linked to a ManyToManyField - Django
I'm working on a blog project with Django. This blog has Users and Articles among others. For a customisation of type 'this-user-likes-this-article' a ManyToManyField seems a good choice, i.e. class UserProfileInfo(models.Model): user = models.OneToOneField(User, on_delete=models.PROTECT) # additional user_favorites = models.ManyToManyField(Article) Now I'd like to implement a form (or a checkbox) that saves or deletes this kind of pairship (add/remove an Article from user_favorites), much in the way that a user likes an answer in StackExchange (and many other similar sites). Django forms are somewhat oriented to save an instance of a particular model, so which would be the smartest way to approach this form? Is there some open code that already handles this scenario? -
Using Django admin site in other applications [duplicate]
This question already has an answer here: Django admin search/filter functionality as a page table 2 answers My goal is to develop a web-application that would retrieve data from a database and display them in a table. I'm new to the web-development, this task is not my main goal, therefore, I'd like to spend minimum efforts for it. I've chosen Django for this task. I've got familiar with its admin site from the official tutorial, and can conclude that it has all required functionality (retrieving, sorting, filtering, search). In parallel, I've installed django-tables2. It requires much more efforts, for example, writing CSS templates, while admin has all included. Is it possible to use that admin site like ordinary web app just to display data, without adding or deletion? -
Can't generate djangojs.po file - Django JavaScript translation
Following Django docs I'm trying to generate djangojs.po files to tranlate strings in JavaScript. url.py: from django.views.i18n import JavaScriptCatalog urlpatterns = [ # ... url(r'^i18n/', include('django.conf.urls.i18n')), url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'), # ... ] Template file contains: <script src="{% url 'javascript-catalog' %}"></script> <script> // ... document.write('Some string to translate') // ... </script> My file system for the project: base_dir | |_ app_dir | |_ locale | |_ pt_BR | |_ LC_MESSAGES | |_ django.mo |_ django.po Running command to generate catalogs (django.po and djangojs.po): $ python manage.py makemessages -d djangojs -l pt_BR I'd expected that djangojs.po would be generated in LC_MESSAGES subdir this file is not generated in any place, so i can't translate any string that I map in gettext() function in JavaScript code. At least in the docs the only things that we have to do is the ones that I list above. So, why djangojs.po is not being generated? PS.: djangojs.po is in python lib outside my project. If I use gettext() with some string already translated there the translation works. -
How can I use a list to create a table in html?
I am writing a django app with bootstrap and I have a table with a head in one of my pages like the one below: <table class="table table-striped table-sm table-bordered table-fixed table"> <thead class="thead-inverse table_head"> <tr class="table_head_row"> <th class="table_head_item">header 1</th> <th class="table_head_item">header 2</th> <th class="table_head_item">header 3</th> <th class="table_head_item">header 4</th> <th class="table_head_item">header 5</th> <th class="table_head_item">header 6</th> <th class="table_head_item">header 7</th> <th class="table_head_item">header 8</th> <th class="table_head_item">header 9</th> <th class="table_head_item">header 10</th> </tr> </thead> </table> I was wondering if instead of writing the same line a number of times, just use a list and a for loop. I could pass the list with the headers from the pages view, like so: <table class="table table-striped table-sm table-bordered table-fixed table"> <thead class="thead-inverse table_head"> <tr class="table_head_row"> {% for header in table_headers %} <th class="table_head_item">header</th> {% endfor %} </tr> </thead> </table> Can I do something like this just in html ? -
Django: Adding attachment to generic.DetailView
I have a existing Django App with a detailview for UserProfiles. Now our client wants to have the ability to 'download' the information of the page to a PDF. I have added a button in the HTML to trigger the 'generate-attachement' method <div class="input-group"> <button name='zip' value="True" type="submit">Get report</button> </div> I have also added a 'generate_pdf' method to the view, which is triggered by the button above. class ProfileView(ProfileMixin, generic.DetailView): template_name = 'user/profile/detail.html' def get_object(self, queryset=None): return self.context.profile_user def generate_pdf(self): from reportlab.pdfgen import canvas response = HttpResponse(content_type='application/pdf') response['pdf'] = 'attachment; filename="summary.pdf"' p = canvas.Canvas(response) p.drawString(100, 100, "Hello world.") p.showPage() p.save() print(p) return response def get_context_data(self, **kwargs): data = super(ProfileView, self).get_context_data(**kwargs) #Check if 'get attachement' button has been pressed if self.request.GET.get('zip', None): self.generate_pdf() #Code to load relevant data form a large number of models #append it to the 'data' variable . #(e.g data['group_year] = ...etc return data However, when I run this code / press the button the method / print commands are all triggered, but no attachment is returned to the browser <reportlab.pdfgen.canvas.Canvas instance at 0x112165638> [08/Feb/2018 12:30:08] "GET /user/profile/459/?zip=True HTTP/1.1" 200 41749 Yet I got most of the code from the official Django Documentation, so its not entirely clear … -
Is Django-haystack 2.6.1 compatible with Django 2.0?
My question is simple (as per title). Is the current Django-haystack compatible with the newest Django 2.0? The requirements in the docs and at PYPI suggest that it is: https://django-haystack.readthedocs.io/en/master/#requirements https://pypi.python.org/pypi/django-haystack/2.6.1 But the following user faces issues as well as I do when trying to use it with Django 2.0: Django 2.0 haystack whoosh update index, rebuild index throw error The same setup works with Django 1.11. Thanks! -
Not able to update database in Django, empty entry created for first time
I'm trying to update particular fields in database but an empty entry is created with the fields to be updated when I try to update and after that I get an error saying Duplicate entry for primary key. I'm using rno as the primary key. Here is the view.py code: class InterestsViewSet(viewsets.ModelViewSet): serializer_class = serializers.InterestsSerializer authentication_classes = (JSONWebTokenAuthentication,) permission_classes = (IsAuthenticated,) def get_queryset(self): return models.UserProfile.objects.filter(rno=self.request.user).values() def perform_update(self, serializer, *args, **kwargs): instance = self.get_queryset() instance.workshop = validated_data.get("workshop") instance.sports = validated_data.get("sports") instance.creative = validated_data.get("creative") instance.cultural = validated_data.get("cultural") instance.placement = validated_data.get("placement") instance.dance = validated_data.get("dance") instance.drama = validated_data.get("drama") instance.save() serializer = self.get_serializer(instance) serializer.is_valid(raise_exception=True) self.perform_update(serializer) return Response(serializer.data) Here is the serializers.py file: class InterestsSerializer(serializers.ModelSerializer): """A serializer for interests.""" class Meta: model = models.UserProfile fields = ('workshop', 'sports', 'creative', 'cultural', 'placement', 'dance', 'drama',) The models.py file: class UserProfile(AbstractBaseUser, PermissionsMixin): """A user profile in our system.""" rno = models.CharField(max_length=10, blank=False, primary_key=True, null=False) name = models.CharField(max_length=45, blank=True, null=True) workshop = models.BooleanField(default=True) sports = models.BooleanField(default=True) creative = models.BooleanField(default=True) cultural = models.BooleanField(default=True) placement = models.BooleanField(default=True) dance = models.BooleanField(default=True) drama = models.BooleanField(default=True) is_active = models.BooleanField(default=True) is_staff = models.BooleanField(default=False) Any help on what I'm doing wrong would be really helpful. Thanks! -
runt time pdf attachment in django 1.9
how to send attachment pdf in the mail plaintext = get_template('email/email.txt') htmly = get_template('email/invoice.html') text_content = plaintext.render(kwargs) html_content = htmly.render(kwargs) html = get_template('email/invoicepdf.html') html_content_pdf=html.render(kwargs) email = EmailMultiAlternatives(sub, text_content, to=[useremail]) email.attach("Report.pdf", generatePdf(html=html_content_pdf), "application/pdf") email.attach_alternative(html_content, "text/html") email.send() mail is sent but the body does not show on mail (attachment show) -
django: load and initialize site-wide js only once
In my django project at each page I use big external library which initialization takes few seconds (to be more precised: http server and web browser do great job to decide whether or not file should be re-send but my problem is strictly related with code initialization). Is there any way to load (initialize) js script once and use it at all pages with django application? The only idea which I have is to use only ajax (without normal httpRequest) but this is very inconvenient. Do you have any better idea? -
How can I filtering objects of a model that their foriegn keys are not null in django?
I have these two models: class Questions(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') class Choice(models.Model): question = models.ForeignKey(Question,on_delete=models.CASCADE) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0) and in views.py I want to return just 5 last questions that have choice. In other words questions without any choice don't return. my view: class IndexView(generic.ListView): template_name = 'polls/index.html' context_object_name = 'latest_question_list' def get_queryset(self): return Question.objects.filter(pub_date__lte=timezone.now()).order_by('-pub_date')[:5] What change should I apply in return statement? Sorry for my bad English. Thank you -
Users access in odoo,Sales Module
I created a new user 'demouser'. I have sales module in odoo 10, I want to restrict demouser from creating a new quotation in sales. How can i do that.? -
Django make migrations error
I am currently trying to make migrations for an app that I created in Django. My files are organised as follows: wisdompets/db.sqlite3 wisdompets/manage.py wisdompets/adoptions/__init__.py wisdompets/adoptions/admin.py wisdompets/adoptions/apps.py wisdompets/adoptions/models.py wisdompets/adoptions/tests.py wisdompets/adoptions/views.py wisdompets/adoptions/migrations/__init__.py wisdompets/wisdompets/__init__.py wisdompets/wisdompets/settings.py wisdompets/wisdompets/urls.py wisdompets/wisdompets/wsgi.py wisdompets/wisdompets/__pycache__/__init__.cpython-36.pyc wisdompets/wisdompets/__pycache__/settings.cpython-36.pyc wisdompets/wisdompets/__pycache__/urls.cpython-36.pyc wisdompets/wisdompets/__pycache__/wsgi.cpython-36.pyc Initially I tried to make migrations by typing in the following into the terminal: ('adoptions' is the app name) python3 manage.py makemigrations adoptions But it's saying that the app could not be found. So I went to settings.py and added the app under Installed_APPS by typing in the following: 'adoptions.apps.AdoptionsConfig'. Now when I go back to the terminal and type in the same commands as before, this is what came up: Anyone has idea how to fix this problem? Thanks in advance! -
Check in a View if is an upate or a create operation?
I have some operations that I do in form_valid (method on GCBV) that are repeated in multiple views. Also the operations for views that inherits from CreateView or UpdateView are very similar. So I want to create a class where I write a generic 'form_valid', and all other View inherit from that class, something like: AssocUpdateView(BaseClass, UpdateView) AssocCreateView(BaseClass, CreateView) So for create and update there is a small variation, so I need to know when I'm creating and when I'm updating in form_valid. It is possible ? -
Unable to mock a function in Python (Django)
I'm trying to mock a function used within the function I'm testing, but for some reason I'm not seeing the original function always runs, not the one I created as a mock. The code I'm testing has this type of setup: def function_being_tested(foo): ... function_i_want_to_mock(bar) ... def function_i_want_to_mock(bar) print("Inside original function") ... I've installed Mock and I've tried using unittest.mock patch Currently the test file uses this setup: import mock from django.test import TestCase def mock_function_i_want_to_mock(bar): print(bar) return True class SupportFunctionsTestCases(TestCase): @mock.patch("path.to.function.function_i_want_to_mock", mock_function_i_want_to_mock) def test_function_being_tested(self): # setup result = function_being_tested(test_foo) self.assertEqual(result, expected_result) What then happens is when I run the test, I always get: "Inside original function", not the parameter printed so it's always running the original function. I've used this exact setup before and it has worked so I'm not sure what's causing this. Probably some wrong setup... If anyone has a different way of doing this or spots some error, it would be appreciated.