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

2020-02-13 Thread Jérôme Le Carrou
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 * from pha_asp_sto left join pha_asp_par on pha_asp_par.asp_par_loc=asp_st

Re: installation of django

2020-02-13 Thread Mohammed Alnajdi
Try this pip —default-timeout=10 -v install django Your problem is either internet or antivirus. > > On 13 Feb 2020, at 8:36 AM, paarull shukla > wrote: > >  > Sir please help me out. I m not able to install it.. Getting trouble since 5 > days back > >> On Thu, 13 Feb, 2020, 5:29 AM Di

Running 2.7 python project with python 3.7

2020-02-13 Thread Luka Nik
Is there a way to run a project with python 3.7 if it's written with python 2.7? And what are my options if not? Cheers, Luka -- 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

Re: Running 2.7 python project with python 3.7

2020-02-13 Thread Nick Sarbicki
There is no natural reason as to why the project wouldn't run in python 3.7 unless you have written it in a way that is incompatible with 3.7 I would suggest simply trying to run it in python3.7 and seeing if you have any errors. Do you have a test suite with high coverage? Run that in 3.7 - it sh

Re: Running 2.7 python project with python 3.7

2020-02-13 Thread Kasper Laudrup
Hi Luka, On 13/02/2020 10.53, Luka Nik wrote: Is there a way to run a project with python 3.7 if it's written with python 2.7? And what are my options if not? The short answer is "it depends", the longer answer depends on you providing some more details, especially which kind of project you'

Re: Running 2.7 python project with python 3.7

2020-02-13 Thread Luka Nik
Thank you very much. Yeah, I overlooked that this is only django. My bad Luka On Thu, Feb 13, 2020 at 11:04 AM Kasper Laudrup wrote: > Hi Luka, > > On 13/02/2020 10.53, Luka Nik wrote: > > Is there a way to run a project with python 3.7 if it's written with > > python 2.7? > > And what are my

Re: filter objects dynamically on page render based on button click (beginner question)

2020-02-13 Thread Phil Kauffman
Bill, Thank You for taking the time to respond. I will definitely need to read up on the options you presented. My first inclination was to get familiar with the first option as it seems easiest. However, now that you mention VueJS I will look into that as well. On Wednesday, February 12, 2020

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

2020-02-13 Thread maninder singh Kumar
You of course mean, no foreign key ? Are the models pre written so no change can be made to them. Sent from my iPad > On 13-Feb-2020, at 2:58 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

Re: filter objects dynamically on page render based on button click (beginner question)

2020-02-13 Thread maninder singh Kumar
Have you looked at permissions ? Sent from my iPad > On 13-Feb-2020, at 6:06 PM, Phil Kauffman wrote: > > Bill, > > Thank You for taking the time to respond. I will definitely need to read up > on the options you presented. My first inclination was to get familiar with > the first option as

Re: makemessages fails

2020-02-13 Thread maninder singh Kumar
Is the app installed in settings.py Sent from my iPad > On 13-Feb-2020, at 10:49 AM, Yash Garg wrote: > > Go through i18n official documentation and specify path according to that. > >> On Thu 13 Feb, 2020, 10:25 AM Yves de Champlain, wrote: >> Hi >> >> I have >> >> ROOT_DIR = environ.Path(

Can anyone explain the incompatible change about “model.save()” in Django 3.0

2020-02-13 Thread Michael Zheng
>From the office release note, it says Model.save() no longer attempts to find a row when saving a new Model instance and a default value for the primary key is provided, and always performs a single INSERT query. In order to update an existing model for a specific primary key value, use t

Re: Django Hands On with Industry Oriented application

2020-02-13 Thread Ahmed Hashim
Hi, will this be an online training session? Total duration with charges? regards Ahmed On Thu, Feb 13, 2020 at 12:44 PM Saswat Ray wrote: > Please contact to 8885505922 for detail or direct mail me your contact > number > > *Thanks*, > *Saswat* > > https://www.linkedin.com/in/saswat-ray-27313

Manually running a script that imports a Django model

2020-02-13 Thread Sourish Kundu
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 error: *django.core.exceptions.ImproperlyConfigured: Request

Separating django business logiv from views

2020-02-13 Thread Mrunalini Ramnath
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. I found this method of implementation that involves creating a manager class for each model that c

Re: Is a Custom User Model worth the headache?

2020-02-13 Thread SikoraD
Hi Ben, I'll highly recommended to read fantastic post on Will Vincent blog -> https://wsvincent.com/django-tips-custom-user-model/ His approach is much easier than one on django website and it is worth to have look. Also his djangox repo on github is very useful. Bes

Re: makemessages fails

2020-02-13 Thread Yves de Champlain
Actually, while django-admin makemessages -l fr fails, python manage.py makemessages -l fr works well, so the problem really is the custom /config/settings/common.py settings file that need the DJANGO_SETTINGS_MODULE

Re: Manually running a script that imports a Django model

2020-02-13 Thread Adam Mičuda
Hi, the solution is written in the error message "You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure()...". But I would recommend you to use https://django-extensions.readthedocs.io/en/latest/runscript.html. I think it is what you are want. ;) Regards

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 * fro

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 e

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

2020-02-13 Thread Mehul Anshumali
Connect one table with another table using foreign key and then in command prompt type python manage.py shell and then import your table in shell then write queries . On Thu, Feb 13, 2020, 2:59 PM Jérôme Le Carrou wrote: > Hi, > > I have 2 models that are not related (maybe it should...) > > I n

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 tradition

Re: Unit Testing POST request

2020-02-13 Thread Adam Mičuda
Hi, or you can extract the business 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 > wrote: > >> Hi Devs, >> >> I was implementing unit-tests in my Django projec

Re: Unit Testing POST request

2020-02-13 Thread sachinbg sachin
Fistly for setup create use instance for setup user credentials then call that the reverse url in that post put delite On Thu, Feb 13, 2020, 8:01 PM Adam Mičuda wrote: > Hi, > or you can extract the business logic from view to some service and unit > test it instead. =) > > Regards. > > Adam > >

Re: filter objects dynamically on page render based on button click (beginner question)

2020-02-13 Thread Bill Freeman
Note that Vue is one option among many and could either be overkill or not helpful enough for your specific use case OR BOTH. It's just modern, and may be useful for projects beyond this one. It doesn't hurt to be familiar with the grand daddy of them all: jQuery (though many sneer at it today).

Re: Is a Custom User Model worth the headache?

2020-02-13 Thread bnmng
Thanks for the reply. That is a good post and I'll go along with the recommendation, though I still don't completely understand why adding a profile isn't as good as creating a custom user, and I wish I could figure out how to group custom users and auth groups together in the same admin secti

Django server indention

2020-02-13 Thread Sathiya S
How to format Indention in server? -- 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 to django-users+unsubscr...@googlegroups.com. To view this discussion on the web

Re: Is a Custom User Model worth the headache?

2020-02-13 Thread maninder singh Kumar
Here's my opinion on this : 1. It requires the.user model to be the first migration 2. You could either want to extend or customise the User model 3. If extending is all you want then use the default authentication I tried customising it didn't find it worth my time Willy Sent from my iPad >

Saving np.nan to sqlite database Django 2.1 in unit test fails

2020-02-13 Thread BK
I upgraded to django 2.1 and some of my unit tests (which use a sqlite database) are failing with the following: File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/django/db/models/query.py", line 268, in __iter__ 2113self._fetch_all() 2114 File "/home/travis/virtuale

Re: Manually running a script that imports a Django model

2020-02-13 Thread maninder singh Kumar
Could it be an improperly configured database ? Also check installed apps. It is most likely a syntax error in settings like a comma, colon or apostrophe Sent from my iPad > On 13-Feb-2020, at 7:34 PM, onlinejudge95 wrote: > >> On Thu, Feb 13, 2020 at 6:34 PM Sourish Kundu >> wrote: > >> S

Trouble after create a pool

2020-02-13 Thread Rodrigo Silva
Hi, I'm starting in django and learning about the tutorials. After I have been created and set up, when I run the server the shell show me a error Someone can help me? Than you! C:\Users\carva\mysite>python manage.py runserver Watching for file changes with StatReloader Performing system chec

Re: Unit Testing POST request

2020-02-13 Thread onlinejudge95
On Thu, Feb 13, 2020 at 8:02 PM Adam Mičuda wrote: > Hi, > or you can extract the business logic from view to some service and unit > test it instead. =) > I am following the same, it's just that I am also performing serialization as of now in my views, since I want to push it out first, and hav

Re: Unit Testing POST request

2020-02-13 Thread onlinejudge95
On Thu, Feb 13, 2020 at 8:14 PM sachinbg sachin wrote: > Fistly for setup create use instance for setup user credentials then call > that the reverse url in that post put delite > I have already created my test users in the *setUpClass()* method. As mentioned my problem was not something related

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

Sending json data to postgres once received from API

2020-02-13 Thread Ilya Rustamov
Hey Devs, First time poster here, if I am missing anything or am not following general rules and practices feel free to let me know. I am in the process of building an app that asks user for a url and on submit makes post request to said url, receives json data and simply prints it in a new

Re: Sending json data to postgres once received from API

2020-02-13 Thread Jody Fitzpatrick
Hello Ilya I would read the following: https://docs.djangoproject.com/en/3.0/topics/db/models/ Essentially, what you do in shell is what you would do in your code. I also believe you might want to look at how you are grabbing the posted data. I would use something like url = request.GET.get(

Re: Sending json data to postgres once received from API

2020-02-13 Thread Ilya Rustamov
Thank you Jody, I will take a look at this and see how it goes. On Thursday, February 13, 2020 at 3:27:03 PM UTC-5, Jody Fitzpatrick wrote: > > Hello Ilya > > I would read the following: > > https://docs.djangoproject.com/en/3.0/topics/db/models/ > > Essentially, what you do in shell is what you w

Has anyone ever deployed a Django project that uses Pyo to Heroku?

2020-02-13 Thread Kevin Dublin
Hi all, I'm trying to deploy an mvp of a django project on Heroku that works fine locally but only works online when I uninstall the package Pyo ( http://ajaxsoundstudio.com/pyodoc/index.html) or move my import to the specific function that uses it, but it throws an OSerror whenever it is initiali

Re: Trouble after create a pool

2020-02-13 Thread Jorge Gimeno
On Thu, Feb 13, 2020, 10:49 AM Rodrigo Silva < carvalhaes.silva.rodr...@gmail.com> wrote: >Hi, I'm starting in django and learning about the tutorials. > After I have been created and set up, when I run the server the shell show > me a error > > Someone can help me? Than you! > > C:\Users\carv

'list' object is not callable

2020-02-13 Thread Bhoopesh sisoudiya
Hi all, How to resolve this exception in generic view of rest-framework- api Exception=== 2020-02-14 08:30:33,523 - D:\futuredatapoints\futuredatapoints\logs\14022020 .log - ERROR ERROR:D:\futuredatapoints\futuredatapoints\logs\14022020.log:

Re: 'list' object is not callable

2020-02-13 Thread Jorge Gimeno
On Thu, Feb 13, 2020 at 7:16 PM Bhoopesh sisoudiya wrote: > Hi all, > > How to resolve this exception in generic view of rest-framework- api > Exception=== > 2020-02-14 08:30:33,523 - D:\futuredatapoints\futuredatapoints\logs\ > 14022020.log - ERROR > ERROR:D:\futuredatapoints\fut

Re: 'list' object is not callable

2020-02-13 Thread Bhoopesh sisoudiya
Thanks, Jorge Gimeno this is working fine. On Fri, Feb 14, 2020 at 9:19 AM Jorge Gimeno wrote: > > > On Thu, Feb 13, 2020 at 7:16 PM Bhoopesh sisoudiya > wrote: > >> Hi all, >> >> How to resolve this exception in generic view of rest-framework- api >> Exception=== >> 2020-02-14

Re: Images and pdfs for production level

2020-02-13 Thread Devender Kumar
I will suggest you go with AWS S3 you can use boto3 lib available for python On Thu, 13 Feb, 2020, 12:32 pm Soumen Khatua, wrote: > Yes,I want to use CDN for my static files. But I don't know how to > implement it. > > On Wed, Feb 12, 2020 at 9:04 PM Devender Kumar > wrote: > >> Some CDN >> >>