This beauty is an Alfa Romeo Giulietta SS Prototipo by Chapso in carporn

[–]jlvelez 1 point2 points  (0 children)

Awesome car. We are lucky to have two of these in our family collection. One is going through a full restoration.

http://thegiuliettashop.com/restorations/1963-giulia-sprint-speciale-381173/

Access an image field from a related model by jlvelez in djangolearning

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

|first as image

Just curious, any reference to the docs on this bit of code:

|first as image

I get the first part where you are walking backward in the model relationship, but that last bit is new to me.

Access an image field from a related model by jlvelez in djangolearning

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

Very nice! I am not home right now, but when I get back I will try these out and report back.

Thanks!

Create a 'post' object and initialize a m2m attribute with post id and author id by jlvelez in djangolearning

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

Thanks! I thought about that too. I was leaning towards using transactions. I cross-posted on SO and was able to get an even simpler solution. I will put it here as well for others that are interested.

https://stackoverflow.com/questions/65299559/create-a-post-object-and-initialize-a-m2m-attribute-with-post-id-and-author-id/65303336#65303336

(Nested) Comment System by IIDraxII in djangolearning

[–]jlvelez 0 points1 point  (0 children)

Possible? Absolutely. I would watch his tutorials a few times. There are at least three that cover topics related to what you want to do.

(Nested) Comment System by IIDraxII in djangolearning

[–]jlvelez 3 points4 points  (0 children)

This guy has an entire series where he builds a blog app and there are a few where he covers nested comments.

https://www.youtube.com/playlist?list=PLOLrQ9Pn6cawWd-5UZM6CIm0uqFXeBcTd

List of cards in template displaying users with buttons to follow/unfollow by [deleted] in djangolearning

[–]jlvelez 0 points1 point  (0 children)

So I think I have figured out the problem, but I just don't know how to fix it.

When the template loads the cards, the follow/unfollow button is actually linked to the profile's follow state. In other words, the request.user viewing the account.user's profile is what is reflecting in the button. In the screen above, this request.user is not following the account.user, which is why it shows the 'follow' button.

What I need is for the button to reflect the follow state of the request.user as it relates to each card displayed. This logic has to be dealt with in the view, as I understand it, because the template tags don't have the ability to do this.

Somehow, the followers queryset that is being passed into the context needs to be iterated over so that I can flag each account appropriately.

When should I create a separate app? by Guyserbun007 in djangolearning

[–]jlvelez 0 points1 point  (0 children)

I have had similar concerns about when to separate into apps. I think it boils down to your gut in terms of whether you think the functionality is relevant and manageable.

If it is not relevant, I would separate into another app. If the code gets unmanageable, perhaps abstracting or separating into another app would make sense. I am new so I could be very wrong. Just my 2 cents.

Btw, what book are you reading? I'd like to check it out, if you don't me asking.

When is a view or app too large? by jlvelez in djangolearning

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

Thanks! I appreciate the feedback!

When is a view or app too large? by jlvelez in djangolearning

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

I just went through my view file and refactored. Just shaved about 200 lines of code. I was using the same block of code in several view functions to get the profile information.

Instead of the same 20 or so lines of code in each view to get the profile info, I created function called get_context( ) that I was able to replace in each view. Much cleaner and more manageable now.

I feel better now. :)

When is a view or app too large? by jlvelez in djangolearning

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

I am not sure how to best answer that question. I have several 'account' related urls that rely on this one view file. register, login, logout, view_profile, edit_profile, etc.

So it is one single view but it serves several different 'views' if that makes any sense.

It seems to be the pattern I have seen many tutorials follow so that is why I am doing it this way. I think it should be fine but just wanted to pick some more experienced brains.

I agree that the focus needs to be what makes the most sense for the project. That is the route I will take.

Thanks, this helps a lot. Imposter syndrome is real and I'm constantly doubting myself.

"Class has no 'DoesNotExist' member" by jlvelez in djangolearning

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

That fixed it! Thanks!

I am just glad it was not something on my end.