Unit-Testing Django Views

2019-03-28 Thread OnlineJudge95
Hi people, I am following the book Test-Driven Development with Python by *Harry J.W. Perceval.* The book is using Django version 1.7 which is outdated as of now so I started with version 2.1. I am

Understanding of GIL

2019-12-19 Thread onlinejudge95
to be there) for the same in CPython interpreters. In case further information is required do let me know. Thanks onlinejudge95 -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email

Using generators in Django

2019-12-18 Thread onlinejudge95
having trouble understanding is a comment on my code review. Also don’t use generator you are bypassing django inbuilt caching > mechanism. Using integrator it will create another list and get them one by > one Any help would be appreciated. Thanks, onlinejudge95 -- You received this m

Re: Django: how to make queries between 2 tables that are not related in the model?

2020-02-13 Thread onlinejudge95
On Thu, Feb 13, 2020 at 2:59 PM Jérôme Le Carrou wrote: > Hi, > > I have 2 models that are not related (maybe it should...) > > I need to make a query that select all records of my table Stock WITH > related rows in Parametrage based on asp_sto_loc=asp_par_loc > > Something like SQL: select *

Re: Manually running a script that imports a Django model

2020-02-13 Thread onlinejudge95
On Thu, Feb 13, 2020 at 6:34 PM Sourish Kundu wrote: > So I am trying to access one of my models created in views.py in another > script. This second script is the one I would like manually run. It imports > the model without any errors; however, when I try to run it using PyCharm, > I get this

Re: Separating django business logiv from views

2020-02-13 Thread onlinejudge95
On Thu, Feb 13, 2020 at 6:34 PM Mrunalini Ramnath wrote: > Hey folks! > I've been researching on effective ways to separate business logic from > views.py. I currently also have separate files for helper functions but the > codebase is still a little cluttered. > How about going on the

Unit Testing POST request

2020-02-12 Thread onlinejudge95
e data through *request.data* and passing it to a serializer. In my current setting, I am getting a 400 error message when I have checked that the user does not exist. Any suggestions regarding the same? Thanks, onlinejudge95 -- You received this message because you are subscribed to the Google G

Re: Unit Testing POST request

2020-02-12 Thread onlinejudge95
Hi Guys, Any leads would be appreciated On Wed, Feb 12, 2020 at 6:22 PM onlinejudge95 wrote: > Hi Devs, > > I was implementing unit-tests in my Django project and stumbled upon the > following issue. > > I want to unit-test my POST route. I do not want to use the test client

Re: Unit Testing POST request

2020-02-13 Thread onlinejudge95
ess logic from view to some service and unit >> test it instead. =) >> >> Regards. >> >> Adam >> >> st 12. 2. 2020 v 21:15 odesílatel onlinejudge95 >> napsal: >> >>> On Wed, Feb 12, 2020 at 6:22 PM onlinejudge95 >>> wrot

Re: Django server indention

2020-02-13 Thread onlinejudge95
On Thu, Feb 13, 2020 at 9:02 PM Sathiya S wrote: > How to format Indention in server? > Are you talking about how to indent your code in Django? If yes then a learner's approach would be, well to do it yourself, I mean entire Python depends on indentation right? You can also look at psf/black

Re: Best Django Deployment

2020-01-23 Thread onlinejudge95
+1 on the question. Mainly whether the Apache + modWSGI or Nginx is the better way to go. On Fri, Jan 24, 2020, 7:41 AM Aldian Fazrihady wrote: > Google AppEngine fFex will handle everything for you, but for my > requirement, the price is too expensive, so I don't use it and I also don't > use

Re: Lots of errors after deploying and going live

2020-02-06 Thread onlinejudge95
It might be out of point but the moment you start noticing these errors repeatedly is the time you start considering using docker. On Tue, Feb 4, 2020 at 4:07 PM Dave Ko wrote: > Hi guys, so this is a very general post, I have been working on a django > blog following Corey Schafer's Django

Problem with serialising POST, PUT request in DRF

2020-02-06 Thread onlinejudge95
Hi Devs, I am trying to implement a CRUD app(modeling blogs) using Django & DRF. I am using *rest_framework.serializers.ModelSerializer* for serializing my model. While sending a POST, PUT request the serializer is not saving my data, what am I missing? *terminal* > Request data:- {'title':

Re: Key Error :access_token While requesting access token using windows Outlook api token url

2020-02-07 Thread onlinejudge95
Firstly, do not ever share any of your personal information over a mailing list. You just exposed your token and auth_code to the public domain. Secondly, you need to provide more context, you said an error came up but did not provide any insight into the code you are executing. On Fri, Feb 7,

Re: Trie Data Structure

2020-02-08 Thread onlinejudge95
, onlinejudge95 On Sat, Feb 8, 2020, 3:06 PM Soumen Khatua wrote: > from collections import defaultdict > > > class TrieNode(): > > def __init__(self): > self.children = defaultdict() > self.terminating = False > > > class Trie(): > > def __init__(self): > self.ro

Re: How to best secure environment variables (secret key, passwords etc.) stored in .yml files?

2020-02-08 Thread onlinejudge95
+1 for the same On Thu, Jan 30, 2020, 8:17 PM Chris Wedgwood wrote: > Hi Tom > > You are definitely not overthinking this. it's important. > > This is an area that has baked my noodle for a while now and I always am > left wondering "Do I have this right?" "Am I vulnerable to attack?" . >

Re: Django User Roles and user relations

2020-02-20 Thread onlinejudge95
On Thu, Feb 20, 2020 at 5:53 PM Kirankumar wrote: > Hii All.. > > I'm trying to give level roles like admin defaultly it is > available and Manager group and normal user groups in my django > aplication... > > Generally admin can fetch all the records created by all >

Re: Retaining text in search input boxes

2020-02-20 Thread onlinejudge95
+1 On Thu, Feb 20, 2020 at 4:25 PM Farai M wrote: > For drop downs use JavaScript script or JQuery to set the value of the > value of the selected item.For input use an if on the value if it's > populated then the input value is equal to the attribute us you put it > .Another option is to use

Re: Bootstrap Nav Bar

2020-02-20 Thread onlinejudge95
On Thu, Feb 20, 2020 at 8:24 PM Perceval Maturure wrote: > Dear all > I need help with making a bootstrap Nav bar which populates menus > restricted to a certain width of the nav bar > > Any pointers? > Maybe ask on a bootstrap mailing list > Regards > > -- > You received this message because

Re: Django rest framework error

2020-02-20 Thread onlinejudge95
On Thu, Feb 20, 2020 at 11:30 PM Soumen Khatua wrote: > If I'm using serializer then it's working fine but I want to return only > database object. So for that Do I need to add serializer. > You do have to serialize your responses, you just can't send Python objects as an HTTP response, think

Re: understanding urls, forms, and HTTP ERROR 405

2020-02-20 Thread onlinejudge95
On Thu, Feb 20, 2020 at 11:38 PM Phil Kauffman wrote: > Hello, > > Newbie in need of a little shove. It seems I need to review the purpose of > the urls.py file. At present I am getting an HTTP Error 405 with the > following: > HTTP 405 error code states the the HTTP method is not allowed on the

Re: Re: I am filling up the form but my filled out items are not rendering into database and also the session is not working

2020-02-19 Thread onlinejudge95
On Wed, Feb 19, 2020 at 11:31 PM wrote: > The template file > > > > > > <*form **method**="post" **novalidate*> > > No action attribute defined here. Where do you expect the data to be sent? > > {% csrf_token %} > > <*div **class**="form-group col-md-4 mb-0"*> > {{

Re: understanding urls, forms, and HTTP ERROR 405

2020-02-21 Thread onlinejudge95
f. If you can think of any posts or examples > please let me know. > > On Thursday, February 20, 2020 at 1:16:07 PM UTC-5, OnlineJudge95 wrote: > >> >> >> On Thu, Feb 20, 2020 at 11:38 PM Phil Kauffman >> wrote: >> >>> Hello, >>> >>

Re: Problem with Admin Page

2020-02-10 Thread onlinejudge95
Also, traceback would be awesome On Mon, Feb 10, 2020 at 12:09 AM Alessandro D' Oronzo wrote: > Hi everyone, > I have a problem with local web server and admin page. > When I try to connect to admin page the web server of Django close without > errors. > Do you have any ideas? > > Thanks so

Re: to add counter to an object of a table

2020-02-10 Thread onlinejudge95
Can you be more specific and provide more context about the same On Mon, Feb 10, 2020 at 12:15 AM BRAJESH KUMAR wrote: > Hi , > > I have a product details db class with few details for each object of that > class, need help to add a counter. > > > > Thanks, > > Brajesh > > > > > > Sent from

Re: How to create custom registration form in django rest api?

2020-02-17 Thread onlinejudge95
On Sun, Feb 16, 2020 at 3:19 PM maunish dave wrote: > I am creating an health care app which need to include patients and > doctors account, i have created Doctor model which have various info of > doctor now i want a serializer which maps this model to a proper html > registration form. > You

Re: Bootstrap not found

2020-02-17 Thread onlinejudge95
On Sun, Feb 16, 2020 at 8:36 PM Alessandro D' Oronzo wrote: > Hi everyone, > I have a problem with load bootstrap on my generic_template. > As best practices go around, try to include the static assets like CSS, js from a CDN instead of downloading and manually serving them > > This is error

Re: Image overwrite

2020-02-17 Thread onlinejudge95
On Sun, Feb 16, 2020 at 11:09 AM Soumen Khatua wrote: > Hi Folks, > > I have a model where user can upload their image. > I am assuming you are not storing the image as a blob but rather as an object in some object storage. > But after uploading a new image the old image is still their but as

Re: Retaining text in search input boxes

2020-02-17 Thread onlinejudge95
On Sun, Feb 16, 2020 at 11:26 AM maninder singh Kumar < maninder.s.ku...@gmail.com> wrote: > Wouldn't the value field make it fixed ? > Sure but you can always grab what value to insert from your views. If it is the first time form is being filled than simply use nothing as value, if the user

Re: Unit Testing POST request

2020-02-12 Thread onlinejudge95
On Wed, Feb 12, 2020 at 6:22 PM onlinejudge95 wrote: > Hi Devs, > > I was implementing unit-tests in my Django project and stumbled upon the > following issue. > > I want to unit-test my POST route. I do not want to use the test client > already shipped with Django (using i

Re: Retaining text in search input boxes

2020-02-15 Thread onlinejudge95
On Sun, Feb 16, 2020 at 12:22 AM Dick Arnold wrote: > I have a personnel database which has to be edited to keep it current. > I have created search parameters to find the person to edit. > The exact name of the person is not always known, therefore the name field > for searching can contain

Re: Unit Testing POST request

2020-02-13 Thread onlinejudge95
it out first, and have documented the refactor I would be performing. My question was on how to prepare a post request with proper payload, while i was running this test my response object was an empty dictionary. > > Regards. > > Adam > > st 12. 2. 2020 v 21:15 odesílatel onlinejudge95

Re: how to make docker image of your django app

2020-06-17 Thread onlinejudge95
On Wed, Jun 17, 2020 at 7:28 PM Jason Turner wrote: > > https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/ > > Also, Will Vincent's book "Django for Professionals" is a good resource. > > On Wed, Jun 17, 2020, 8:51 AM Anirudh choudhary < >