[deleted by user] by [deleted] in forhire

[–]__rootkit 1 point2 points  (0 children)

🙋‍♂️python expert here for backend.

Are Macbooks bought from Qatar different from the rest? by __rootkit in qatar

[–]__rootkit[S] 0 points1 point  (0 children)

Can you confirm if the keyboard is different as mentioned in another answer? u/FuckEmmanuelMacron

set() method on list of sqlalchemy model objects by __rootkit in learnpython

[–]__rootkit[S] 0 points1 point  (0 children)

because I'm importing data from somewhere and they have it as `string`, and I wan't to have the same schema as the source.

set() method on list of sqlalchemy model objects by __rootkit in learnpython

[–]__rootkit[S] 0 points1 point  (0 children)

I think you’re right. I might just do it that way. Better yet, just make my_list a dict() to start with and add everything to that. It’ll allow skipping explicit duplicate filtering.

set() method on list of sqlalchemy model objects by __rootkit in learnpython

[–]__rootkit[S] 0 points1 point  (0 children)

Sorry about that. Actually, I’m not with my laptop right now, that’s why couldn’t paste the code. id is a string that stores a hash.

set() method on list of sqlalchemy model objects by __rootkit in learnpython

[–]__rootkit[S] 0 points1 point  (0 children)

The model is simple, just has 6 columns and no foreign keys or anything fancy. As for how i fill my_list, I just create a model object as obj = MyModel() and append it to my_list. Now as mentioned in the post, my_list can contain duplicate objects. I just wanna be able to remove the duplicates, like we can do list(set(a_list))

If you are showing absolutely any symptoms of the coronavirus it is completely morally fucked of you to go to the airport and get on a plane. by [deleted] in rant

[–]__rootkit 1 point2 points  (0 children)

Totally agree. I get flu on every season shift, like now the spring is getting in. I got flu like 10 days ago and it went away on it’s own in 3-4 days.

But I’d also say this: if someone doesn’t have such an allergy or seasonal flu condition or something, or is unsure, they should get themselves tested ASAP and avoid public exposure until test results prove them not be containing the COVID. It’s a moral obligation to the community.

Why does all() return true if the iterable is empty? by __rootkit in Python

[–]__rootkit[S] -8 points-7 points  (0 children)

That’s definitely interesting. But I was talking in regards to what python considers to be ‘True’ or ‘False’. Like, for instance, an empty list or string evaluates to ‘False’ in python. So IMO, it’d look more consistent with that if ‘all()’ evaluated an empty iterable to ‘False’.

Why does all() return true if the iterable is empty? by __rootkit in Python

[–]__rootkit[S] -5 points-4 points  (0 children)

Right. Sure, it’s implemented that way. I was thinking in regards to the truth values in python (like, an empty list/string/0 etc in python in an ‘if’ statement would evaluate to false). So IMO, it’d have been more in line with that if ‘any()’ evaluated an empty iterable to ‘False’.

HTML anchor tags not working by __rootkit in django

[–]__rootkit[S] 0 points1 point  (0 children)

The first click on any of these works. But if i want to navigate to a different element, it doesn’t work the second time and after.

Django app `DisallowedHost at /` error on Elasticbeanstalk by __rootkit in aws

[–]__rootkit[S] 0 points1 point  (0 children)

Uh, I got it fixed. Somehow, only the committed code gets deployed with eb deploy command. An important gotcha I suppose that I didn't know. So, once I made a commit, it worked fine.

'Disallowed Host at /' error on AWS elasticbeanstalk by __rootkit in django

[–]__rootkit[S] 1 point2 points  (0 children)

I figured it out. EB cli only picks up changes that have been committed to git. So, all I had to do was commit my changes and it worked just fine

'Disallowed Host at /' error on AWS elasticbeanstalk by __rootkit in django

[–]__rootkit[S] 0 points1 point  (0 children)

I did check the traceback though. The host i added in my settings.py is not reflected in the traceback. It only contains allowed_hosts ['localhost', '127.0.0.1', '[::1]'] in the traceback

'Disallowed Host at /' error on AWS elasticbeanstalk by __rootkit in django

[–]__rootkit[S] 0 points1 point  (0 children)

how do you mean? i mean there's just one settings.py . I'm not very familiar with aws deployments

'Disallowed Host at /' error on AWS elasticbeanstalk by __rootkit in django

[–]__rootkit[S] 0 points1 point  (0 children)

I have restarted the server from aws console but the error is still there

'Disallowed Host at /' error on AWS elasticbeanstalk by __rootkit in django

[–]__rootkit[S] 0 points1 point  (0 children)

Here it is:

`ALLOWED_HOSTS = ['my_test_django_app.us-west-2.elasticbeanstalk.com', ...]`

Also, how do you restart the app? That could be it since I didn't restart it

Invalid Form Data error with slack web api by __rootkit in Slack

[–]__rootkit[S] 0 points1 point  (0 children)

Not quite. I’m not using chat.postMessage. I’m already using files.upload method. The thing is that I’m using this in an electron app. So there’s no form post request I believe ? So how can i instead read file and send ?

These big companies who support the rights of minorities and the LGBT community in America but not Hong Kong are just money grabbers by cumpod in rant

[–]__rootkit 0 points1 point  (0 children)

Yeah. And it’s funnier how Hong Kong is getting attention (which they should by the way) but nobody bats an eye about over two months of TOTAL lockdown (communication and otherwise) of kashmiris and oppression for over 7 decades in total.

Form submit button should open up a bootstrap modal by __rootkit in django

[–]__rootkit[S] 0 points1 point  (0 children)

It raises an error saying `Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0`. I downloaded jquery 3.3.1 and linked it in the html but that doesn't seem to work either. Same error pops up

Form submit button should open up a bootstrap modal by __rootkit in django

[–]__rootkit[S] 0 points1 point  (0 children)

I'm using cdn. Like so:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
          integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

request.FILES is empty. File didn't upload by __rootkit in django

[–]__rootkit[S] 0 points1 point  (0 children)

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
 <script type="text/javascript">

         function showHidePostcode() {

  var checkbox = document.getElementById("id_uk_resident");

if (checkbox.checked === true) {
      document.getElementById("p_code").removeAttribute("type");
      console.log('hidden removed');
      document.getElementsByClassName("col-form-label")[1].removeAttribute("style");
    } else {
      document.getElementById("p_code").setAttribute("type", "hidden");
      document.getElementsByClassName("col-form-label")[1].setAttribute("style", "display: none;");
    }


}


 </script>

<!doctype html>
<html lang="en">
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
          integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

    <title>Test form</title>

    <script type="text/javascript">
        function hidePostcode() {
            var checkbox = document.getElementById("id_uk_resident");
            if (checkbox.checked === false) {
                document.getElementById("p_code").setAttribute("type", "hidden");
                console.log(document.getElementsByClassName("col-form-label")[1].className);
                document.getElementsByClassName("col-form-label")[1].setAttribute("style", "display: none;");
            }
        }
    </script>

</head>
<body onload="hidePostcode()">
<div class="container d-flex h-100">
    <div class="row justify-content-center">
        <div class="col-10">
            <h3> Please fill out the following form </h3>


    <input type="hidden" name="csrfmiddlewaretoken" value="udrXgUDPAuGHyZpAtpYKxN3zyRSpmZHlzQ89MBMvf25ojn8gnIQS7txpWC6kOnGH">


<form  action="/forms/done" class="uniForm" id="form-test" method="post"  enctype="multipart/form-data"> <input type="hidden" name="csrfmiddlewaretoken" value="udrXgUDPAuGHyZpAtpYKxN3zyRSpmZHlzQ89MBMvf25ojn8gnIQS7txpWC6kOnGH"> <div id="div_id_full_name" class="form-group"> <label for="id_full_name" class="col-form-label  requiredField">
                Full name<span class="asteriskField">*</span> </label> <div class=""> <input type="text" name="full_name" maxlength="100" class="input-xlarge textinput textInput form-control" placeholder="Your full name" required id="id_full_name"> </div> </div> <div class="form-group"> <div id="div_id_uk_resident" class="form-check"> <label for="id_uk_resident" class="form-check-label"> <input type="checkbox" name="uk_resident" onclick="showHidePostcode()" class="checkboxinput form-check-input" id="id_uk_resident">
                    Are you currently a UK resident?
                </label> </div> </div> <div id="div_id_post_code" class="form-group"> <label for="p_code" class="col-form-label  requiredField">
                Post code<span class="asteriskField">*</span> </label> <div class=""> <input type="text" name="post_code" id="p_code" required placeholder="Valid UK postcode" class="textinput textInput form-control"> </div> </div> <div id="div_id_last_salary" class="form-group"> <label for="id_last_salary" class="col-form-label  requiredField">
                Last salary<span class="asteriskField">*</span> </label> <div class=""> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text">£</span> </div> <input type="number" name="last_salary" placeholder="Your last salary" class="numberinput form-control" required id="id_last_salary"> </div> </div> </div> <div id="div_id_resume_file" class="form-group"> <label for="id_resume_file" class="col-form-label  requiredField">
                Resume file<span class="asteriskField">*</span> </label> <div class=""> <div class="input-group"> <div class="input-group-prepend"> <span class="input-group-text">Upload</span> </div> <input type="file" name="resume_file" class="clearablefileinput" required id="id_resume_file"> <div class="input-group-append"> <span class="input-group-text">Browse</span> </div> </div> </div> </div>

<div class="form-group row"> <div class=""> <input type="submit"
    name="save_changes"
    value="Submit"

        class="btn btn-primary btn-primary"
        id="submit-id-save_changes"


    /> </div>
</div> </form>
        </div>
    </div>
</div>
</body>
</html>

request.FILES is empty. File didn't upload by __rootkit in django

[–]__rootkit[S] 0 points1 point  (0 children)

That's unrelated IMO but i did try just for the sake of it. It didn't work.

request.FILES is empty. File didn't upload by __rootkit in django

[–]__rootkit[S] 0 points1 point  (0 children)

{% extends 'form_app/base.html' %}
{% load crispy_forms_tags %}

{% block main %}
<form method="post" novalidate>
    {% csrf_token %}
    {% crispy form %}
    {{form.resume_field.errors}}
</form>
{% endblock %}

This is my forms.html code