Re: [Question] Django 2 - how to sum values based on filter and group by Year-Month

2018-07-26 Thread Gerald Brown
I am having a similar problem where I want to get the total (SUM) of about 20 - 30 items in a current day.  I can get the list of customers names and payments in a html table but so far haven't been able to get the SUM of those payments.  I have tried using Django ORM AGGREGATE SUM('integer fie

Re: learn dijango

2018-07-26 Thread Gerald Brown
The best way to learn Django is to jump in and start using it. If you have problems there are many tutorials and web sites (including this one) to provide help and support. IMHO, a teacher CANNOT teach a student, all they can do is HELP the student learn. On Thursday, 26 July, 2018 01:55 PM

Re: Optimizing Prefetch for Postgres IN Limit

2018-07-26 Thread Ram J
Hi Xof, The issue is that, when you do a naive Prefetch you are left with nothing but Django’s auto generated IN query. I was asking about he recommended way to make this into a JOIN, which is not obvious how to do with Django Also in my case the naive IN query on the PK *did not* generate a Inde

Re: Django makemigration polls error

2018-07-26 Thread Ashish Kumar
I'm using the latest version m8 On Wednesday, July 25, 2018 at 5:50:24 PM UTC+5:30, Okware Aldo wrote: > > I think he should share screenshot of his setting.py file, but from what I > can see -- if he is running django 1.10 and above apps should be 'polls' > not *'polls.apps.PollsConfig'* > >

Re: Django makemigration polls error

2018-07-26 Thread Ashish Kumar
thanks man. that was the mistake i did. On Wednesday, July 25, 2018 at 4:54:09 PM UTC+5:30, theAloneOne wrote: > > You may have missed a comma after *'polls.apps.PollsConfig'* in your > settings.py file in the *INSTALLED_APPS* list so check it again and you > may not be using the same django-ver

Re: Optimizing Prefetch for Postgres IN Limit

2018-07-26 Thread Christophe Pettus
> On Jul 25, 2018, at 02:59, Jason wrote: > > Where do you get that in the pg documentation? I can't find that anywhere > (google-fu may be failing me), and we do have some queries with more than 100 > values using IN. It's slightly more complicated than that. Above 100 entries, the Postgre

[Question] Django 2 - how to sum values based on filter and group by Year-Month

2018-07-26 Thread Charles Sartori
I have the following table: 2018-01-01 10 2018-01-15 20 2018-01-31 30 2018-02-01 10 2018-03-01 10 2018-03-20 20 I need to Sum() the values filtering it with 1 - sum(values) where date < first day of the month 2 - sum(values) where date < last day of the month Expec

Re: Django2.0.7 generate SQL query function is wrong(REGEXP_LIKE).

2018-07-26 Thread Hiroyuki Yamashita
Ohh.It's lacked my confirmation. Thanks guys. On Friday, July 27, 2018 at 1:00:05 AM UTC+9, Tim Graham wrote: > > This is a regression that will be fixed in Django 2.0.8: > https://code.djangoproject.com/ticket/29544 > > On Thursday, July 26, 2018 at 6:40:37 AM UTC-4, Jason wrote: >> >> what's th

Django App plugins

2018-07-26 Thread Christian González
Hello, I'm asking myself since a while how to create a Django app with plugins. I mean an extensible application that can be extended by plugins from an "app store". I did a lot of research on that, and it's not easy to manage it. I'm doing that using partly the REST framework for an API, and gra

Re: find difference of dates between today and filter list[dates]

2018-07-26 Thread Deepak Madan Singh
Great help; Thanks Derek On Thu, Jul 26, 2018 at 8:30 PM, Derek wrote: > Here's a created list of dates (before and after today) and a way to > calculate the offset days relative to today ("now") and alert at a set > interval: > > from __future__ import print_function > import datetime > > now =

Re: how to find activities dues for today and tommorow

2018-07-26 Thread Deepak Madan Singh
Thank you Julio :) On Thu, Jul 26, 2018 at 12:53 AM, Julio Biason wrote: > Hi Deepak, > > You could set up another model to track when something should be done to > the tree; something like this: > > class Tree(models.Model): > ... > planted_date = models.DateField() > > class Reminder(m

Code review

2018-07-26 Thread Kasper Laudrup
Hi fellow Django users, I've used Django to create a simple website for a summerhouse I have with my family. I'm not very experienced with Django, but is has been a real pleasure working with this framework and I don't really have any issues, but it would be nice if someone more experienced

Re: Prevent Django tests from accessing internet (except localhost)

2018-07-26 Thread Melvyn Sopacua
On donderdag 26 juli 2018 02:35:01 CEST Gene wrote: > Preventing code from using networking is a common approach for unit tests > Firewall is a completely different story and has nothing common with this > matter It does, because he's looking for a catch-all button. If you read the entire thread

Problem with sending django channels event from models

2018-07-26 Thread luan fonceca
Hello, i'm trying to implement a "post_save" signal wherever some user are update. I setup everything by following the documentation and some tutorials for Channels 2. I wrote a test using "py.test" to assert that everything is working as expected but i'm getting a exception

Change the default route of a view

2018-07-26 Thread Fernando Miranda
Hello, I'm using Django Rest Framework, I was wondering if you have how to change the default url of an endpoint in a view? In case it is a view of account where I wanted the retrieve method to be without / {id} this also for the delete and edit because I will identify the user by the token pas

Re: avoiding import-time queries

2018-07-26 Thread Julio Biason
Hi Clarvierplayer, Dunno if that's a best practice, but I'd add a module in the same app with functions to retrieve the information and use cache ( https://docs.djangoproject.com/en/2.0/topics/cache/#basic-usage) copiously. So, instead of loading the values at start up time, the values would be fi

avoiding import-time queries

2018-07-26 Thread clavierplayer
I'm looking for some best-practice (or at least workable) suggestions for avoiding import-time queries. I have some database records that are constant, and these constants are used all over the application. Is there any way to get those constants out of the database once at startup? At present

Re: Django2.0.7 generate SQL query function is wrong(REGEXP_LIKE).

2018-07-26 Thread Tim Graham
This is a regression that will be fixed in Django 2.0.8: https://code.djangoproject.com/ticket/29544 On Thursday, July 26, 2018 at 6:40:37 AM UTC-4, Jason wrote: > > what's the django orm code that generates that query? > > On Thursday, July 26, 2018 at 12:12:06 AM UTC-4, Hiroyuki Yamashita wrote

Re: find difference of dates between today and filter list[dates]

2018-07-26 Thread Derek
Here's a created list of dates (before and after today) and a way to calculate the offset days relative to today ("now") and alert at a set interval: from __future__ import print_function import datetime now = datetime.datetime.now() dates = [] for d in range(7, 0, -1): dates.append(datetim

Re: How to install django if user is using spyder

2018-07-26 Thread Derek
First - please don't hijack another topic; rather start your own. Second - Django recommends you use pip inside a virtualenv (for development); see: https://docs.djangoproject.com/en/2.0/topics/install/#installing-an-official-release-with-pip On Tuesday, 24 July 2018 15:33:16 UTC+2, Akhil Reddy

Re: learn dijango

2018-07-26 Thread victor reyes
Some python knomedge is a must if you plan on using Django. I also would recomend some basic mysql or postgres understanding On Thu, Jul 26, 2018, 7:14 AM arul wrote: > *I just entered the programming world and i know little bit > javascript,HTML can learn even I don't know any oop/scripting

Re: learn dijango

2018-07-26 Thread roshan ro
Hey, Yes you can , familiarize yourself with some oops concepts and learn python , you can does by doing some of the free materials on online , it would be better if you learn from the documentation itself. On Thu, Jul 26, 2018 at 7:44 PM arul wrote: > *I just entered the programming world and i

Re: learn dijango

2018-07-26 Thread Kasper Laudrup
Hi Arul On 2018-07-26 07:55, arul wrote: *I just entered the programming world and i know little bit javascript,HTML can learn even I don't  know any oop/scripting language can I learn django for now is there any possibility* Django is a framework, not a programming language. Django is wri

learn dijango

2018-07-26 Thread arul
*I just entered the programming world and i know little bit javascript,HTML can learn even I don't know any oop/scripting language can I learn django for now is there any possibility* -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubsc

Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
If I use as yours then there is no any trace in logs. On Thursday, July 26, 2018 at 7:12:31 PM UTC+5:30, prateek gupta wrote: > > I am using like below- > > logging({ > 'version': 1, > 'disable_existing_loggers': False, > 'formatters': { > 'default': { > # exact for

Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
I am using like below- logging({ 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'default': { # exact format is not important, this is the minimum information 'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s', },

Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
then it says - File "", line 219, in _call_with_frames_removed File "E:\cms-app\ps-cms\ps_cms\settings.py", line 256, in 'django.server': DEFAULT_LOGGING['loggers']['django.server'], TypeError: 'module' object is not callable On Thursday, July 26, 2018 at 7:06:10 PM UTC+5:30, Jason wrote:

Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread Jason
no, I mean like this: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'default': { # exact format is not important, this is the minimum information 'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s', },

Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
I have changes like below but does not have any affect- import logging # Disable Django's logging setup LOGGING_CONFIG = None LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper() logging.config.dictConfig({ 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'de

Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread Jason
You need to add the logging config to `LOGGING` in the settings for django to pick it up. logging.config.dictConfig doesn't do it. -- 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

Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
I tried with below one to include warning also but no any warning or error in logs- LOGGING_CONFIG = None LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper() logging.config.dictConfig({ 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'default': {

Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread Jason
OK, that's helpful. Your loggers are set to handle error and above, right? So Django's blocked from doing any logging below that, even with DEBUG = True On Thursday, July 26, 2018 at 7:46:19 AM UTC-4, prateek gupta wrote: > > I forgot to mentions, I am using logger also as below- > > # send se

Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
I forgot to mentions, I am using logger also as below- # send server errors to admin ADMINS = (('admin', 'ad...@example.com'),) MANAGERS = ADMINS # Logging configuration for production LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': {

Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread Jason
ok, so you don't even have any logging configuration at all, no wonder you don't see anything. I suggest you look in the docs for this: https://docs.djangoproject.com/en/2.0/topics/logging/ decent example https://gist.github.com/ipmb/0618f44dc5270f9a2be2826d0d933ed7 more reading https://li

Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
PFB my settings- # Reading data from the environment file ENV_FILE_PATH = os.path.join(BASE_DIR, 'config.json') try: with open(ENV_FILE_PATH) as env_file: ENV_TOKENS = json.load(env_file) except IOError: logger = logging.getLogger(__name__) logger.warning('Couldn\'t find the env

Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread Jason
sounds like you have a misconfiguration with your logging. post your LOGGING dict in your settings On Thursday, July 26, 2018 at 1:20:07 AM UTC-4, prateek gupta wrote: > > Hi Experts, > > I am facing a strange issue in my Django2.0.6+Mysql application. > > In my settings ,py I have set Debug=Tru

Re: Django2.0.7 generate SQL query function is wrong(REGEXP_LIKE).

2018-07-26 Thread Jason
what's the django orm code that generates that query? On Thursday, July 26, 2018 at 12:12:06 AM UTC-4, Hiroyuki Yamashita wrote: > > My name is Hiroyuki Yamashia. > > Create SQL query function is wrong by Django2.0.7. > > I using MariaDB and using "__regex". > > Django2.0.7 is generate this SQL

Re: Oracle Connection Problem

2018-07-26 Thread Kasper Laudrup
Hi Razibul, On 2018-07-26 02:43, Md. Razibul Hasan Mithu wrote: In oracle database ,what does NAME and HOST mean? Can you tell me in details? NAME is the name of the database, HOST is the hostname of the server running the database. Details here: https://docs.djangoproject.com/en/2.0/ref/d