These are chat archives for django/django

Apr 2018
Nathan Kirui
Apr 05 2018 01:44
@rafahuelin maybe you can post your views implementation..regards
Apr 05 2018 03:12
@sudonitesh If you are willing to study new language. Then pick Python not just because it is a Django framework, Machine Learning, ... etc. If not pick node. And beware that it has memory leak issue. I did not use node for 2 years by now. Hopefully it has been fixed.
@rafahuelin I have never put reverse_lazy in the I put it at the APIView class or Viewsets
Akinwunmi Oluwaseun
Apr 05 2018 04:02
@rafahuelin I don't think you need to explicitly specify the LOGOUT_REDIRECT_URL in your settings. Since you're already using the logged_out.html template in your logout path, logged_out.html will be displayed after a user logs out.
@rafahuelin You can specify the LOGOUT_REDIRECT_URL if you want to redirect your user to maybe the login page or homepage after they log out.
Vishwas Mehra
Apr 05 2018 09:50
Hello can anyone tell me how can i connect to mongodb with mongoengine. I m using django 1.11, python 3.6, mongoengine 0.15 and mongodb 3.4.
Apr 05 2018 10:01
Where's the best place to do backend logic for a form view?
Would it be in the view class or the form class?

example - I have this form class

class RedeemCouponForm(forms.Form):
    coupon = forms.CharField(label='coupon')

    def do_stuff(self):
        coupon_code = self.cleaned_data['coupon']
        import ipdb; ipdb.set_trace()

        # do stuff like save coupon to  a user or something

and I also have this FormView

class RedeemCouponCodeView(LoginRequiredMixin, FormView):
    template_name = 'account/redeem_coupon_code.html'
    form_class = RedeemCouponForm
    success_url = '/thanks/'

    def form_valid(self, form):
        # This method is called when valid form data has been POSTed.
        # It should return an HttpResponse.

        return super().form_valid(form)

    def form_invalid(self, form):
        import ipdb; ipdb.set_trace()

So do I do the logic in form_valid or in the do_stuff function?

@karltaylor I put them in
Vishwas Mehra
Apr 05 2018 11:13
I have it all @elcolie but it was no help
My python shell cannot recognize the git command what should i do ?
Sirius Dely
Apr 05 2018 11:26
@vishwasmehra mongodb on django python, what does it have to do with git command?
Nitesh Tosniwal
Apr 05 2018 12:41
@elcolie I have learnt both. I just want to learn a language for backend in web development. But the jobs and internships for Django is much less than that of nodejs. So how should I choose?
Rafa Huelin
Apr 05 2018 13:28

Hi , thanks @Nkirui and @204070
The solution was to eliminate the LOGOUT_REDIRECT_URL and in order to allow to my logout template to overwrite, Django's default logged_out-html template I had to re-arrange the installed Apps list in the, with my App on top:

Application definition


# My Apps

# Django Apps


Miracle Ayodele
Apr 05 2018 15:14
Hi guys, i am trying to save into a model the same time a User model is created, so i decided to use signals, but the challenge i have is, the other model i ma creating into when a User model is created, only created the record on the OneToOne field
Nitesh Tosniwal
Apr 05 2018 17:48
Can we move to Django after basic understanding of python or we need to have deep knowledge in python? Or it's better to learn flask before django? PLEASE SUGGEST 🙏
Mateus Pádua
Apr 05 2018 18:54
You can move to Django directly
Nitesh Tosniwal
Apr 05 2018 18:57
@mateuspadua after completing basics of python?
Cristian Samaniego
Apr 05 2018 18:58
@sudonitesh yep i learnt a lot of python stuff when i was already working on django
Mateus Pádua
Apr 05 2018 18:58
Yeap, after you learning Python you can move to Django
but you can work with Django too learning Python together
Nitesh Tosniwal
Apr 05 2018 19:18
Ohkay.. Tysm @mateuspadua and @chrisRubiano
Mateus Pádua
Apr 05 2018 20:24