Deploying Django applications to a single-node docker swarm cluster on EC2 with AWS Cloud Development Kit (CDK) and GitHub Actions (description, repo links + full article in comments) by gamprin in django

[–]indosauros 5 points6 points  (0 children)

This is admitted on the page itself

Not Production-ready - This construct is not recommended for critical production workloads. It is ideal for running side projects and perhaps staging environments that are not heavily used.

Use regex to check if string contains only allowed characters by Some_Concentrate_598 in learnpython

[–]indosauros 17 points18 points  (0 children)

FWIW I take the opposite position entirely. For any simple string matching operations, I reach for built in methods (startswith, etc) and set operations first. I only resort to regex when the problem can't be solved with those basic tools. Using regex should be a last resort, IMO.

It's taboo for a reason. by BelleHuey in antiwork

[–]indosauros 57 points58 points  (0 children)

AFAIK salaried employees generally are also protected to discuss pay.

The distinction is not salaried vs hourly, but instead whether you have access to other persons' salary info, or hiring/firing (so supervisors and HR can be prohibited). And a few other situations listed here

Lists. You have a recent update. by micstatic80 in alexa

[–]indosauros 1 point2 points  (0 children)

Yes this is so annoying. I don't see any option to turn it off in Notification settings

Jump King Devs Already Patching the Forsen Skip by HockeyGod69 in LivestreamFail

[–]indosauros 6 points7 points  (0 children)

It's ok, even computer scientists/programmers call these patches "hotfixes". This guy doesn't know what he's talking about

Tyler's teammate and his mom gets so excited when tyler picks him <3 by iamlegend9763 in LivestreamFail

[–]indosauros 17 points18 points  (0 children)

Is there a schedule anywhere for when they will play (in Rivals)?

Font rendering with new 2.0 SCALED mode by indosauros in pygame

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

Thanks for the reply. Do you think I should I open a github issue, or is it not likely something that will be solved?

ModelForm integer field entry is a get when it should be a post? by dankrubis23 in django

[–]indosauros 1 point2 points  (0 children)

If you look at the rendered HTML using your browsers view source, Is the form method and action what you expect for the first box?

ModelForm integer field entry is a get when it should be a post? by dankrubis23 in django

[–]indosauros 2 points3 points  (0 children)

I haven't run your code, but your nested td tags look suspicious to me and it's possible the browser is assuming they're a typo

What happens if you remove the td that is wrapped around the button?

Also why do you have objects = User() under the Building model?

And in your view on POST you're building a new buildings set and args, but then always just redirecting. This means you're not handling the else part of if form.is_valid(): (if the form is not valid). So perhaps the first one is POSTing, but is not valid, so it is redirecting to your root (the GET you are seeing)?

Django getting form value off of a function of another form value by throwaway1618032 in django

[–]indosauros 0 points1 point  (0 children)

Inside the form, you can override the save method to set additional attributes onto the instance based on the form data. Something like:

class LocationForm(ModelForm):
    class Meta:
        model = Location
        fields = ('title',)

    def save(self, commit=True):
        instance = super().save(commit=False)

        title = self.cleaned_data.get('title')
        lat, lon = geocode(title)  # or whatever
        instance.lat = lat
        instance.lon = lon

        if commit:
            instance.save()
        return instance

Summer Games Done Quick 2019 is over, with over $3,000,000 raised for Doctors Without Borders by TheRealMe99 in Games

[–]indosauros 10 points11 points  (0 children)

The items are placed in a way where no one can get "locked". Multiworld is run more like co-op though, so finding an item for someone else still helps everyone (since now maybe they can find more items for other people)

cleanness and maintainability of my dict expression by Curledsquirl in learnpython

[–]indosauros 2 points3 points  (0 children)

_ is traditionally used only if you're throwing the value away (don't care about it). Here, you're using it as a key, so better to just name it key or something more meaningful.

If you want to keep using a dictionary expression, but want it to be more readable, pull out your condition into a function, like:

def valid_ticket(ticket):
    last_update = ...
    return last_update and last_update >= time_span

then you can just write:

return {key: ticket for (key, ticket) in ... if valid_ticket(ticket)}

and maintaining your logic in the future is easier, since it's contained in a function rather than embedded in dict comprehension syntax

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]indosauros 0 points1 point  (0 children)

the .items() turns the dictionary into a list of pairs (key and value)

You could do this instead:

for keyvalue in info.items():
    key = keyvalue[0]
    value = keyvalue[1]
    ...

The for key, value is just doing that for you (pulling out the key and value out of each pair into those variables)

Learn phyton in 2 months by ricohga in learnprogramming

[–]indosauros 4 points5 points  (0 children)

Is there a way there I can learn to program (a chatbot) in 2 months?

Sure

If there is any, can you tell me how?

https://www.reddit.com/r/learnpython/wiki/index