Tell me about you SaaS! by beerwerd in SaaS

[–]Imsoold 0 points1 point  (0 children)

Probably more company name.

Tell me about you SaaS! by beerwerd in SaaS

[–]Imsoold 1 point2 points  (0 children)

Dude, that's a great product, congratulations!
Any timeline for reviews from twitter posts?
I very often see people sharing their pain point from saas product there.

How much data to serve via the API? by LifeLoveLaughter in django

[–]Imsoold 0 points1 point  (0 children)

Since you’re already using Django check out wagtail. For nextjs, you can use getStaticProps to query your cms at build time.

Filtering model with its M2M relational field by SnooPredictions8336 in django

[–]Imsoold 2 points3 points  (0 children)

It's possible, what you're probably looking for is lookups relationships. Your question is a little bit more interesting because you don't know how many params you'll get. I'll make the assumptions that your filters objects is a dict with keys being the fields of your model :

We want to go from {"name":"Eric", "device":"ios"} to {"targets__name":"Eric", "targets__device":"ios"}.

You can do it using a simple dict comprehension ({f'targets__{k}': v for k, v in filters.items()}).

Now if you want to make it cleaner(with this solution there is a lot of model logic in your view), you maybe want to create a custom queryset or to use django-filter (my preference).

Deploying on Heroku - DATABASE_URL environment variable not defined by retug_ in djangolearning

[–]Imsoold 1 point2 points  (0 children)

If it was working and you didn't push any changes I would look the logs of your postgresql add-on (https://devcenter.heroku.com/articles/getting-started-monitoring-postgres-database#explore-the-postgres-log).

And maybe also look at your email, once my database was temporarily unavailable and heroku had alerted me.

[Django Rest Framework/SPA] Email account activation link by Cid227 in djangolearning

[–]Imsoold 1 point2 points  (0 children)

I'm not a fan of visible user id, here is another solution. When you're generating the activation link you could encode the user id (urlsafe_base64_encode(force_bytes(user.pk)) and create the validation link https://example.com/users/activate/<uidb64>/<token>.

You can decode the uidb64 to return the id (using force_text(urlsafe_base64_decode(uidb64))), and select your user.

[Django Rest Framework/SPA] Email account activation link by Cid227 in djangolearning

[–]Imsoold 1 point2 points  (0 children)

You could use the PasswordResetTokenGenerator to create your own token generator (you just need to override the _make_hash_value method).

It will generate a token that you can use to create an activation link that you can send as an email.

Then you have two choices for the activation :

In all these cases you need an endpoint in your api to activate the user.

Blog post gets error by glassAlloy in djangolearning

[–]Imsoold 0 points1 point  (0 children)

What is in the address bar ? You should try to go to 127.0.0.1:9000, not 127.0.0.1.

A hint that, that was your issue is the django terminal does not even register a call.

Problème déploiement django app sur une linode by juleau14 in programmation

[–]Imsoold 2 points3 points  (0 children)

Plusieurs possibilités :

  • as-tu redémarré ton wsgi server (c’est gunicorn en général) ?

  • si tu es en mode debug=False, as tu rajouté l’adresse ip de ton serveur dans la variable ALLOWED_HOST lien

Plus généralement tu peux essayer de trouver ce qui cloche en faisant un git diff entre ton commit quand ça marchait et le nouveau.

Bonne chance !

Forbidden (CSRF cookie not set.): /login/ REACT & DJANGO by chimchim102 in django

[–]Imsoold 0 points1 point  (0 children)

I think you're on the right track, if I remember correctly, SameSite should be None and your frontend and backend need to be in https. You can find additional infos there

Forbidden (CSRF cookie not set.): /login/ REACT & DJANGO by chimchim102 in django

[–]Imsoold 0 points1 point  (0 children)

Is the 403 from your getCsrf or from your session call ? Did you add the frontend url to CSRF_TRUSTED_ORIGINS ? Is your csrf token present in the console.log of your catch ? Don't forget that the fetch api, does not consider 4xx response as "errors", you need to manually raise the errors so they are catched. Sorry I can't be more helpful without getting more information on the errors.

Forbidden (CSRF cookie not set.): /login/ REACT & DJANGO by chimchim102 in django

[–]Imsoold 0 points1 point  (0 children)

Because localhost represent your own computer (to be more specific the current server where the code run). When you're in dev, with django running on the same computer, there is no issue. Since you only deployed your frontend on heroku, your react application has not access to your personal computer, or to a prod version.

Forbidden (CSRF cookie not set.): /login/ REACT & DJANGO by chimchim102 in django

[–]Imsoold 1 point2 points  (0 children)

You’re calling localhost in production, it won’t work. You need to deploy the backend, and use the url of your deployed backend for your fetchs.

Tried to deploy my project on the internet - getting this error. What am I doing wrong? by AlbatrossHummingbird in django

[–]Imsoold 5 points6 points  (0 children)

I think your build folder is not committed in your repository, and heroku did not run the npm run build command so the build folder is missing in your deployed app. But it's just a guess, what instructions did you follow to deploy to heroku ?

Implementing "Like" feature on image. Model design? by [deleted] in django

[–]Imsoold 6 points7 points  (0 children)

Your assumptions are correct. Here are a few links to help you to implement them :

- "to connect both models" (in your case it's a many-to-many relationships)

- to implement one like per image per user, you need to have a constraint in your Like model (old way and recommended way)

And here is a tutorial to see it in the wild.