Re: Django best practices tutorial recommendation

2018-03-31 Thread Vineet Kothari
you get it in pdf online .

On Sat, Mar 31, 2018 at 11:21 AM, Roel Delos Reyes 
wrote:

> Hi, can anyone give me some guide where i can find a free ebook best
> practices alternative for the great Two Scoops of Django 1.11? Can't afford
> it this time.
>
> --
> 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 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/98868fa0-c937-42db-b390-c792b354b694%40googlegroups.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+unsubscr...@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/CAAcansuBNbb_RriHFT86UfDhmshYkMShdp1u3yEZgDYbvqSNBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: New Add-On: Django Model Lifecycle Hooks

2018-03-31 Thread Robert Singer

Thanks! Yup, should be compatible with Django 1.11. 

It is *only compatible* with Python 3.4 and up, though. There is no binding 
technical reason for this - it's just what my organization uses and I've 
been in habit of using type annotations. 

So if there is demand for Python 2.7 compatibility, I can certainly add 
it.  

On Saturday, March 31, 2018 at 3:33:28 PM UTC-5, tizonzon wrote:
>
> Very interesting! Good job. Is this module supported in 1.11?
>
>
>
> Sent from my iPhone
>
> On Mar 31, 2018, at 3:18 PM, George Silva  > wrote:
>
> From Reading the readme this looks promising.
>
> Congrats!
>
> I might use this soon.
>
> Em sáb, 31 de mar de 2018 15:50, Robert Singer  > escreveu:
>
>> Hey there - 
>>
>> I just wanted to let community know about a small add-on I wrote in order 
>> to add Rails-style hooks/callbacks to Django models. 
>> https://github.com/rsinger86/django-lifecycle
>>
>> Feedback welcome and appreciated :)
>>
>> Cheers. 
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/f1fbb963-2d36-46b3-ba76-7781c074918a%40googlegroups.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...@googlegroups.com .
> To post to this group, send email to django...@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/CAGyPVTuRCtt3SHwTR7%3DehKZzwcV-kMOCbOkdiJyMH%3DFgu4uZnA%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+unsubscr...@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/d5bbe153-7f2f-4196-951e-0ffdf1200377%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: New Add-On: Django Model Lifecycle Hooks

2018-03-31 Thread acheraime
Very interesting! Good job. Is this module supported in 1.11?



Sent from my iPhone

> On Mar 31, 2018, at 3:18 PM, George Silva  wrote:
> 
> From Reading the readme this looks promising.
> 
> Congrats!
> 
> I might use this soon.
> 
> Em sáb, 31 de mar de 2018 15:50, Robert Singer  
> escreveu:
>> Hey there - 
>> 
>> I just wanted to let community know about a small add-on I wrote in order to 
>> add Rails-style hooks/callbacks to Django models. 
>> https://github.com/rsinger86/django-lifecycle
>> 
>> Feedback welcome and appreciated :)
>> 
>> Cheers. 
>> -- 
>> 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 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/f1fbb963-2d36-46b3-ba76-7781c074918a%40googlegroups.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+unsubscr...@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/CAGyPVTuRCtt3SHwTR7%3DehKZzwcV-kMOCbOkdiJyMH%3DFgu4uZnA%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+unsubscr...@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/1D6CD5F7-F2B5-4FA5-911F-0C192EB7BEEB%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Display graphic on a website Problem

2018-03-31 Thread Rafael Madeira
 

Hello, can anyone help me ?

I try to display a graphic with curves changing every second on a website 
with the framework Django.

 

The problem here is as follows: I can’t see my display on the website.

 

The code is as follows:

 

*models.py:*

 

# -*- coding: utf-8 -*-

from __future__ import unicode_literals

 

from django.contrib.auth import models

from django.template.defaultfilters import slugify

from django.db import models

from django.contrib.auth.models import User

from django.utils import timezone

from django.conf import settings

:

:

:

(etc………)

import osmosdr

import time

import wx

 

class top_block(grc_wxgui.top_block_gui):

 

def __init__(self):

grc_wxgui.top_block_gui.__init__(self, title="Top Block")

:

:

(etc…)

:

 

def  get_samp_rate(self):

return self.samp_rate

 

def  set_samp_rate(self, samp_rate):

self.samp_rate = samp_rate

self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)

self.rtlsdr_source_0.set_sample_rate(self.samp_rate)

 

*views.py:*

 

# -*- coding: utf-8 -*-

from __future__ import unicode_literals

 

from django.shortcuts import render, get_object_or_404

from django.utils import timezone

from .models import Post, top_block

from  django.contrib.auth import models

from  django.contrib.auth.models import User 

from django.shortcuts import redirect

 

def main(request):

start = top_block.Start(True)

stop = top_block.Wait()

return render(request, 'blog/main.html', {'start':start}, 
{'stop':stop})

 

 

*urls.py:*

 

from django.conf.urls import url

from . import views 

 

urlpatterns = [

 url(r'^$', views.main, name='main'),  

]

 

 

*__init__.py:*

 

 

*apps.py:*

 

# -*- coding: utf-8 -*-

from __future__ import unicode_literals

 

from django.apps import AppConfig

 

 

class BlogConfig(AppConfig):

name = 'blog'

 

*base.html:*

 

{% load staticfiles %}



   



Le blog d'essaie









   

   





Blog de projet



 

 







{% block content %}

   {% 
endblock %}







   



 

*main.html:*

 

{% extends 'blog/base.html' %}

 

{% block content %}



{{start}}

{{stop}}



{% endblock %}

 

 

*blog.css:*

 

h1 a {

color: #FCA205;

font-family: 'Lobster';

}

 

body{

padding-left: 15px;

}

 

.page-header {

background-color: #ff9400;

margin-top: 0;

padding: 20px 20px 20px 40px;

}

 

.page-header h1,.page-header h1 a, .page-header h1 a:visited, .page-header 
h1 a:active {

color: #ff;

font-size: 36pt;

text-decoration: none;

}

 

.content{

margin-left: 40px;

}

 

h1, h2, h3, h4 {

font-family: 'Lobster', cursive;

}

 

.date{

float: right;

color: #828282;

}

 

.save{

float: right;

}

 

.post-form textarea, .post-form input {

with: 100%;

}

 

.top-menu, .top-menu:hover, .top-menu:visited{

color: #ff;

float: right;

font-size: 26pt;

margin-right: 20px;

}

 

.post {

margin-bottom: 70px;

}

 

.post h1 a, .post h1 a:visited {

color: #00;

}

 

 

 

 

 

 

 

 

 

-- 
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 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/2cb8794b-f861-4448-9eba-d0e6eb674868%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: New Add-On: Django Model Lifecycle Hooks

2018-03-31 Thread George Silva
>From Reading the readme this looks promising.

Congrats!

I might use this soon.

Em sáb, 31 de mar de 2018 15:50, Robert Singer 
escreveu:

> Hey there -
>
> I just wanted to let community know about a small add-on I wrote in order
> to add Rails-style hooks/callbacks to Django models.
> https://github.com/rsinger86/django-lifecycle
>
> Feedback welcome and appreciated :)
>
> Cheers.
>
> --
> 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 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/f1fbb963-2d36-46b3-ba76-7781c074918a%40googlegroups.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+unsubscr...@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/CAGyPVTuRCtt3SHwTR7%3DehKZzwcV-kMOCbOkdiJyMH%3DFgu4uZnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


New Add-On: Django Model Lifecycle Hooks

2018-03-31 Thread Robert Singer
Hey there - 

I just wanted to let community know about a small add-on I wrote in order 
to add Rails-style hooks/callbacks to Django models. 
https://github.com/rsinger86/django-lifecycle

Feedback welcome and appreciated :)

Cheers. 

-- 
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 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/f1fbb963-2d36-46b3-ba76-7781c074918a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Filtering Queryset by Foreign Key Properties

2018-03-31 Thread Daniel Sears
You may want to first write a test for this using something like pytest.
That's what I did and the following worked fine. Note that query is a
queryset, which is an iterable. So you have to index it. And
product__type__name
will ultimately match with a string because the name field in ProductType
is a CharField.

query = ProductImage.objects.filter(created  = 'green')

products_images_list =
ProductImage.objects.filter(product__type__name__contains=query[0].product.type)


On Fri, Mar 30, 2018 at 11:23 AM, Jamaldin Pro 
wrote:

> class ProductType(models.Model):
>> class Meta:
>> verbose_name_plural = 'тип'
>> verbose_name = 'типы'
>>
>> image = models.ImageField(upload_to='products_type_images/')
>> name = models.CharField(max_length=20, blank=True, null=True, 
>> default=None)
>> is_active = models.BooleanField(default=True)
>>
>> def __str__(self):
>> return "%s" % self.name
>>
>>
>> class Product(models.Model):
>> class Meta:
>> verbose_name_plural = 'запчасть'
>> verbose_name = 'запчасти'
>>
>> name = models.CharField(max_length=20)
>> price = models.DecimalField(max_digits=10, decimal_places=2, default=0)
>> short_description = models.TextField(blank=True, null=True, 
>> default=None, max_length=100)
>> description = models.TextField(blank=True, null=True, default=None)
>> is_active = models.BooleanField(default=True)
>> type = models.ForeignKey(ProductType, blank=True, null=True, 
>> default=None)
>>
>> def __str__(self):
>> return "(%s, %s)" % (self.id, self.name)
>>
>>
>> class ProductImage(models.Model):
>> class Meta:
>> verbose_name_plural = 'фотография_запчасти'
>> verbose_name = 'фотографии_запчасти'
>>
>> product = models.ForeignKey(Product, blank=True, null=True, default=None)
>> image = models.ImageField(upload_to='products_images/')
>> is_main = models.BooleanField(default=False)
>> is_active = models.BooleanField(default=True)
>> created = models.DateTimeField(default=timezone.now)
>>
>> def category(request, category_name):
> # products_images_list = get_object_or_404(Product, id=category_name)
> query = request.GET.get("q")
> if query:
>
> products_images_list = ProductImage.objects.filter(pr
> oduct__type__name__contains=query)
>
>
> But in my template this is not working I want to filter my product's
> types. Can you help my? Django 1.11
>
> Thank you.
>
>
> --
> 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 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/b501d828-0876-4bff-9eca-b667e11898fe%40googlegroups.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+unsubscr...@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/CALLzXtTE6BfXpzEzAT%2Brj%3DHiVOTZ0g_Q1cXkxPwf3nHVz0Q-PA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django best practices tutorial recommendation

2018-03-31 Thread Roel Delos Reyes
Hi, can anyone give me some guide where i can find a free ebook best 
practices alternative for the great Two Scoops of Django 1.11? Can't afford 
it this time.

-- 
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 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/98868fa0-c937-42db-b390-c792b354b694%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Updating Django for my web based application

2018-03-31 Thread Babatunde Akinyanmi
Hi Ahmed,
I made some inline comments

On Sat, 31 Mar 2018, 10:44 Haroon Ahmed,  wrote:

> Hi,
>
> I am using python 3.4 already!
> Yes my project is big, it is almost completed now but the requirement is
> to upgrade it to latest suitable release and that release should  not be
> insecure.
>
> when i started this project, it was not written on Django 1.9.8 official
> document that its an insecure version
>

Django is built with the highest regard for security. Sometimes some
security holes might be found but they are always plugged as soon as they
are found.

> Now i am thinking that Django 2 is not LTS so what is the guaranty that it
> will be a secure Django Version!
>

If security is your concern, the latest release of django is always your
best choice.

>
>
> On Sat, Mar 31, 2018, 2:34 PM Jani Tiainen  wrote:
>
>> Hi,
>>
>> In most cases, if possible I would upgrade latest release. Main issue
>> with 1.11 to 2.0 upgrade is Python 2 support. 1.11 is the last version to
>> support Python 2.7 and starting from Django 2.0 Python 3 is required.
>>
>> Of course, if your project is a big that takes long time to upgrade,
>> sticking with LTS isn't bad choice.
>>
>> On Sat, Mar 31, 2018 at 11:45 AM, Haroon Ahmed 
>> wrote:
>>
>>> Hi,
>>>
>>> Thanks for the information!
>>>
>>> Should i upgrade to Django 2 for my project? As Django 2 is not Long
>>> Time Supported.
>>> Django 1.11 is the latest release that is Long Time Supported yet!
>>>
>>> Should I go for Django 1.11 at the moment rather then Django 2.0? What
>>> will  be your suggestion for me?
>>>
>>> What is being followed in the industry, How to decide which Django
>>> should be chosen to upgrade the application?
>>>
>>>
>>> Thanks in advance!
>>>
>>>
>>>
>>> On Fri, Mar 30, 2018, 5:12 PM Jani Tiainen  wrote:
>>>
 Hi,

 Standard procedure to update Django is to upgrade gradually all
 versions from source version to target.

 There is no single document to describe changes needed between versions
 that are apart more than one release.

 Only changelog you can find is at every release which contains changes
 from previous release.

 You can try to combine required changes to directly upgrade.

 pe 30. maaliskuuta 2018 klo 14.07 Haroon Ahmed 
 kirjoitti:

> Hi,
>
> Currently my application is developed with Django 1.9.8 and I want to
> upgrade it to 2.0.3 because
> Django 1.9.8 is an insecure version of django as mention on it
> official documentation.
>
>
> https://docs.djangoproject.com/en/1.9/internals/release-process/#backwards-compatibility-policy
>
> This document is for an insecure version of Django that is no longer
> supported. Please upgrade to a newer release!
>
>
> Its my first time to update Django Version for my application,
> I have updated the Dango 1.9.8 to Django 2.0.3 in my virtual
> environment.
> I am using Python 3.4.4
>
> I haven't changes any thing in the code yet and facing some error
>
> \virtualEnv\DjangoUp\lib\site-packages\rest_framework\routers.py",
> line 23, in 
> from django.core.urlresolvers import NoReverseMatch
> ImportError: No module named 'django.core.urlresolvers'
>
> Some question that are coming into my mind:
>
>- Do i have to update my application according to new Django
>release every time when new Django version releases?
>- Is there any article or blog written that can help me to upgrade
>Django version from Django 1.9.8 to Django 2.0.3?
>- What people follow, dose most of the developers upgrade there
>web application according to new Django version release?
>
> Any kind of help will be appreciated, Thanks in advance.
>
> --
> 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 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/1162960f-46e4-4c24-9e36-df1d7edbb2eb%40googlegroups.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+unsubscr...@googlegroups.com.
 To post to this group, send email to 

How to modify a MonthArchiveView to show Quarter, Quarter and Semesters

2018-03-31 Thread Michel Vega Fuenzalida
Hello Group,

I want to show a result in Quarter, Term and Semester, but MonthArchiveView 
only shows results for 1 month. Has anyone accomplished this?

Thanks in advance

-- 
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 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/c32b702d-9310-48cf-8d21-02acaaa22efc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Filtering Queryset by Foreign Key Properties

2018-03-31 Thread Jamaldin Pro
Can anyone help me?

-- 
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 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/6fa171f0-1f2e-42b9-a13a-743050448fa4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django autocomplete light

2018-03-31 Thread Gerald Brown
Have a look at this article: 
https://simpleisbetterthancomplex.com/tutorial/2018/01/29/how-to-implement-dependent-or-chained-dropdown-list-with-django.html
 
It might do what you are trying to do.  There are also a lot of other posts 
about Django on this site.

On Saturday, September 16, 2017 at 7:24:48 PM UTC+8, Ahmet Muazim Tunç 
wrote:
>
> I want to make two or three dropdown menus which are dependent on each 
> other. It's Country, City dropdown menus and when Country is selected City 
> dropdown menu has to be filled with proper cities. How can I make this?
> I have the data, installed the django-cities-light app and filled my db 
> with the current country, city information
>

-- 
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 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/ce759fa1-dd99-41c8-b93f-c03afb990e49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django 2 autocomplete

2018-03-31 Thread Gerald Brown
Greetings:

Has anyone used the new Django2 autocomplete function? If so do you know of 
any tutorials or samples on how to set it up?

Thanks.

-- 
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 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/46992025-649d-4033-ae83-a5286e5a0820%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Decoupling Postgres database credentials in django for deployment.

2018-03-31 Thread Derek
How is github "security" going to help you keep your passwords safe and why 
is this better than ENV variables (which most of use without any problems).?

On Friday, 30 March 2018 16:50:03 UTC+2, Bill Torcaso wrote:
>
>
> I have a concern about using environment variables to hold secret 
> information, and an opinion about it.  
>
> IF
>
> DEBUG is enabled, and there is a 500 server internal error, and the 
> default 500 template is used to render the response, 
>
>
> THEN
>
> *all of your secret information is shown in the browser output*
>
>
> Of course, DEBUG should never be enabled in production.  But a single 
> human error might make it happen. 
>
> I would prefer to trust Github security and long passwords than to think I 
> am infallible about setting DEBUG. 
>
> Note that this is certainly what happens when I run on a Vagrant VM, and I 
> think it would be the same in a Docker-like container.
>
>
>
>
> On Thursday, March 29, 2018 at 4:24:40 PM UTC-4, prince gosavi wrote:
>>
>> Hi,
>> I have made a django project and want to deploy it on cloud.
>> Before that i want to decouple all the private information.
>> I want to decouple the database info too, like the username password etc.
>> Any help is appreciated.
>>
>

-- 
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 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/cea076e8-4dcc-4c7e-a845-92f1d914b2c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Filtering Queryset by Foreign Key Properties

2018-03-31 Thread Jamaldin Pro

>
> class ProductType(models.Model):
>
> image = models.ImageField(upload_to='products_type_images/')
> name = models.CharField(max_length=20, blank=True, null=True, 
> default=None)
> is_active = models.BooleanField(default=True)
>
> def __str__(self):
> return "%s" % self.name
>
>
> class Product(models.Model):
>
> name = models.CharField(max_length=20)
> price = models.DecimalField(max_digits=10, decimal_places=2, default=0)
> short_description = models.TextField(blank=True, null=True, default=None, 
> max_length=100)
> description = models.TextField(blank=True, null=True, default=None)
> is_active = models.BooleanField(default=True)
> type = models.ForeignKey(ProductType, blank=True, null=True, default=None)
>
> def __str__(self):
> return "(%s, %s)" % (self.id, self.name)
>
>
> class ProductImage(models.Model):
>
> product = models.ForeignKey(Product, blank=True, null=True, default=None)
> image = models.ImageField(upload_to='products_images/')
> is_main = models.BooleanField(default=False)
> is_active = models.BooleanField(default=True)
> created = models.DateTimeField(default=timezone.now)
>
>
 

def category(request):
query = request.GET.get("q")
if query:

  products_images_list = ProductImage.objects.filter(
product__type__name__contains=query) 




But in my template this is not working I want to filter my product's types. 
Can you help my? Django 1.11

Thank you.
 

-- 
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 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/751007f9-f6e5-4a41-88d0-e08f80995865%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to update form after a user select a choice

2018-03-31 Thread xueqi dong
Hi thanks for advice. Though could you please provide an example somewhere?
my application probably needs to use javescript once  - it is a bit hard to
learn javascript from the beginning...

...
Xueqi Dong
Teaching Fellow, Economics group, Newcastle University Business School
5 Barrack Road, Newcastle, NE1 4SE, UK
Tel: +44  7780113210
Email: xueqidon...@gmail.com
Linkedin: https://sites.google.com/site/xueqidotdong/home

On 31 March 2018 at 13:02, Jani Tiainen  wrote:

> Hi,
>
> You need to write a piece of javascript that attaches to your radio
> buttons to call some javascript function to do what ever you want to happen.
>
> You can use js libraries like jquery to make things easier.
>
> 31.3.2018 14.15 "xueqi dong"  kirjoitti:
>
>
> 
> Hi, I would like to achieve the function as shown in the picture above.
> When an user click the radio button Lottery 1, Lottery 1 in the table above
> will become highlighted by colour yellow. When the form is initially
> rendered, neither lotteries are highlighted.
>
> I googled this and it seems that this has to be done on the client side
> and has little to do with Django. But I am not sure how to track the value
> of the selected choice in html. I know I can get the value of the submitted
> choice use forms.cleaned_data in views.py.
>
> In my form.py I have
>
> class AnswerForm(forms.Form):
> ANSWER_CHOICES = (
> (1, 'Lottery 1'),
> (2, 'Lottery 2'),
> )
> answer = forms.ChoiceField(choices=ANSWER_CHOICES, 
> widget=forms.RadioSelect)
> question = forms.IntegerField(widget=forms.HiddenInput)
>
>
> In problems.html template I have
>
> 
> 
>
>
>
> Please make a choice between two lotteries.
> Which lottery do you want choose   
>
>
>
>  
>   Two lotteries
>
> 
> "green">
>  
>
> State 1
>State 2
>State 3
>  
>
>  
> Lottery 1
> {{ problem.0 }}{{ sltlottery }}
>  {{ problem.1 }} 
>  {{ problem.2 }}
>  
>
>
> Lottery 2
>  {{ problem.3 }} 
>   {{ problem.4 }} 
>   {{ problem.5 }} 
>  
>
>   
>
>
>
>
>
> 
> {% csrf_token %}
> {{ form.as_p }}
> 
> 
>
>
> It looks like i need a logic statement like the following :  if selected
> choice =1, colour 1= "yellow", colour 2= "white"  else: colour 2= "yellow",
> colour 1= "white"
>
> There are two crucial steps I am not sure how to do.
>
> First, after an user select on choice by click the Radio button, how can I
> track the associated value?  For example, when Lottery 1 is selected, I
> need selected choice =1.
> Second, what is the easiest way to set write the logic statement in html?
> I am even not quite sure where to put the logic statement...
>
> Any help would be much appreciated!
>
> Xueqi
>
> --
> 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 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/3bca5139-ff0c-4124-a937-947b33bd2c4c%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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/sQDVzoL6D_0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@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/CAHn91ofsLWuqcPrT5fksb503ZUT_Nn3BGF3mXCFxwc3OGG%2BTag%
> 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 

Re: Django Version update for my project

2018-03-31 Thread Andréas Kühne
Hi - see my comments below.

2018-03-30 8:44 GMT+02:00 Haroon Ahmed :

> Hi,
>
> I want to update my Django version from Django 1.9.8 to Django 2.0.3
> because it is mentioned in the Django 1.9.8 official document that this
> version has security issues.
>
> https://docs.djangoproject.com/en/1.9/internals/release-
> process/#backwards-compatibility-policy
> 'This document is for an insecure version of Django that is no longer
> supported. Please upgrade to a newer release!'
>
> This is my first time to upgrade Django version for my project.
> I simply upgraded Django in my virtual environment to Django 2.0.3, now i
> am facing errors about url resolver etc. At the moment i haven't changed my
> code.
>

You should be able to upgrade most of your code pretty simply and get it
working in django 2.0 with not that much problems. There are a couple of
places where the packages have moved (for exmaple the urlresolvers package)
- but if you have a good editor with code completion, you should be able to
find those places pretty quickly.


>
> I have some questions in my mind:
>
>- Do we have to upgrade Django whenever the new Django version is
>released?
>
>
You have actually 2 different approaches to this depending on what you want
to do:
1. Every now and then django releases an LTS version (current LTS is 1.11).
That version will receive security updates - but no new features - for its
entire lifetime (usually around 3 years). Running on a LTS version can be a
good idea, all you then need to do is update the patch versions, which
shouldn't require you to update any of your code. This also might be needed
if you are running on legacy Python (Python 2.7.x)

2. Always upgrade to the latest version when possible - this will require
changing things from time to time in your code. The reason being new
features that are implemented - However upgrading minor versions should
always "just work".


>
>-
>- At the moment if i am able to upgrade my Project with Django 2 and
>after some time this version also  become insecure then i have to repeat
>the Django version updates again?
>
>
This is the same question as above, but the short answer is that you should
maintain your code running on either the latest LTS version or the latest
version of django. The reason being security updates - you don't want to
fall behind on changes that mean that your users are vulnerable to security
issues.


>
>- Is there any blog written or any helpful materiel for me  that How
>to upgrade Django Version so that my project comes in working state?
>
>
I think what you should do is check the release notes for each version that
you are upgrading through. In your case that would be 1.10, 1.11 and
finally version 2.0.

See here:
https://docs.djangoproject.com/en/2.0/releases/1.10/
https://docs.djangoproject.com/en/2.0/releases/1.11/
https://docs.djangoproject.com/en/2.0/releases/2.0/



> Any kind of help will be appreciated, Thanks in advance.
>
> --
> 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 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/72b7acd8-f8a5-4c50-87b5-fb9b6e4c9e63%40googlegroups.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+unsubscr...@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/CAK4qSCdU8%3D-m2gWu2tDbS8kmUDoqpyHRvLAWNEXrGeLQFTG1Yw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Decoupling Postgres database credentials in django for deployment.

2018-03-31 Thread Andréas Kühne
All you should do is have production settings as default - all settings
(like DEBUG) should be set the way you use them in production. Then you
have a local setting on your development machine - that should enable DEBUG
and also NEVER be stored in the repository.

Development settings should not be stored as defaults in settings.py.

Med vänliga hälsningar,

Andréas

2018-03-30 18:09 GMT+02:00 Phang Mulianto :

> I agree to set debug to false in your production configuration file. Never
> debug on production setup.
>
> If need enable debug on, use in staging environment or with different
> django configuration files.
>
>
>
> On Fri, 30 Mar 2018 23:52 PASCUAL Eric,  wrote:
>
>> You're perfectly right about the "500 Error + DEBUG" case.
>>
>>
>> One solution is to set DEBUG to off by default, and turn it on by code in
>> the setting module if detecting  that the app is executing in a dev or Q
>> environment. Depending on your context, this can be done with rules based
>> on the host name or some other properties of the target systems.
>>
>>
>> Best
>>
>>
>> Eric
>>
>> --
>> *From:* django-users@googlegroups.com  on
>> behalf of Bill Torcaso 
>> *Sent:* Friday, March 30, 2018 4:50:02 PM
>> *To:* Django users
>> *Subject:* Re: Decoupling Postgres database credentials in django for
>> deployment.
>>
>>
>> I have a concern about using environment variables to hold secret
>> information, and an opinion about it.
>>
>> IF
>>
>> DEBUG is enabled, and there is a 500 server internal error, and the
>> default 500 template is used to render the response,
>>
>>
>> THEN
>>
>> *all of your secret information is shown in the browser output*
>>
>>
>> Of course, DEBUG should never be enabled in production.  But a single
>> human error might make it happen.
>>
>> I would prefer to trust Github security and long passwords than to think
>> I am infallible about setting DEBUG.
>>
>> Note that this is certainly what happens when I run on a Vagrant VM, and
>> I think it would be the same in a Docker-like container.
>>
>>
>>
>>
>> On Thursday, March 29, 2018 at 4:24:40 PM UTC-4, prince gosavi wrote:
>>
>> Hi,
>> I have made a django project and want to deploy it on cloud.
>> Before that i want to decouple all the private information.
>> I want to decouple the database info too, like the username password etc.
>> Any help is appreciated.
>>
>> --
>> 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 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/f5a1498a-3383-4219-b10e-e3e64f164658%
>> 40googlegroups.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+unsubscr...@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/DB7P193MB03311541D366207EF7606
>> 9C28CA10%40DB7P193MB0331.EURP193.PROD.OUTLOOK.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+unsubscr...@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%2BSr5mTee6UdLUqXUnr8Pz1HNp5YTL
> %2BMME3-gjp_Mc-Q2CNJNQ%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 

Re: how to update form after a user select a choice

2018-03-31 Thread Jani Tiainen
Hi,

You need to write a piece of javascript that attaches to your radio buttons
to call some javascript function to do what ever you want to happen.

You can use js libraries like jquery to make things easier.

31.3.2018 14.15 "xueqi dong"  kirjoitti:


Hi, I would like to achieve the function as shown in the picture above.
When an user click the radio button Lottery 1, Lottery 1 in the table above
will become highlighted by colour yellow. When the form is initially
rendered, neither lotteries are highlighted.

I googled this and it seems that this has to be done on the client side and
has little to do with Django. But I am not sure how to track the value of
the selected choice in html. I know I can get the value of the submitted
choice use forms.cleaned_data in views.py.

In my form.py I have

class AnswerForm(forms.Form):
ANSWER_CHOICES = (
(1, 'Lottery 1'),
(2, 'Lottery 2'),
)
answer = forms.ChoiceField(choices=ANSWER_CHOICES, widget=forms.RadioSelect)
question = forms.IntegerField(widget=forms.HiddenInput)


In problems.html template I have






Please make a choice between two lotteries.
Which lottery do you want choose   



 
  Two lotteries
   

   
 
   
State 1
   State 2
   State 3
 

 
Lottery 1
{{ problem.0 }}{{ sltlottery }}
 {{ problem.1 }} 
 {{ problem.2 }}
 

   
Lottery 2
 {{ problem.3 }} 
  {{ problem.4 }} 
  {{ problem.5 }} 
 

  

   




{% csrf_token %}
{{ form.as_p }}




It looks like i need a logic statement like the following :  if selected
choice =1, colour 1= "yellow", colour 2= "white"  else: colour 2= "yellow",
colour 1= "white"

There are two crucial steps I am not sure how to do.

First, after an user select on choice by click the Radio button, how can I
track the associated value?  For example, when Lottery 1 is selected, I
need selected choice =1.
Second, what is the easiest way to set write the logic statement in html? I
am even not quite sure where to put the logic statement...

Any help would be much appreciated!

Xueqi

-- 
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 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/3bca5139-ff0c-4124-a937-947b33bd2c4c%40googlegroups.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+unsubscr...@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/CAHn91ofsLWuqcPrT5fksb503ZUT_Nn3BGF3mXCFxwc3OGG%2BTag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


how to update form after a user select a choice

2018-03-31 Thread xueqi dong



Hi, I would like to achieve the function as shown in the picture above. 
When an user click the radio button Lottery 1, Lottery 1 in the table above 
will become highlighted by colour yellow. When the form is initially 
rendered, neither lotteries are highlighted.

I googled this and it seems that this has to be done on the client side and 
has little to do with Django. But I am not sure how to track the value of 
the selected choice in html. I know I can get the value of the submitted 
choice use forms.cleaned_data in views.py.

In my form.py I have 

class AnswerForm(forms.Form):
ANSWER_CHOICES = (
(1, 'Lottery 1'),
(2, 'Lottery 2'),
)
answer = forms.ChoiceField(choices=ANSWER_CHOICES, widget=forms.RadioSelect)
question = forms.IntegerField(widget=forms.HiddenInput)


In problems.html template I have 






Please make a choice between two lotteries.
Which lottery do you want choose   



 
  Two lotteries
   

   
 
   
State 1
   State 2
   State 3
 

 
Lottery 1
{{ problem.0 }}{{ sltlottery }}
 {{ problem.1 }} 
 {{ problem.2 }}
 

   
Lottery 2
 {{ problem.3 }} 
  {{ problem.4 }} 
  {{ problem.5 }} 
 

  

   




{% csrf_token %}
{{ form.as_p }}




It looks like i need a logic statement like the following :  if selected 
choice =1, colour 1= "yellow", colour 2= "white"  else: colour 2= "yellow", 
colour 1= "white"

There are two crucial steps I am not sure how to do.

First, after an user select on choice by click the Radio button, how can I 
track the associated value?  For example, when Lottery 1 is selected, I 
need selected choice =1.
Second, what is the easiest way to set write the logic statement in html? I 
am even not quite sure where to put the logic statement...

Any help would be much appreciated!

Xueqi

-- 
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 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/3bca5139-ff0c-4124-a937-947b33bd2c4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Unable to Send Email

2018-03-31 Thread yingi keme
Okk. Thanks

I will consult with them

Yingi Kem

> On 31 Mar 2018, at 11:52 AM, Jani Tiainen  wrote:
> 
> Hi,
> 
> Error means that user which is used as sender of email is actually not 
> permitted to send emails.
> 
> You need to check with your IT support is your support@**.org allowed to 
> send emails through your smtp provider.
> 
> la 31. maaliskuuta 2018 klo 13.30 yingi keme  kirjoitti:
>> Hi
>> 
>> I am getting a SMTPData Error when i try to send message from my django 
>> application
>> 
>> The Error it gives is this
>> 
>> 
>> smtplib.SMTPDataError: (550, b'5.7.60 SMTP; Client does not have permissions 
>> to send as this sender [BN6PO18UB1201.namprd18.prod.outlook.com]')
>> 
>> In My settings.py I have the following
>> 
>> EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
>> 
>> EMAIL_HOST = 'smtp.office365.com'
>> EMAIL_HOST_USER = 'support@**.org'
>> EMAIL_HOST_PASSWORD = '**'
>> EMAIL_PORT = 587
>> EMAIL_USE_TLS = True
>> DEFAULT_FROM_EMAIL = 'support@**.org'
>> SERVER_EMAIL = 'support@***.org'
>> 
>> What could possibly be wrong?
>> 
>> -- 
>> 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 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/3772af22-43d6-4f4d-89cf-e41426fe9245%40googlegroups.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+unsubscr...@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/CAHn91oeD1R3gMxiJhdXUYdMXQ3xupOjD4ML-dOjFio5mew8uxg%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+unsubscr...@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/C12A52FD-A354-44EE-B815-DCD18BCE43EA%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Unable to Send Email

2018-03-31 Thread Jani Tiainen
Hi,

Error means that user which is used as sender of email is actually not
permitted to send emails.

You need to check with your IT support is your support@**.org allowed
to send emails through your smtp provider.

la 31. maaliskuuta 2018 klo 13.30 yingi keme 
kirjoitti:

> Hi
>
> I am getting a SMTPData Error when i try to send message from my django
> application
>
> The Error it gives is this
>
>
> smtplib.SMTPDataError: (550, b'5.7.60 SMTP; Client does not have
> permissions to send as this sender [
> BN6PO18UB1201.namprd18.prod.outlook.com]')
>
> In My settings.py I have the following
>
> EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
>
> EMAIL_HOST = 'smtp.office365.com'
> EMAIL_HOST_USER = 'support@**.org'
> EMAIL_HOST_PASSWORD = '**'
> EMAIL_PORT = 587
> EMAIL_USE_TLS = True
> DEFAULT_FROM_EMAIL = 'support@**.org'
> SERVER_EMAIL = 'support@***.org'
>
> What could possibly be wrong?
>
> --
> 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 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/3772af22-43d6-4f4d-89cf-e41426fe9245%40googlegroups.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+unsubscr...@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/CAHn91oeD1R3gMxiJhdXUYdMXQ3xupOjD4ML-dOjFio5mew8uxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Unable to Send Email

2018-03-31 Thread yingi keme
Hi

I am getting a SMTPData Error when i try to send message from my django 
application

The Error it gives is this


smtplib.SMTPDataError: (550, b'5.7.60 SMTP; Client does not have 
permissions to send as this sender 
[BN6PO18UB1201.namprd18.prod.outlook.com]')

In My settings.py I have the following

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

EMAIL_HOST = 'smtp.office365.com'
EMAIL_HOST_USER = 'support@**.org'
EMAIL_HOST_PASSWORD = '**'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'support@**.org'
SERVER_EMAIL = 'support@***.org'

What could possibly be wrong?

-- 
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 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/3772af22-43d6-4f4d-89cf-e41426fe9245%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Updating Django for my web based application

2018-03-31 Thread Jani Tiainen
Hi,

See https://www.djangoproject.com/weblog/2015/jun/25/roadmap/  how Django
releases and fixes are applied.

la 31. maaliskuuta 2018 klo 12.45 Haroon Ahmed 
kirjoitti:

> Hi,
>
> I am using python 3.4 already!
> Yes my project is big, it is almost completed now but the requirement is
> to upgrade it to latest suitable release and that release should  not be
> insecure.
>
> when i started this project, it was not written on Django 1.9.8 official
> document that its an insecure version
>
> Now i am thinking that Django 2 is not LTS so what is the guaranty that it
> will be a secure Django Version!
>
>
> On Sat, Mar 31, 2018, 2:34 PM Jani Tiainen  wrote:
>
>> Hi,
>>
>> In most cases, if possible I would upgrade latest release. Main issue
>> with 1.11 to 2.0 upgrade is Python 2 support. 1.11 is the last version to
>> support Python 2.7 and starting from Django 2.0 Python 3 is required.
>>
>> Of course, if your project is a big that takes long time to upgrade,
>> sticking with LTS isn't bad choice.
>>
>> On Sat, Mar 31, 2018 at 11:45 AM, Haroon Ahmed 
>> wrote:
>>
>>> Hi,
>>>
>>> Thanks for the information!
>>>
>>> Should i upgrade to Django 2 for my project? As Django 2 is not Long
>>> Time Supported.
>>> Django 1.11 is the latest release that is Long Time Supported yet!
>>>
>>> Should I go for Django 1.11 at the moment rather then Django 2.0? What
>>> will  be your suggestion for me?
>>>
>>> What is being followed in the industry, How to decide which Django
>>> should be chosen to upgrade the application?
>>>
>>>
>>> Thanks in advance!
>>>
>>>
>>>
>>> On Fri, Mar 30, 2018, 5:12 PM Jani Tiainen  wrote:
>>>
 Hi,

 Standard procedure to update Django is to upgrade gradually all
 versions from source version to target.

 There is no single document to describe changes needed between versions
 that are apart more than one release.

 Only changelog you can find is at every release which contains changes
 from previous release.

 You can try to combine required changes to directly upgrade.

 pe 30. maaliskuuta 2018 klo 14.07 Haroon Ahmed 
 kirjoitti:

> Hi,
>
> Currently my application is developed with Django 1.9.8 and I want to
> upgrade it to 2.0.3 because
> Django 1.9.8 is an insecure version of django as mention on it
> official documentation.
>
>
> https://docs.djangoproject.com/en/1.9/internals/release-process/#backwards-compatibility-policy
>
> This document is for an insecure version of Django that is no longer
> supported. Please upgrade to a newer release!
>
>
> Its my first time to update Django Version for my application,
> I have updated the Dango 1.9.8 to Django 2.0.3 in my virtual
> environment.
> I am using Python 3.4.4
>
> I haven't changes any thing in the code yet and facing some error
>
> \virtualEnv\DjangoUp\lib\site-packages\rest_framework\routers.py",
> line 23, in 
> from django.core.urlresolvers import NoReverseMatch
> ImportError: No module named 'django.core.urlresolvers'
>
> Some question that are coming into my mind:
>
>- Do i have to update my application according to new Django
>release every time when new Django version releases?
>- Is there any article or blog written that can help me to upgrade
>Django version from Django 1.9.8 to Django 2.0.3?
>- What people follow, dose most of the developers upgrade there
>web application according to new Django version release?
>
> Any kind of help will be appreciated, Thanks in advance.
>
> --
> 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 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/1162960f-46e4-4c24-9e36-df1d7edbb2eb%40googlegroups.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+unsubscr...@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
 

Re: Updating Django for my web based application

2018-03-31 Thread Haroon Ahmed
Hi,

I am using python 3.4 already!
Yes my project is big, it is almost completed now but the requirement is to
upgrade it to latest suitable release and that release should  not be
insecure.

when i started this project, it was not written on Django 1.9.8 official
document that its an insecure version

Now i am thinking that Django 2 is not LTS so what is the guaranty that it
will be a secure Django Version!


On Sat, Mar 31, 2018, 2:34 PM Jani Tiainen  wrote:

> Hi,
>
> In most cases, if possible I would upgrade latest release. Main issue with
> 1.11 to 2.0 upgrade is Python 2 support. 1.11 is the last version to
> support Python 2.7 and starting from Django 2.0 Python 3 is required.
>
> Of course, if your project is a big that takes long time to upgrade,
> sticking with LTS isn't bad choice.
>
> On Sat, Mar 31, 2018 at 11:45 AM, Haroon Ahmed 
> wrote:
>
>> Hi,
>>
>> Thanks for the information!
>>
>> Should i upgrade to Django 2 for my project? As Django 2 is not Long Time
>> Supported.
>> Django 1.11 is the latest release that is Long Time Supported yet!
>>
>> Should I go for Django 1.11 at the moment rather then Django 2.0? What
>> will  be your suggestion for me?
>>
>> What is being followed in the industry, How to decide which Django should
>> be chosen to upgrade the application?
>>
>>
>> Thanks in advance!
>>
>>
>>
>> On Fri, Mar 30, 2018, 5:12 PM Jani Tiainen  wrote:
>>
>>> Hi,
>>>
>>> Standard procedure to update Django is to upgrade gradually all versions
>>> from source version to target.
>>>
>>> There is no single document to describe changes needed between versions
>>> that are apart more than one release.
>>>
>>> Only changelog you can find is at every release which contains changes
>>> from previous release.
>>>
>>> You can try to combine required changes to directly upgrade.
>>>
>>> pe 30. maaliskuuta 2018 klo 14.07 Haroon Ahmed 
>>> kirjoitti:
>>>
 Hi,

 Currently my application is developed with Django 1.9.8 and I want to
 upgrade it to 2.0.3 because
 Django 1.9.8 is an insecure version of django as mention on it official
 documentation.


 https://docs.djangoproject.com/en/1.9/internals/release-process/#backwards-compatibility-policy

 This document is for an insecure version of Django that is no longer
 supported. Please upgrade to a newer release!


 Its my first time to update Django Version for my application,
 I have updated the Dango 1.9.8 to Django 2.0.3 in my virtual
 environment.
 I am using Python 3.4.4

 I haven't changes any thing in the code yet and facing some error

 \virtualEnv\DjangoUp\lib\site-packages\rest_framework\routers.py", line
 23, in 
 from django.core.urlresolvers import NoReverseMatch
 ImportError: No module named 'django.core.urlresolvers'

 Some question that are coming into my mind:

- Do i have to update my application according to new Django
release every time when new Django version releases?
- Is there any article or blog written that can help me to upgrade
Django version from Django 1.9.8 to Django 2.0.3?
- What people follow, dose most of the developers upgrade there web
application according to new Django version release?

 Any kind of help will be appreciated, Thanks in advance.

 --
 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 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/1162960f-46e4-4c24-9e36-df1d7edbb2eb%40googlegroups.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+unsubscr...@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/CAHn91oeRFX6N7cvUTL9jwLGQJOTV8dLxCUWKdicCiYbbqCUbtA%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> 

Re: When deleting field in models admin form not updating.

2018-03-31 Thread Gerald Brown
I had run migrations several times.  The last migration said "Nothing 
changed.".  However today when I rebooted my system the fields were gone so 
I guess the reboot took care of them.

Thanks for your reply.

On Saturday, March 31, 2018 at 12:54:14 AM UTC+8, Andrew Korir wrote:
>
> have you tried to run migrations on that particular app in your django 
> project
>
> python manage.py makemigrations app_name
>
> python manage.py migrate app_name
>
> On Fri, Mar 30, 2018 at 4:27 PM, Gerald Brown  > wrote:
>
>> I am using Django 2.0.3 and Python 3.6.  When I delete a field in the 
>> model file it is NOT being deleted in the admin form.  Any ideas on how I 
>> can delete the field on the admin form?
>>
>> Thanks.
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/3274bd21-77ec-4778-9af5-89c4c0daa12f%40googlegroups.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+unsubscr...@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/e110b475-f59f-4829-87f9-61eca6aaecc7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: When deleting field in models admin form not updating.

2018-03-31 Thread Gerald Brown


On Friday, March 30, 2018 at 9:31:11 PM UTC+8, Gerald Brown wrote:
>
> I am using Django 2.0.3 and Python 3.6.  When I delete a field in the 
> model file it is NOT being deleted in the admin form.  Any ideas on how I 
> can delete the field on the admin form?
>
> Thanks.
>

-- 
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 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/6c201f28-e501-46e3-a675-36bc6cbe91e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Updating Django for my web based application

2018-03-31 Thread Jani Tiainen
Hi,

In most cases, if possible I would upgrade latest release. Main issue with
1.11 to 2.0 upgrade is Python 2 support. 1.11 is the last version to
support Python 2.7 and starting from Django 2.0 Python 3 is required.

Of course, if your project is a big that takes long time to upgrade,
sticking with LTS isn't bad choice.

On Sat, Mar 31, 2018 at 11:45 AM, Haroon Ahmed  wrote:

> Hi,
>
> Thanks for the information!
>
> Should i upgrade to Django 2 for my project? As Django 2 is not Long Time
> Supported.
> Django 1.11 is the latest release that is Long Time Supported yet!
>
> Should I go for Django 1.11 at the moment rather then Django 2.0? What
> will  be your suggestion for me?
>
> What is being followed in the industry, How to decide which Django should
> be chosen to upgrade the application?
>
>
> Thanks in advance!
>
>
>
> On Fri, Mar 30, 2018, 5:12 PM Jani Tiainen  wrote:
>
>> Hi,
>>
>> Standard procedure to update Django is to upgrade gradually all versions
>> from source version to target.
>>
>> There is no single document to describe changes needed between versions
>> that are apart more than one release.
>>
>> Only changelog you can find is at every release which contains changes
>> from previous release.
>>
>> You can try to combine required changes to directly upgrade.
>>
>> pe 30. maaliskuuta 2018 klo 14.07 Haroon Ahmed 
>> kirjoitti:
>>
>>> Hi,
>>>
>>> Currently my application is developed with Django 1.9.8 and I want to
>>> upgrade it to 2.0.3 because
>>> Django 1.9.8 is an insecure version of django as mention on it official
>>> documentation.
>>>
>>> https://docs.djangoproject.com/en/1.9/internals/release-
>>> process/#backwards-compatibility-policy
>>>
>>> This document is for an insecure version of Django that is no longer
>>> supported. Please upgrade to a newer release!
>>>
>>>
>>> Its my first time to update Django Version for my application,
>>> I have updated the Dango 1.9.8 to Django 2.0.3 in my virtual environment.
>>> I am using Python 3.4.4
>>>
>>> I haven't changes any thing in the code yet and facing some error
>>>
>>> \virtualEnv\DjangoUp\lib\site-packages\rest_framework\routers.py", line
>>> 23, in 
>>> from django.core.urlresolvers import NoReverseMatch
>>> ImportError: No module named 'django.core.urlresolvers'
>>>
>>> Some question that are coming into my mind:
>>>
>>>- Do i have to update my application according to new Django release
>>>every time when new Django version releases?
>>>- Is there any article or blog written that can help me to upgrade
>>>Django version from Django 1.9.8 to Django 2.0.3?
>>>- What people follow, dose most of the developers upgrade there web
>>>application according to new Django version release?
>>>
>>> Any kind of help will be appreciated, Thanks in advance.
>>>
>>> --
>>> 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 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/1162960f-46e4-4c24-9e36-df1d7edbb2eb%
>>> 40googlegroups.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+unsubscr...@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/CAHn91oeRFX6N7cvUTL9jwLGQJOTV8
>> dLxCUWKdicCiYbbqCUbtA%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+unsubscr...@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/CAAAomxk-iJ0c9uag%2B16r64Faf_HMh_
> kre64gSv379GNnQ3%3DcOg%40mail.gmail.com
> 

Re: Updating Django for my web based application

2018-03-31 Thread Haroon Ahmed
Hi,

Thanks for the information!

Should i upgrade to Django 2 for my project? As Django 2 is not Long Time
Supported.
Django 1.11 is the latest release that is Long Time Supported yet!

Should I go for Django 1.11 at the moment rather then Django 2.0? What
will  be your suggestion for me?

What is being followed in the industry, How to decide which Django should
be chosen to upgrade the application?


Thanks in advance!



On Fri, Mar 30, 2018, 5:12 PM Jani Tiainen  wrote:

> Hi,
>
> Standard procedure to update Django is to upgrade gradually all versions
> from source version to target.
>
> There is no single document to describe changes needed between versions
> that are apart more than one release.
>
> Only changelog you can find is at every release which contains changes
> from previous release.
>
> You can try to combine required changes to directly upgrade.
>
> pe 30. maaliskuuta 2018 klo 14.07 Haroon Ahmed 
> kirjoitti:
>
>> Hi,
>>
>> Currently my application is developed with Django 1.9.8 and I want to
>> upgrade it to 2.0.3 because
>> Django 1.9.8 is an insecure version of django as mention on it official
>> documentation.
>>
>>
>> https://docs.djangoproject.com/en/1.9/internals/release-process/#backwards-compatibility-policy
>>
>> This document is for an insecure version of Django that is no longer
>> supported. Please upgrade to a newer release!
>>
>>
>> Its my first time to update Django Version for my application,
>> I have updated the Dango 1.9.8 to Django 2.0.3 in my virtual environment.
>> I am using Python 3.4.4
>>
>> I haven't changes any thing in the code yet and facing some error
>>
>> \virtualEnv\DjangoUp\lib\site-packages\rest_framework\routers.py", line
>> 23, in 
>> from django.core.urlresolvers import NoReverseMatch
>> ImportError: No module named 'django.core.urlresolvers'
>>
>> Some question that are coming into my mind:
>>
>>- Do i have to update my application according to new Django release
>>every time when new Django version releases?
>>- Is there any article or blog written that can help me to upgrade
>>Django version from Django 1.9.8 to Django 2.0.3?
>>- What people follow, dose most of the developers upgrade there web
>>application according to new Django version release?
>>
>> Any kind of help will be appreciated, Thanks in advance.
>>
>> --
>> 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 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/1162960f-46e4-4c24-9e36-df1d7edbb2eb%40googlegroups.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+unsubscr...@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/CAHn91oeRFX6N7cvUTL9jwLGQJOTV8dLxCUWKdicCiYbbqCUbtA%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+unsubscr...@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/CAAAomxk-iJ0c9uag%2B16r64Faf_HMh_kre64gSv379GNnQ3%3DcOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.