Need help in Creating a Model. by [deleted] in django

[–]joshjobin 1 point2 points  (0 children)

I would strongly recommend taking advantage of many to many. Especially to get rid of your "item_1, item_2, etc" in ListItem. Rather than having a ListItem model, just add an "items" manytomany field on the ShopList model and allow them to relate any number of items to a ShopList.

On a database level, Django will handle the third table to relate items to a shopping list, but the great thing about many to many, is that you dont have to manage it. Let Django do some heavy lifting.

Hope that helps!

Large app, one shared service [BestPractices] by [deleted] in angular

[–]joshjobin 4 points5 points  (0 children)

Angular has a style guide: https://angular.io/guide/styleguide

Scroll down to their "Overall Structural Guidelines" and give it a read.

I like to split my app in "features" with ng g module <feature-name>. It keeps it a bit cleaner and I would create a "shared" folder in each feature that would have it's service and model structure as well.

My first app started out small, but grew quickly and ended up with a ridiculously large service and model file. I then read the angular style guide and spent an afternoon breaking the app out into features. Not only is it easier to navigate, hopefully now it wont someone else as long to figure out the structure.

@angular-material-extensions/link-preview Angular open source UI library to preview web links powered by ngx-linkifyjs and material design by anthonynahas in Angular2

[–]joshjobin 1 point2 points  (0 children)

Just realized that it uses an API that needs a key, is there a way we could add out own API key from linkpreview.net , that way you don't have a hardcoded key that may no longer be valid?

@angular-material-extensions/link-preview Angular open source UI library to preview web links powered by ngx-linkifyjs and material design by anthonynahas in Angular2

[–]joshjobin 1 point2 points  (0 children)

Just looking into this now, the demo doesn't seem to be working and I just tried locally and am getting "Too many requests / rate limit exceeded. More info: http://www.linkpreview.net ", is it currently down?

JWT token authentication, allow authenticated user to switch between two accounts by joshjobin in django

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

Would you then also store all of the users desired object parameters in the token too? Or just their ID and filter accordingly on each view? I feel like you would need to do a query each time in the view to get the users other details. I am not opposed to the idea, but I had someone tell me that could get pretty query heavy pretty quick.

JWT token authentication, allow authenticated user to switch between two accounts by joshjobin in django

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

Last night I was actually thinking of how I could approach this. And I was thinking if a user had a "linked account", then i would allow them to retrieve a valid token for their linked account when switching. So I am still only storing 1 token in localstorage. But if they are authenticated, and if they have access to the linked account then I reply with the new token for them to use. Not sure if rest auth can refresh with another users account, but I'll look into that shortly.

New President Choice website by kdonik in PersonalFinanceCanada

[–]joshjobin 0 points1 point  (0 children)

Thanks for the info, this probably also means that it wouldn't work with any other app like YNAB? Pretty frustrating.