Saturday, December 31, 2016

Re: Happy New Year 2017

Happy new years! Better code, better goal and winning!


31 груд. 2016 20:57 "Lekan Wahab" <olamyy53@gmail.com> пише:
Happy New year guys.
Let's do more of this next year.

On Sat, Dec 31, 2016 at 7:49 PM, Robin Lery <robinlery@gmail.com> wrote:

Happy new year!


On 1 Jan 2017 12:05 a.m., "pradam programmer" <pradam.programming@gmail.com> wrote:
Happy New Year Guys, i hope this year fill with alot of love, happiness and Joy to everyone.


--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGGVXBOiUZcsYMyu237t2nirG%3DrzOD_v68b1AqYVkijk-fDk5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B4-nGr%2BajFGPFssTO9nKr94AECOiBSJ1KTiatgHDTzZJdd1fg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAE6v7oe%2BLdfyj3MnCTaiuY00oGC9hpaidCa9i%2Bd0FEGtcvWaBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADTRxJM_fot_xPa%3D5k-R0nLXf4z4XNYC%3D15mHdY-rG1T_2E4%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Happy New Year 2017

Happy New year guys.
Let's do more of this next year.

On Sat, Dec 31, 2016 at 7:49 PM, Robin Lery <robinlery@gmail.com> wrote:

Happy new year!


On 1 Jan 2017 12:05 a.m., "pradam programmer" <pradam.programming@gmail.com> wrote:
Happy New Year Guys, i hope this year fill with alot of love, happiness and Joy to everyone.


--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGGVXBOiUZcsYMyu237t2nirG%3DrzOD_v68b1AqYVkijk-fDk5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B4-nGr%2BajFGPFssTO9nKr94AECOiBSJ1KTiatgHDTzZJdd1fg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAE6v7oe%2BLdfyj3MnCTaiuY00oGC9hpaidCa9i%2Bd0FEGtcvWaBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Happy New Year 2017

Happy new year!


On 1 Jan 2017 12:05 a.m., "pradam programmer" <pradam.programming@gmail.com> wrote:
Happy New Year Guys, i hope this year fill with alot of love, happiness and Joy to everyone.


--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGGVXBOiUZcsYMyu237t2nirG%3DrzOD_v68b1AqYVkijk-fDk5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B4-nGr%2BajFGPFssTO9nKr94AECOiBSJ1KTiatgHDTzZJdd1fg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Happy New Year 2017

Happy New Year Guys, i hope this year fill with alot of love, happiness and Joy to everyone.


--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGGVXBOiUZcsYMyu237t2nirG%3DrzOD_v68b1AqYVkijk-fDk5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Friday, December 30, 2016

Re: Filtering a many2many relationship while aggregating?

Aha - I think this does it:

revised_ordered_series = racereg_models.Series.objects \
   
.filter(racedays__published=True, year=this_year, published=True) \
   
.annotate(latest_raceday=Max('racedays__date')) \
   
.order_by('latest_raceday')



On Friday, December 30, 2016 at 4:49:51 PM UTC-8, Richard Brockie wrote:
Hi,

I have the following many2many relationship between 2 models:

class RaceDay(models.Model):
    date
= models.DateField()
    published
= models.BooleanField(default=False)

class Series(models.Model):
    published
= models.BooleanField(default=False)
    year
= models.PositiveSmallIntegerField(default=2015)
    racedays
= models.ManyToManyField('RaceDay')




I can use the following annotation to get the Series ordered by the latest RaceDay in each series.

series_ordered_by_latest_raceday = Series.objects \
   
.annotate(latest_raceday=Max('racedays__date')) \
   
.filter(year=this_year, published=True) \
   
.order_by('latest_raceday')




The filter here applies to the fields in the Series model.

How would I limit the aggregation to members of the many2many relation that have RaceDay.published=True?

Thanks,
Richard Brockie

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ebeb4982-2b4c-442a-8f7a-83604ea9b8a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Filtering a many2many relationship while aggregating?

Hi,

I have the following many2many relationship between 2 models:

class RaceDay(models.Model):
    date
= models.DateField()
    published
= models.BooleanField(default=False)

class Series(models.Model):
    published
= models.BooleanField(default=False)
    year
= models.PositiveSmallIntegerField(default=2015)
    racedays
= models.ManyToManyField('RaceDay')




I can use the following annotation to get the Series ordered by the latest RaceDay in each series.

series_ordered_by_latest_raceday = Series.objects \
   
.annotate(latest_raceday=Max('racedays__date')) \
   
.filter(year=this_year, published=True) \
   
.order_by('latest_raceday')




The filter here applies to the fields in the Series model.

How would I limit the aggregation to members of the many2many relation that have RaceDay.published=True?

Thanks,
Richard Brockie

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c55c78b9-9774-4ba7-b858-b7af4e1aa506%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Advise for first project in Django

won't you try a little blog? To get familiar with web and stuff...


Em sexta-feira, 23 de dezembro de 2016 13:42:46 UTC-2, imed chaabouni escreveu:

Hello,


I am a Tunisian novice developer, and I am about to make my first project in Django this year after studying Python.

First thing comes to mind as a project was making a website music and listening online, so, I'd like to know if it's feasible or not ? and if you can advise me whether it's good to start with such a project or there is some other easier, because I 've got some struggle finding a clear answer on the Internet.


That's all, thank you for your time and consideration and excuse beginner's english.  

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/67f1688e-63c2-47ae-9f68-14e52f7f18f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

request.read() is empty in POST

Hello! I'm getting crazy, PLEASE someone, give me some light!!!

I'm using Django 1.10.4, Python 3.5 on Windows using Visual Studio Community 2015.

I have some class-based views to response some json.

from django.views.generic import View
from json import loads
from bson.json_util import dumps
from django.http import HttpResponse, HttpRequest

class Topicos(View):
   
def post(self, request):
       req
= request.read().decode(self.request.encoding)

Have the following setting on urls.py:

url(r'^api/Topicos', Topicos.Topicos.as_view(), name='Topicos'),

The request.read() is empty, the request is: 

POST /api/Topicos HTTP/1.1
Host: localhost:55020
Connection: keep-alive
Content-Length: 93
Accept: application/json, text/plain, */*
Origin:
http://localhost:55020
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
X-CSRFToken: VRiCt3Lz1EIdKGWt3lknpcgdFpD8XbrwSxdPT4P9dd1tbrGYmgE8uHdEIH2dzP5h
Content-Type: application/json;charset=UTF-8
Referer:
http://localhost:55020/
Accept-Encoding: gzip, deflate, br
Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: csrftoken=VRiCt3Lz1EIdKGWt3lknpcgdFpD8XbrwSxdPT4P9dd1tbrGYmgE8uHdEIH2dzP5h

{"titulo":"Título 1","mensagem":"mensagem","email":"
flavio@email.test.br","usuario":"Flávio"}


I really don't know what else I can do. I have the same code (except na class name) running correctly to another posts.














--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d754000c-e47b-4cee-bf0a-034ea5ee2e75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Static CSS file for custom widget

Have you looked at the media class ?

https://docs.djangoproject.com/en/1.10/topics/forms/media/

2016-12-29 13:20 GMT+01:00 Antonis Christofides <antonis@djangodeployment.com>:
> Hello everyone,
>
> can a custom widget specify a static CSS file? I think the <style> element is
> only allowed in the HTML header. So how can I write a custom widget that will
> make use of an additional static css file?
>
> Regards,
>
> Antonis
>
> --
> Antonis Christofides
> http://djangodeployment.com
>
> --
> 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+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9dbbda3e-9578-4656-4fcb-6099248f5665%40djangodeployment.com.
> For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Coues Ludovic
+336 148 743 42

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEuG%2BTaen4qYd%2BpEY3LXt1S8joEj7gk%2BqAKciAZWaHvv0cuEfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Advise for first project in Django

On Friday 23 December 2016 07:39:04 imed chaabouni wrote:

> I am a Tunisian novice developer, and I am about to make my first

> project in Django this year after studying Python.

 

Welcome.

 

> First thing comes to mind as a project was making a website music and

> listening online, so, I'd like to know if it's feasible or not ?

 

Do you mean that users can login, upload their music and listen to it anywhere?

 

Here's some starters:

--

Melvyn Sopacua

Re:Re: Django doesn't email reporting an internal server error (HTTP status code 500)


Thanks, SERVER_EMAIL is essential to this problem , I've written a article about the problem, learn more 
http://redstoneleo.blogspot.com/2016/12/email-reporting-exceptions-and-errors_30.html




在 2016-12-29 16:20:17,"Luis Zárate" <luisza14@gmail.com> 写道:

2016-12-28 9:45 GMT-06:00 Philip Lee <redstone-cold@163.com>:
Please help! The question are also posted here

I could send mail using the following code

E:\Python\django-test\LYYDownloaderServer>python manage.py shell    Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (In  tel)] on win32  Type "help", "copyright", "credits" or "license" for more information.  (InteractiveConsole)  >>> from django.core.mail import send_mail  >>>  >>> send_mail(  ...     'Subject here',  ...     'Here is the message.',  ...     'redstone-cold@163.com',  ...     ['2281570025@qq.com'],  ...     fail_silently=False,  ... )  1  >>> 

According to the doc:

When DEBUG is False, Django will email the users listed in the ADMINS setting whenever your code raises an unhandled exception and results in an internal server error (HTTP status code 500). This gives the administrators immediate notification of any errors. The ADMINS will get a description of the error, a complete Python traceback, and details about the HTTP request that caused the error.

but in my case, Django doesn't email reporting an internal server error (HTTP status code 500) enter image description here

what's the problem? please help fix the problem


settings.py

"""  Django settings for LYYDownloaderServer project.    Generated by 'django-admin startproject' using Django 1.9.1.    For more information on this file, see  https://docs.djangoproject.com/en/1.9/topics/settings/    For the full list of settings and their values, see  https://docs.djangoproject.com/en/1.9/ref/settings/  """    import os  ADMINS = [('Philip', 'r234327894@163.com'), ('Philip2', '768799875@qq.com')]  EMAIL_HOST = 'smtp.163.com'  # 'localhost'#'smtp.139.com'  # EMAIL_PORT = 25  # EMAIL_USE_TLS = True    EMAIL_HOST_USER = 'r234327894@163.com'  # '13529123633@139.com'  EMAIL_HOST_PASSWORD = '******'  # DEFAULT_FROM_EMAIL = 'r234327894@163.com'  # Build paths inside the project like this: os.path.join(BASE_DIR, ...)  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))      # Quick-start development settings - unsuitable for production  # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/    # SECURITY WARNING: keep the secret key used in production secret!  SECRET_KEY = 's4(z8qzt$=x(2t(ok5bb58_!u==+x97t0vpa=*8bb_68baekkh'    # SECURITY WARNING: don't run with debug turned on in production!  DEBUG = False    ALLOWED_HOSTS = ['127.0.0.1']#, '.0letter.com'      # Application definition    INSTALLED_APPS = [      'VideoParser.apps.VideoparserConfig',      'FileHost.apps.FilehostConfig',      'django.contrib.admin',      'django.contrib.auth',      'django.contrib.contenttypes',      'django.contrib.sessions',      'django.contrib.messages',      'django.contrib.staticfiles',  ]    MIDDLEWARE_CLASSES = [      'django.middleware.common.BrokenLinkEmailsMiddleware',      'django.middleware.security.SecurityMiddleware',      'django.contrib.sessions.middleware.SessionMiddleware',      'django.middleware.common.CommonMiddleware',      'django.middleware.csrf.CsrfViewMiddleware',      'django.contrib.auth.middleware.AuthenticationMiddleware',      'django.contrib.auth.middleware.SessionAuthenticationMiddleware',      'django.contrib.messages.middleware.MessageMiddleware',      'django.middleware.clickjacking.XFrameOptionsMiddleware',  ]    ROOT_URLCONF = 'LYYDownloaderServer.urls'    TEMPLATES = [      {          'BACKEND': 'django.template.backends.django.DjangoTemplates',          'DIRS': [],          'APP_DIRS': True,          'OPTIONS': {              'context_processors': [                  'django.template.context_processors.debug',                  'django.template.context_processors.request',                  'django.contrib.auth.context_processors.auth',                  'django.contrib.messages.context_processors.messages',              ],          },      },  ]    WSGI_APPLICATION = 'LYYDownloaderServer.wsgi.application'      # Database  # https://docs.djangoproject.com/en/1.9/ref/settings/#databases    DATABASES = {      'default': {          'ENGINE': 'django.db.backends.sqlite3',          'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),      }  }      # Password validation  # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators    AUTH_PASSWORD_VALIDATORS = [      {          'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',      },      {          'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',      },      {          'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',      },      {          'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',      },  ]      # Internationalization  # https://docs.djangoproject.com/en/1.9/topics/i18n/    LANGUAGE_CODE = 'en-us'    TIME_ZONE = 'UTC'    USE_I18N = True    USE_L10N = True    USE_TZ = True      # Static files (CSS, JavaScript, Images)  # https://docs.djangoproject.com/en/1.9/howto/static-files/    STATIC_URL = '/static/'

the start of views.py

from django.http import JsonResponse, HttpResponse  import logging  import m3u8  import os  from VideoParser.parsers.CommonParsers import *  import urllib.parse  import hashlib  from datetime import datetime, timedelta, date  from django.views.decorators.csrf import csrf_exempt  from django.db import IntegrityError  from VideoParser.models import *  from importlib import import_module  # print('-------------views --------')  FILES_DIR = 'files'    # specialHostName2module = {'56': 'v56'}  logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d %I:%M:%S %p', level=logging.ERROR, handlers=[logging.handlers.RotatingFileHandler(filename=os.path.join(FILES_DIR, 'LYYDownloaderServer.log'), maxBytes=1024 * 1024, backupCount=1)])  ...

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4e6cbea4-c415-4243-aafe-7457a22a8f10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
"La utopía sirve para caminar" Fernando Birri


--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/AygamXvx6ho/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAG%2B5VyN3PaXQQ-NsCG6SB%2B%2BCPxOQYjNZFyzCz9cts%2BrF%2BmL-DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


 

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1b38bf39.fc24.1594f7a2182.Coremail.redstone-cold%40163.com.
For more options, visit https://groups.google.com/d/optout.