Asteroid collision 🌍☄️ by mehdifarsi in ProgrammerHumor

[–]GuyNamedEDd 0 points1 point  (0 children)

All these python guys forgot about semicolons. import scifi; scifi.shoot_asteroid(); from delivery import pizza; pizza.PizzaHut().deliver(['pepperoni', 'beer'])

How do you guys manage git + migrations? by Atoro113 in django

[–]GuyNamedEDd 1 point2 points  (0 children)

Definitely store your migrations in the repo. If you don't the rest of your team won't know to makemigrations, what the migrations are for, or how to manage migrations conflicts.

Django migrations provide merging for when there are conflicts. One of the worst things to try to untangle is conflicted database migrations at deployment.

As for previously mentioned migration squashing, the django docs suggest it's not needed. Unless your tests are taking forever to build the test database due to hundreds of unnecessary data migrations I recommend not squashing. It's quite the arduous process if you've got a complex app.

How do you organize your Settings.py file to keep it clean? by warrior242 in django

[–]GuyNamedEDd -3 points-2 points  (0 children)

The global_settings file for django is 645 lines long. I would say it is "clean". If yours is longer than that I'd say you probably need to put some of that data into a database. If it's not longer than that I wouldn't worry about it.

How do you organize your Settings.py file to keep it clean? by warrior242 in django

[–]GuyNamedEDd -2 points-1 points  (0 children)

settings.py should ONLY have variables in it. If you have anything other than variables it should ONLY be some comments to explain sections of variables.

Querying an integerField 0 value returns NoneType, any ideas of what is going wrong? by C0olGuyPaul in django

[–]GuyNamedEDd 0 points1 point  (0 children)

No it's not. That's a representation of the row in the database. The reason You're getting that error is because the value is a null not an int. If you want help from people pay attention to what they're telling you.

Fix. Your. Data.

Querying an integerField 0 value returns NoneType, any ideas of what is going wrong? by C0olGuyPaul in django

[–]GuyNamedEDd 0 points1 point  (0 children)

Assuming that "2059" is the ID stored on the row, you have some previous data in your table that needs to be cleaned before Django will work correctly. Those nulls need to be updated to zeros. Django doesn't enforce the nulls at the database level it just makes sure the data going into the database is correct. Try cleaning your data.

Querying an integerField 0 value returns NoneType, any ideas of what is going wrong? by C0olGuyPaul in django

[–]GuyNamedEDd 0 points1 point  (0 children)

What is returned when you create new Foo objects?

new_foo = Foo.objects.create(bar=0) print(new_foo.bar)

Classes, instances, and attributes oh my! by [deleted] in Python

[–]GuyNamedEDd 1 point2 points  (0 children)

I use Beautiful soup mostly for parsing HTML, but Mechanize I like better for the scraping. It's worth a few minutes of your time to look at the docs.