Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django - struggling to do div classes set up in a Django template with a for loop
I'm wiring a Django template, but struggling to achieve Horizontal Divs with multiple Vertical Divs. For example, I have nine books to display on the screen. Ignoring the CSS part, focus on the div classes set up. I want three rows (divs), and each row (div) has three books (each book has its own div). book/views.py: class HomePageView(generic.TemplateView): template_name = 'book/home.html' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['all_books'] = Book.objects.all()[0:9] context['index'] = 1; return context book/templates/book/home.html: <div id="homePageBooks"> {% if all_books %} {% for book in all_books %} <div class="{% cycle 'row1' 'row2' 'row3' %}"> <div class="{% cycle 'book1' 'book2' 'book3' %}"> {{ book.title }} <br /> <img src="{{ book.photo.url }}" alt=" {{ book.title }} " width="140" height="180"> </div> </div> {% endfor %} {% endif %} </div> The code in home.html is not right, it's just the idea. What I want is that the first three books (all_books[0] to all_books[2]) is in row 1; the second three books (all_books[3] to all_books[5]) is in the row 2; and the last three books (all_books[6] to all_books[8]) is in row 3. The grammar in Django template is not implicit as that in Python itself, I can't (or maybe I just don't know how … -
Django Design Reusable Apps?
I am developing Django application, but still have confusion over apps design pattern, let say my application has models like follow. class Department(models.Model): name = models.CharField(max_length=255) class Student(models.Model): name = models.CharField(max_length=255) department = models.ForeignKey(Department) As u see student model has relation of department = models.ForeignKey(Department) In This case should i need to create separate apps for department and student or is it good enough to create custom_app with both department and student models ? -
Django 2 linked tables not working properly
I have been trying to link 2 tables. One for the post, and the other for the multiple images uploaded with it. Whenever I upload, my database for the p_images looks weird as nothing is uploaded. A new row is added tho, giving an id to the foreign key. views.py class CreateProjectsView(View): def get(self, request): p_photos = P_Images.objects.all() #project_form = ProjectsForm(initial=self.initial) project_form = ProjectsForm() context = { 'p_photos': p_photos, 'project_form': project_form, } return render(self.request, 'projects/forms.html', context) def post(self, request): project_form = ProjectsForm(request.POST, request.FILES) multi_img_form = P_ImageForm(request.POST, request.FILES) if project_form.is_valid(): instance = project_form.save(commit=False) instance.user = request.user #instance.feature_images = instance.id instance.save() if multi_img_form.is_valid(): #instance = project_form.save(commit=False) #instance.user = request.user #instance.save() images = multi_img_form.save(commit=False) images.save() data = { 'is_valid': True, 'name': images.p_file.name, 'url': images.p_file.url } else: data = { 'is_valid': False, } p_post = Projects() p_post.save() f_images = P_Images(c_post=p_post) f_images.save() return JsonResponse(data) models.py from django.db import models from django.utils import timezone from django.forms import ModelForm from django.utils.text import slugify from django.utils.crypto import get_random_string from django.conf import settings from PIL import Image import os # Create your models here. class Projects(models.Model): title = models.CharField(max_length=30) description = models.TextField(max_length=150) publish_date = models.DateTimeField(auto_now=False, auto_now_add=True) update_date = models.DateTimeField(auto_now=True, auto_now_add=False) slug = models.SlugField(unique=True) files = models.FileField(upload_to='files/', blank=True) images = … -
Django - serve() got an unexpected keyword argument 'documuent_root'
im trying to set up media file path / images for DRF but its not working and i cant figure out why. i get this error: serve() got an unexpected keyword argument 'documuent_root' I am on mac runing django 1.11 DRF w/ python 3.6. I have moved the settings urls to top level by why way of this link so i am one step closer although i still cant figure out why my links show 404 when i click on them. settings.py MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'src') STATIC_URL = '/static/' STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')] CORS_ORIGIN_WHITELIST = 'localhost:3000', #whitelists the localhost to run views.py from accounts.api.permissions import IsOwnerOrReadOnly from rest_framework import generics, mixins, permissions, viewsets from books.models import Books from books.api.serializers import BooksSerializer class BookViewSet(viewsets.ModelViewSet): permission_classes = [permissions.IsAuthenticatedOrReadOnly, IsOwnerOrReadOnly] # authentication_classes = [] serializer_class = BooksSerializer # necessary queryset = Books.objects.all() lookup_field = 'id' search_fields = ('user__username', 'content', 'user__email') ordering_fields = ('user__username', 'timestamp') urls.py from django.conf.urls import url, include from django.contrib import admin from . import views from django.conf.urls.static import static from django.conf import settings from rest_framework import routers from books.api.views import ( BookViewSet) router = routers.SimpleRouter() router.register(r'books', BookViewSet) # --> http://127.0.0.1:8000/api/books/api/books/ urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^api/', include(router.urls)), … -
Django Api signup email verification error
i am new to django and DRF,working on Api's new user registeration. i am facing an error. when the user get the email verification through email and as he use this link to login this error is displayed on the webpage. "TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names() " the user get logged in but with the email verification link we get this error. anytype of help will be Appreciated. -
Django ImageField is unable to hande tif images
I am creating a django Project where I had Stored a Picture(Image) in database using ImageField as... original_pic = models.ImageField() Also, I want to Store an Image which will Contain the Same Picture(Image) as original_pic with Watermark in another ImageField as.. display_pic = models.ImageField(null=True, blank=True) In short, I just want to Apply Algorithm on original_pic and save the result in watermark_pic using django models Algorithm(Logic) for Applying Watermark to image is as follows... def watermark_image_with_text(filename): text = 'PicMesh' color = 'blue' fontfamily = 'arial.ttf' image = Image.open(filename).convert('RGBA') imageWatermark = Image.new('RGBA', image.size, (255, 255, 255, 0)) draw = ImageDraw.Draw(imageWatermark) width, height = image.size font = ImageFont.truetype(fontfamily, int(height / 20)) textWidth, textHeight = draw.textsize(text, font) x = width / 5 y = height / 6 draw.text((x, y), text, color, font) my_image = Image.alpha_composite(image, imageWatermark) my_image.convert('RGB').save('D:\Github\PicMesh\media\water_'+ filename.name + '.png') return 'D:\Github\PicMesh\media\water_'+filename.name + '.png' My Models.py contains following Photo model that overwrites save method to store value in display_pic. class Photo(models.Model): format_of_tags = ( ('PNG', 'PNG'), ('JPG', 'JPG'), ('JPEG', 'JPEG'), ('Exif', 'Exif'), ('TIF', 'TIF'), ('GIF', 'GIF'), ('WEBP', 'WEBP'), ('SVG', 'SVG'), ) title = models.CharField(max_length=150) format = models.CharField(max_length=20, choices=format_of_tags, blank=False) tags = models.CharField(max_length=250) original_pic = models.ImageField() display_pic = models.ImageField(null=True, blank=True) description = models.CharField(max_length=1000) photographer = … -
How to install a python egg using a downloaded GIT repository
I have a python Django project running inside a virtual environment. I need to migrate that project to another server. To setup a new virtual environment inside that server I need to install a dependency from git(personal GIT server) as a python egg. To connect to the git server it is required to connect via VPN. However, I couldn't configure a VPN client in the new server. But I have the GIT repository which is needed to be installed as an egg. Someone please advice me on how to install the downloaded GIT repository as an egg. This is the line I used to install the dependency from GIT as an egg. -e git+git@gitlab.test.com:testsourcing/test-project.git#egg=test Since I have the downloaded repository, Is there a way to install the egg from the project directory. I am using Django 1.5.7 and python 2.7.14 -
Django: Disable RollBar in Development
I'm using Rollbar for error tracking for my Django Application. For some reason, I'm getting errors from my localhost (in development). Settings.py: import rollbar import os THUMBNAIL_DEBUG = False DEBUG = False TEMPLATE_DEBUG = False ROLLBAR = { 'access_token': '****', 'environment': 'development' if DEBUG else 'production', 'root': BASE_DIR, 'class': 'rollbar.logger.RollbarHandler' } rollbar.init(**ROLLBAR) Settings_Dev.py: from settings import * DEBUG = True TEMPLATE_DEBUG = True THUMBNAIL_DEBUG = True I use settings_dev.py for my local development environment. -
Displaying PDF within a Div element - Django
I would need your help in sorting out an issue that I am facing with PDF rendering. The below code displays the PDF on an entire HTML page, But I want the PDF to be viewied wihin a Div element alone. Please let me know how to achieve this. with open('C:\Users\Satheesh\Downloads\form.pdf', 'rb') as pdf: response = HttpResponse(pdf.read(), content_type='application/pdf') response['Content-Disposition'] = 'inline;filename=some_file.pdf' return response pdf.closed Thanks Satheesh -
Why the Django Template built-in tag filter {{ value | safe }} not working in the meta of head and script?
I have rendered the value from backend to the html template. In the body, {{ value | safe }} works well and removed the < p >, < br >, etc. However, those html tags still show up when the {{ value | safe }} is in the meta of and . Anyone knows what's going on? -
Is there other good django python rule engine?
I have tried django business rules and django logical rules , is there any other good rules engine for python(django?) -
Django - Fusion Charts for single parameter values
This is the relevant Fusion charts code for a pie chart. I want to display all the attributes in my database of all entries but according to 'name' dataSource2['data'] = [] # Iterate through the data in `Revenue` model and insert in to the `dataSource['data']` list. for key in all_books: data = {} data['label'] = key.name data['value'] = key.price dataSource2['data'].append(data) Elaboration: Following concept i want to achieve to display all single parameters for every entry data[value1]=key.printingcost data[value2]=key.papercost data[value3]=key.binding Is it possible(in pie charts) suing Fusion charts library?? Attached picture for reference -
Stop with hover & Animate when mouseout is not working
I have a list of images that I display in an html page side by side grouped in a div. when there are many images that force the div to be expanded, the div will scroll automatically from left to right vice versa. When the user puts the cursor on that div, the animation should stop, and when the cursor goes out, the animation should start again. But it doesn't work, sometimes it stops, sometimes not. HTML rendered by django <div class="row" style="position: relative;"> <div id='mainDiv' class="col-sm-12" style=""> <h1">Title</h1><hr> <div style="overflow:hidden;white-space: nowrap;"> {% for img in all_images %} <div class="" style="height:200px;display:inline-block"> <img height="100" title="" src="{{img.scr}}"> </div> {% endfor %} </div> </div> </div> JS function animatethis(targetElement, speed) { var scrollWidth = $(targetElement).get(0).scrollWidth; var clientWidth = $(targetElement).get(0).clientWidth; $(targetElement).animate({ scrollLeft: scrollWidth - clientWidth }, { duration: speed, complete: function () { targetElement.animate({ scrollLeft: 0 }, { duration: speed, complete: function () { animatethis(targetElement, speed); } }); } }); }; var sec = 20000; animatethis($('#mainDiv'), sec); $("#mainDiv").hover(function(){ $(this).stop(true) }); $("#mainDiv").mouseout(function(){ animatethis($(this), sec); }); -
Switch order of decorators based on what test case is running?
In order to test a feature flag, I'm mocking/patching two functions with patch. However, whenever I switch the order of these mock decorators it causes some tests to fail. When I switch them again, those failing tests pass and the previously passing tests fail. To my knowledge, this is due to the order in which decorators are evaluated in Python. Is there a way to declare/specify for one specific test which decorator should be evaluated first? @mock.patch.object(MyMockClass, '_some_function', return_value=False) @mock.patch.object(MyMockClass, '_another_function', return_value=False) class MyClassTestCase(TestCase): # code... -
Display multiple fusion charts in django
I have to display multiple fusion charts but the problem is occurring is that which ever chart I call first is only displayed and not the second, whatever the arrangement is. View: def team(request, pk): user_sel = UserSelect.objects.filter(user=request.user, team=pk) batsmen = [] bowlers = [] all_players = [] for i in user_sel: if i.batsman: batsmen.append(i.batsman) all_players.append(i.batsman) if i.bowler: bowlers.append(i.bowler) all_players.append(i.bowler) dataSource = {} dataSource['chart'] = { "caption": "last year", "subCaption": "Harry's SuperMart", "xAxisName": "Month", "yAxisName": "Revenues (In USD)", "numberPrefix": "$", "theme": "zune", "type": "doughnut2d" } dataSource['data'] = [] # Iterate through the data in `Revenue` model and insert in to the `dataSource['data']` list. for key in batsmen: data = {} data['label'] = key.name data['value'] = key.sr dataSource['data'].append(data) column2D = FusionCharts("doughnut2d", "ex1", "600", "350", "chart-1", "json", dataSource) dataSource2 = {} dataSource2['chart'] = { "caption": "last year", "subCaption": "Harry's SuperMart", "xAxisName": "Month", "yAxisName": "Revenues (In USD)", "numberPrefix": "$", "theme": "zune", "type": "doughnut2d" } dataSource2['data'] = [] for key in all_players: data = {} data['label'] = key.name data['value'] = key.sr dataSource2['data'].append(data) # Create an object for the Column 2D chart using the FusionCharts class constructor column = FusionCharts("doughnut2d", "ex1", "600", "350", "chart-2", "json", dataSource2) context = { 'all_players': all_players, 'batsmen': batsmen, 'bowlers': bowlers, … -
Django is not invoking my app's ready method
I have a Django project called expenses, and an app called expenseitems. In the project settings INSTALLED_APPS contains expenses.expenseitems. When I invoke the migrate command, the database is set up and the tables are created as expected. My end goal is to create a group-level permission for my model. So I want to invoke a method after migration is complete. However, while the ready methods in the AppConfigs for django.contrib.auth or django.contrib.admin are invoked when running migrate, the ready method for my app is not called. Here is my apps.py: from django.apps import AppConfig from django.db.models.signals import post_migrate def initialization(sender, **kwargs): from django.contrib.auth.models import Group, Permission public, created = Group.objects.get_or_create(name="public") if not public.permissions.filter(codename="change_expenseitems").exists(): perm = Permission.objects.get(codename="change_expenseitems") public.permissions.add(perm) class ExpenseitemConfig(AppConfig): name = 'expenses.expenseitems' def ready(self): post_migrate.connect(initialization, sender=self) Any suggestions on what I'm missing? -
Django: Disable RollBar in Development
I'm using Rollbar for error tracking for my Django Application. For some reason, I'm getting errors from my localhost (in development). Settings.py: import rollbar import os THUMBNAIL_DEBUG = False DEBUG = False TEMPLATE_DEBUG = False ROLLBAR = { 'access_token': '2ead092f35674be989209e0ca5f1f4d6', 'environment': 'development' if DEBUG else 'production', 'root': BASE_DIR, 'class': 'rollbar.logger.RollbarHandler' } rollbar.init(**ROLLBAR) Settings_Dev.py: from settings import * DEBUG = True TEMPLATE_DEBUG = True THUMBNAIL_DEBUG = True I use settings_dev.py for my local development environment. -
Uploading an image with Django and Alamofire on iOS
I’m trying to upload an image from my iOS client app to my Django backend server. Here’s what I’m doing on the client: func submitPhotoAndInfo(photo: UIImage, info: Info, completionHandler: @escaping (Bool, String?) -> Void) { let headers = ["Authorization": "Token " + self.accessToken!, "Content-type": "multipart/form-data"] self.showNetworkActivity(active: true) Alamofire.upload(multipartFormData: { multipartFormData in do { let dict = try info.asDictionary() for (key, value) in dict { if value is String || value is Int { multipartFormData.append("\(value)".data(using: .utf8)!, withName: key) } } } catch let error as NSError { completionHandler(false, error.localizedDescription) } let imageData = UIImageJPEGRepresentation(photo, 0.8) multipartFormData.append(imageData!, withName: “my_photo", fileName: “my_photo.jpg", mimeType: "jpg/png") }, usingThreshold: UInt64.init(), to: "https://myapp.herokuapp.com/users/submit_photo_and_info", method: .post, headers: headers) { encodingResult in self.showNetworkActivity(active: false) switch encodingResult { case .success(let response, _, _): if response.response?.statusCode == 200 { completionHandler(true, nil) } else { completionHandler(false, "Server error") } case .failure(let error): print(error) completionHandler(false, error.localizedDescription) } } } And this is on the Django server: @api_view(['POST']) @parser_classes((MultiPartParser,)) @authentication_classes((TokenAuthentication,)) def submit_photo_and_info(request): file_obj = request.data[‘photo'] reg = Info() reg.user = request.user reg.photo = request.data[‘photo'] reg.status = 'aw' try: resp = requests.get(“photo") resp.raise_for_status() except Exception as e: logging.error(e) return Response({}, status=status.HTTP_406_NOT_ACCEPTABLE) image_file = ContentFile(resp.content) reg.photo.save(str(user.id) + ".jpg", image_file) reg.save() return Response({}, status=status.HTTP_200_OK) It seems that … -
Modify nested ForeignKey fields in add/change view - Django admin
Say I have these models as a simple example: class First(models.Model): first_name = models.CharField(max_length=50, default='') second = models.ForeignKey(Second) class Second(models.Model): second_name = models.CharField(max_length=50, default='') third = models.ForeignKey(Third) class Third(models.Model): third_name = models.CharField(max_length=50, default='') I want to create an Admin page and add/change forms for First that will allow me to select a Second and create a Third with all its fields. Basically to have a form with a dropdown to choose a Second and below it a form to fill in Thirds fields. I saw many examples of how to add this to the list_display (such as this) but couldn't manage to do the same with fields or fieldsets in order to have it in the add/change form as well. Any suggestions will be appreciated. Thanks! -
Add non app tests to tests that run when executing python manage.py test
My Django project has a few app each with their respective tests. It also has a utils package that has its own tests. The package utils is in a folder at the same level as manage.py and its tests are in a subfolder called tests in files called test_xxx.py When I run python manage.py test Django runs all tests for all the apps in my project but it does not run the tests for the utils package. I can run the tests for the utils package by running python manage.py test utils. What I would like to do is that tests for utils are also run when I run python manage.py test so that single command tests the whole suite for my project. I haven't been able to find anything in the documentation or searching google or here on how to do it. Any ideas? Thanks for your help!! -
Django: How to send RFC 822 compliant email? (users can't reply because of whitespace)
A user has recently notified me that he cannot reply to my email messages because of white space in the address. He also mentioned the raw FROM field not being RFC 822 compliant - I don't know much about it and can't verify. Here's the raw From field that he received: From: SiteName someprefix@mg.somesite.io This is the way I'm currently sending these emails: msg_plain = render_to_string('email_template.txt', context) msg_html = render_to_string('email_template.html', context) EMAIL_FROM_FIELD = 'SiteName someprefix@mg.somesite.io' mail_was_sent = send_mail( email_subject, msg_plain, EMAIL_FROM_FIELD, [profile.user.email], html_message=msg_html, ) What am I doing wrong? -
Wagtail: Image upload error after upgrading to 2.2.1
After upgrading Wagtail from 1.13.1 to 2.2.1 and Django from 1.11.4 to 2.0.3, I am unable to upload images. It happens when I upload images while editing a page, or during a batch upload via the Images entry on the sidebar. I get a 500 error in the Wagtail back end, and this error: django.db.utils.IntegrityError: (1048, "Column 'width' cannot be null") Traceback: Internal Server Error: /admin/images/multiple/add/ Traceback (most recent call last): File "/var/env/admin.studentlife.umn.edu/local/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 71, in execute return self.cursor.execute(query, args) File "/var/env/admin.studentlife.umn.edu/local/lib/python3.5/site-packages/MySQLdb/cursors.py", line 250, in execute self.errorhandler(self, exc, value) File "/var/env/admin.studentlife.umn.edu/local/lib/python3.5/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler raise errorvalue File "/var/env/admin.studentlife.umn.edu/local/lib/python3.5/site-packages/MySQLdb/cursors.py", line 247, in execute res = self._query(query) File "/var/env/admin.studentlife.umn.edu/local/lib/python3.5/site-packages/MySQLdb/cursors.py", line 411, in _query rowcount = self._do_query(q) File "/var/env/admin.studentlife.umn.edu/local/lib/python3.5/site-packages/MySQLdb/cursors.py", line 374, in _do_query db.query(q) File "/var/env/admin.studentlife.umn.edu/local/lib/python3.5/site-packages/MySQLdb/connections.py", line 292, in query _mysql.connection.query(self, query) _mysql_exceptions.OperationalError: (1048, "Column 'width' cannot be null") During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/var/env/admin.studentlife.umn.edu/local/lib/python3.5/site-packages/django/core/handlers/exception.py", line 35, in inner response = get_response(request) File "/var/env/admin.studentlife.umn.edu/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 128, in _get_response response = self.process_exception_by_middleware(e, request) File "/var/env/admin.studentlife.umn.edu/local/lib/python3.5/site-packages/django/core/handlers/base.py", line 126, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/var/env/admin.studentlife.umn.edu/local/lib/python3.5/site-packages/django/views/decorators/cache.py", line 31, in _cache_controlled response = viewfunc(request, *args, **kw) File "/var/env/admin.studentlife.umn.edu/local/lib/python3.5/site-packages/wagtail/admin/urls/__init__.py", line 102, in wrapper return view_func(request, … -
WINDOWS: mysqlclient for django
Having some issues installing mysql client on windows machine, I've tried the following commands: sudo apt-get install python3-dev pip install pymysql this is my error when I run pip install mysqlclient: Command "/usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-y_vreoq9/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-yuxr_8a6/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-y_vreoq9/mysqlclient/ -
AJAX POST to server results in Error 413: Request Entity Too Large
In a JS plugin, my Django view accepts an AJAX POST of a base64 encoded image. The problem is that the images are too large. I'm getting the following error. django_1 | Traceback (most recent call last): django_1 | File "/usr/local/lib/python3.6/site-packages/raven/transport/threaded.py", line 165, in send_sync django_1 | super(ThreadedHTTPTransport, self).send(url, data, headers) django_1 | File "/usr/local/lib/python3.6/site-packages/raven/transport/http.py", line 43, in send django_1 | ca_certs=self.ca_certs, django_1 | File "/usr/local/lib/python3.6/site-packages/raven/utils/http.py", line 66, in urlopen django_1 | return opener.open(url, data, timeout) django_1 | File "/usr/local/lib/python3.6/urllib/request.py", line 532, in open django_1 | response = meth(req, response) django_1 | File "/usr/local/lib/python3.6/urllib/request.py", line 642, in http_response django_1 | 'http', request, response, code, msg, hdrs) django_1 | File "/usr/local/lib/python3.6/urllib/request.py", line 570, in error django_1 | return self._call_chain(*args) django_1 | File "/usr/local/lib/python3.6/urllib/request.py", line 504, in _call_chain django_1 | result = func(*args) django_1 | File "/usr/local/lib/python3.6/urllib/request.py", line 650, in http_error_default django_1 | raise HTTPError(req.full_url, code, msg, hdrs, fp) django_1 | urllib.error.HTTPError: HTTP Error 413: Request Entity Too Large Any ideas on how to resolve this? I have found solutions with nginx, however I am using gunicorn within cookiecutter-django project. -
Building dynamic IMG URL in Django Template
i am new to Django and so far its okay, but i have difficulties building a dynamic URL. <script>console.log("{% static 'img/emblem/league/scaled/league_' %}" + {{ league.id }} + ".png");</script> this line works fine and output the correct link, in this case its /static/img/emblem/league/scaled/league_1729.png but in the following line when i try to build a dynamic URL to show different Images in a for loop, i get a TemplateSyntaxError when trying to do it with |add: as the "+" doesnt work either(images dont load) <div class="owl-item"><img class="img-fluid" src="{% static 'img/emblem/league/scaled/league_'|add:{{ league.id }}|add:'.png' %}" alt="{{ league.name }}"></div> TemplateSyntaxError at /matchstatistics/ add requires 2 arguments, 1 provided I searched a lot and couldnt find a solution, thanks in advance.