Best approach to update django project, track updates

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Best approach to update django project, track updates



Hello Awesome People!



I have a Django project, already hosted. the project contains lots of functionalities. Sometimes, when I update a part of the project, I don't remember where these updates might affect.



Page 1


line 1: if obj.love_basket:
line 2: up.fan = True # as well
line 3: up.save()



After months, I want to remove fan attribute and replace it with is_fan


fan


is_fan



Page 2


line 4: class UserProfile:
line 5: # fan = models.BooleanField()
line 6: is_fan = models.BooleanField()



This change will give an error in the future when a user hits line 2
This is just an example.


line 2



How will I know where these changes may affect?





I recommend using Pycharm for such refactors. There is Shift+F6 command for renaming. I'm not sure, but I believe you need Professional edition to have support for Django. After using that command I'd couble check by looking for string ".fan(" in the project (I'd also use Pycharm). BUT, you will miss something anyway and this is why you need good tests :-)
– Kamil
Aug 8 at 14:33





in Sublime Text i used to make a global search of the variable before removing it, but I think it's not the best approach
– Eu Chi
Aug 8 at 14:44





1 Answer
1



Write unit tests! Things like that are an easy catch with a pretty simple unit test.





Ok, write unit tests. How to proceed when having a big project?
– Eu Chi
Aug 8 at 14:39





Well ideally, you write them along the way as you code. But if you have no unit tests so far, I recommend starting by picking the simplest page/route to test. That will get the momentum moving.
– reptilicus
Aug 8 at 16:57





And in the future, every new route/feature you write, write a unit test to go along with it.
– reptilicus
Aug 8 at 16:57





Thank you for the advice!
– Eu Chi
Aug 8 at 18:53






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered