These are chat archives for django/django

17th
Oct 2018
Corey Vincent
@CoreyVincent
Oct 17 2018 01:45 UTC
@ajostergaard The author field. I'll look into the save function more, but it doesn't seem to have the capability to get the request.user object in the model.
Corey Vincent
@CoreyVincent
Oct 17 2018 02:19 UTC
I can see why a lot of people prefer Rails over Django, it's so simple and convoluted.
Corey Vincent
@CoreyVincent
Oct 17 2018 02:46 UTC
I need a django for dummies book...
AJ
@ajostergaard
Oct 17 2018 06:37 UTC
@CoreyVincent but then you'd have to code in Ruby! ;)
@CoreyVincent the best Django book is https://docs.djangoproject.com/en/dev/intro/
damionsilver98
@damionsilver98
Oct 17 2018 06:59 UTC
I need a front end developer , because I suck at designing a webpage. It never turn out how I want it.
Tanveer Ahmed
@tanveerobjects_twitter
Oct 17 2018 07:19 UTC
@damionsilver98 , Thanks I have fix this issue
Rajesh Yogeshwar
@rajeshyogeshwar
Oct 17 2018 08:43 UTC
Hello. I had a question regarding converting a django monolthic application to microservices architecture. If anybody is interested in discussing I would be happy to post the entire scenario.
Corey Vincent
@CoreyVincent
Oct 17 2018 11:27 UTC
@ajostergaard Thanks for your help. I'm sure if I beat my head against the screen enough, something will stick.

@ajostergaard So I tried the:

    def save_model(self, request, obj, form, change):
        obj.author = request.user
        super().save_model(request, obj, form, change)

It's not saving to the database though. It just keeps the same value from before it was edited...

Is it just on saving the first instance?
AJ
@ajostergaard
Oct 17 2018 11:50 UTC
@CoreyVincent that's surprising, have you tried adding some logging so you can see what is happening?
Corey Vincent
@CoreyVincent
Oct 17 2018 12:19 UTC
@ajostergaard I have not, I guess that will be my next step.
Corey Vincent
@CoreyVincent
Oct 17 2018 15:33 UTC
I thought there was a disabled attribute for model fields. But I'm just getting a unexpected keyword argument error. How do you set the input field to disabled instead of excluding it?
Corey Vincent
@CoreyVincent
Oct 17 2018 15:38 UTC
Or editable?
Corey Vincent
@CoreyVincent
Oct 17 2018 17:22 UTC
Nevermind, it didn't make sense to do that. I ignored disabling it, and just kept it as changing it on save. If I need to make a custom form then I'll add the disabled input there. But for the admin section, I'm sure it doesn't really matter. Or I could just do the exclude at that point.
kpagcha
@kpagcha
Oct 17 2018 17:23 UTC
would defining a new Form and instantiating it in a View (CBV extending View) be a good practice? I don't actually want a FormView, I am simply making a POST request and data should be validated
Corey Vincent
@CoreyVincent
Oct 17 2018 17:25 UTC
I should create a Django blog website for myself discussing my misadventures in Django. Keep people from making the mistakes I've made and make it easier for the people just beyond beginner.
@kpagcha If I were more experienced I would tell you the correct answer. But my inexperienced answer would be yes. If you don't need all of the functions of the FormView, and are just setting up a form to call a POST request, I'd say do it that way. I'm not sure if there are validations or security vulnerabilities doing that though.