Posts by Guilherme IA • 1,414 points
91 posts
-
0
votes1
answer13
viewsA: How to automatically register Target Groups in Elastic Beanstalk?
I was able to identify the problem that was occurring. For some reason ended up creating a new Target Group, so ended up getting 2 Target Groups for the same environment. In the old Target Group,…
-
-2
votes1
answer13
viewsQ: How to automatically register Target Groups in Elastic Beanstalk?
I have an application in Elastic Beanstalk that when I changed his ability and configured the health check started giving 503 Service Temporarily Unavailable. After a while I saw that it had some…
-
0
votes3
answers858
viewsA: How to make a Union of two queries using Django Filter
Another way I found to make it work is by using the chain. from itertools import chain query1 = Blog1.objects.all() query2 = Blog2.objects.all() posts = list( chain(query1, query2) )…
-
1
votes1
answer56
viewsA: Django Filter ignoring characters/symbols
A colleague of mine found a gist with a solution that solved the problem: from django.db.models import F, Func, Value if '@gmail.com' in email: email_gmail_spam = email.replace('.', '') user =…
-
0
votes1
answer56
viewsQ: Django Filter ignoring characters/symbols
Problem Users who register with the email in gmail can create multiple accounts just by changing the . (dot) place. For example: [email protected] and [email protected] direct to the…
-
3
votes2
answers21812
viewsA: I executed merge command on wrong branch as undo
First of all, check the last commit you made with the secure version of your branch. Make sure you’re on the right branch and use the command: git log Take the hash of the last secure version.…
-
2
votes1
answer138
viewsQ: Multiply column with Manytomany Count() from the same Model Django
I have a model called Notificacoes and it has the following structure: Notificacoes(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL) users_interacting =…
-
1
votes1
answer74
viewsA: Customized translation of Humanize Django 2.2.x
I was running the command the wrong way and I realized that the folder locale_extra needed to be inside the myproject/project (where is the py Settings.). The correct command is: python manage.py…
-
2
votes1
answer74
viewsQ: Customized translation of Humanize Django 2.2.x
I realized that the version 2.2.7 from Django came up with the wrong humanize translation. I’m having a problem where my naturaltime is returning: 6mesesatrás and the stream would be 6 meses atrás.…
-
1
votes1
answer593
viewsQ: Formatting Django decimal number template
I’m having trouble displaying the results of a calculation. I have a Decimalfield and want to return it formatted this way: 1.000.000,00 If I order to display normally without tags, it looks like…
-
1
votes0
answers36
viewsQ: How important is the PWA (Progressive Web App) currently?
I follow these pwas for a long time and always try to have the PWA of any project of mine because it is one of the requirements of Google Audits. However, would like to understand what is the real…
progressive-web-appsasked Guilherme IA 1,414 -
1
votes0
answers123
viewsQ: Input HTML and Django Request.POST array
I’m trying to do a POST with Formdata for a view and I’m not getting the input array. Follow the example: HTML <input name="bonus" type="number" placeholder="ex.: 100.000,00"> {% for x in…
-
2
votes1
answer63
viewsQ: Remove tags generated at the end of a string from a Text Editor
I am using a text editor and like others I have used, it always generates some useless tags that I would like to remove. I can remove the last, but sometimes it generates more than once. My code:…
-
0
votes1
answer96
viewsQ: Creating Energy log table for several Django models
I have 30 models. Each of them contains information from a calculator and each record is information from sub-calculators. I need to create a log table of each calculation made by the user.…
-
-3
votes2
answers621
viewsQ: Removing unnecessary question mark from a String
I have possible strings, where I would like to have a way to prevent unnecessary question marks and add if missing. However this function applies only at the end of the string. Follow the list below…
-
0
votes1
answer11
viewsQ: Context variable Processors does not work with render_to_string
In some places on my system, I rescan a page with render_to_string, because I want to render only a small content. In these cases I do not receive my variables that I created in context_processors.…
-
2
votes0
answers106
viewsQ: Elements/Images Problems in Selenium Django
I’m having some element problem not load correctly on the page of ChromeDriver using Selenium in my Django app. I shook Django’s test tool because in my scenario, I need the entire base loaded. And…
-
1
votes1
answer2424
viewsQ: requests.exceptions.Sslerror: Certificate Verify failed
I’m having a big problem with Django requests. In the last few months I upgraded to version 2.0 of Django, and I’m updating all libs. I noticed that this impacted several scripts that I had, mainly…
-
0
votes1
answer186
viewsA: Django Filefield Image and Video Restriction
I found a way to identify the mime type of the file. Follow the example of the form where I limit the image and video and do not allow . bmp files: class ContactForm(forms.ModelForm): class Meta:…
-
-1
votes1
answer186
viewsQ: Django Filefield Image and Video Restriction
I would like to know how I can limit the file type on FileField django? I know I can add this validation in the Form. I just wish you could send videos and images in this field, nothing else.…
-
0
votes1
answer219
viewsA: How do I display variables on a Django page?
As you can see in the example that showed, there is a method called list_data. In it you render data.html and an empty dictionary. In this dictionary you can put the values that will be displayed in…
-
1
votes1
answer64
viewsA: Is Django 2.0 stable for production use?
We did the migration here from Django 1.8 to 2.0. It was very quiet the migration itself. We had to update some libs on requeriments.txt that were generating error in the logs, but nothing absurd.…
django-2.0answered Guilherme IA 1,414 -
1
votes1
answer64
viewsQ: Is Django 2.0 stable for production use?
I would like to know if I can migrate to Django 2.0 and use this version in production, without worrying about absurd bugs. I will have to update some libs and find solutions to outdated (until then…
django-2.0asked Guilherme IA 1,414 -
2
votes2
answers345
viewsA: Error when using replace
Dude, I have another solution that is to add a function replaceAll in variables of the type string. I believe it is your case, since you have comma and period. From what I understand, you want to…
-
0
votes1
answer131
viewsQ: How to create tuple with key receiving value?
I would like to create a method that returns the Django ORM FILTER parameters. I will have to use these filters at various times, I would like to create this generic method. Follow the example: def…
-
10
votes4
answers5616
viewsQ: What kind of application can I use Mongodb in?
Use Mongodb in every kind of application is bad? There are application types where it is most recommended and types where it is not recommended to use a Nosql?…
-
1
votes5
answers3338
viewsA: How do I get a div to start hiding?
An example of how to start an invisible element and switch its property according to a function in javascript. function magica(){ var $element = document.getElementById("luz"); var $button =…
-
0
votes2
answers1943
viewsA: How to link to download html file?
Dude, being arquivo the object of its model in the Django ORM and caminho the attribute ImageField or something like, you can access the direct url this way: <a href="{{ arquivo.caminho.url }}"…
-
0
votes1
answer217
viewsQ: "isdigit()" with 0.00 does not work
Why the method isdigit() does not identify that 0.00 is a digit? I am working with a few million data and certain records have values like 0.0000001 or 0.00. When I try to convert the 0.0000001 for…
pythonasked Guilherme IA 1,414 -
1
votes1
answer119
viewsQ: Grouping values in Django
I’m having a little trouble grouping some information from separate models. For example: I have 3 models, a call Category, another call Group and another call Tools. These tables will get the name…
-
0
votes1
answer302
viewsA: jquery does not work on foreach Blade Standard
This is happening because you are importing jquery every time in the loop. Put jQuery out of the loop. <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> <div…
-
0
votes1
answer135
viewsA: I can’t use Firebase Hosting
According to her own documentation, when typing the command firebase init, you will be asked to select a folder at the root of the project where the static files will be. The default is public. If…
-
2
votes1
answer308
viewsA: Web Frameworks: Frontend vs Backend
Although Javascript can also be used as back-end (Nodejs), in the case of AngularJS is used to work the elements dynamically. So it fits into the front category as it is a framework to work with…
-
2
votes1
answer344
viewsA: Skew effect with css
You need to apply the skew in the li and in the a (text) do the reverse. See the example below: li { background: #000; display: inline-block; transform: skew(20deg); } li a { display:block;…
-
0
votes2
answers2091
viewsQ: Remove Repeated Integers List in Python
I would like to remove repeated integers from a list and return a new list. lista = [1, 2, 3, 3, 3, 4, 5, 6, 6, 7, 8] The result would have to be this: [1, 2, 3, 4, 5, 6, 7, 8]…
-
1
votes2
answers1736
viewsA: How to call a view method in html?
You can create a view that renders a template as follows: py. - In your urls, create the route that calls the view and a name (that name you will call from the template: url(r'^accounts/home',…
-
4
votes2
answers152
viewsA: Settimeout and server traffic
You need to work with Websocket instead of making requests. Nowadays there are several libs for any backend language that help and facilitate implementation. See a list of some languages (caso…
-
1
votes1
answer90
viewsQ: Django Models with default value in another branch
I have a field that I added to another branch (which has status developing) calling for money, with default value: 0.00 in the model User. However, it is not yet being used in the production branch.…
-
1
votes0
answers143
viewsQ: Uncaught (in Promise) Domexception: Quota exceeded
I’m having a problem with my service-worker. Suddenly it started showing this error in devtools: Uncaught (in promise) DOMException: Quota exceeded. Follows my service-worker.js: {% load static from…
-
0
votes1
answer75
viewsA: Problem with Service Worker cache
I found the solution. I needed to change my Eventlistener fetch according to my need: a home that updates frequently. (Reference) self.addEventListener('fetch', function(event) { event.respondWith(…
-
0
votes1
answer75
viewsQ: Problem with Service Worker cache
I have a service worker working perfectly. The problem is that it is caching the user out. So every time I update the page, even logged in, it shows the header out. My service worker:…
-
4
votes3
answers858
viewsQ: How to make a Union of two queries using Django Filter
I was racking my brain to do union of two darlings using Django Filter and I ended up doing it on hand (Model.objects.raw("SELECT....")). How could I union with Django’s ORM? Note: I have 2…
-
2
votes2
answers394
viewsA: Meaning of these nomenclatures in Python and other languages, if the names are universal
Class Structure containing behaviors and characteristics (methods and attributes). (Read more) class Pessoa: def __init__(self, nome, idade): self.nome = nome self.idade = idade def get_info(self):…
-
1
votes1
answer1065
viewsA: Writing in Image with Javascript
Here’s an example where I write with Canvas in a picture: $(document).ready(function(){ var canvas = $("#myCanvas")[0]; var context = canvas.getContext("2d"); var imageObj = new Image();…
-
1
votes0
answers81
viewsQ: Push Notification and Django problems (vapid_private_key)
I was able to reproduce an example with the repository pywebpush to make the push notification. After breaking my head to understand, I was able to do it. However, when I tried to integrate with my…
-
0
votes0
answers93
viewsQ: Attributeerror: 'Asgirequest' Object has no attribute 'user_agent'
Replaces my WSGI for ASGI to rotate the Django Channels, as is said in documentation of them. The problem is that the user_agent, where I detect whether it’s mobile or not. I had created a function…
-
1
votes0
answers55
viewsQ: Django Channels Routing not working
I wanted people to access my URL normally like before (install Channels) localhost/home/minha-slug and detected the socket messages within that route. I want to create Groups so I don’t keep sending…
-
4
votes1
answer205
viewsQ: Rounded edge on Google Chrome iOS buttons
I recently updated my Macbook here and now all the buttons on my site are rounded. I even thought it was some CSS error, but no, entering my Windows computer is normal. Can anyone tell me what is…
-
2
votes1
answer3528
viewsQ: Typeerror: expected string or bytes-like Object Datefield
I am having a very boring problem in Django to work with date. I am sending from my angular a date I select in a input data. In my view, i turn the date to that format: 2017-10-13 When I try to…
-
1
votes1
answer268
viewsQ: Working with Data on ngInit
I have an input in my date form. Whenever the user modifies the date, it will be updated in Django and return another date. When the user enters the screen, I already bring the date in the following…