Is Microsoft Visual Studion 2017 Environment is good for Django development ?

2019-01-19 Thread Django Geek Aditya
I am a beginner in Django. Is Microsoft Visual Studio will be a better 
environment to start with django from basics.
They are providing a detailed help on their website LINK 
.
 Please 
help me and suggest me the ways to proceed further. 
I want to enter into the Web Development with Django and I have to work on 
my idea.

-- 
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/e8a0bf47-2906-41cf-a109-14fef6e60f68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


submit button redirecting to unknown url

2019-01-19 Thread tribhuvan kishor
VIEW

def post_share(request, post_id):
# Retrieve post by id
post = get_object_or_404(Post, id=post_id, status='published')
sent = False

if request.method == 'POST':
# Form was submitted
form = EmailPostForm(request.POST)
if form.is_valid():
# Form fields passed validation
cd = form.cleaned_data
post_url = request.build_absolute_uri(
post.get_absolute_url())
subject = '{} ({}) recommends you reading
"{}"'.format(cd['name'], cd['email'], post.title)
message = 'Read "{}" at {}\n\n{}\'s comments:
{}'.format(post.title, post_url, cd['name'], cd['comments'])
send_mail(subject, message, 'tribhuvankishor000!gmail.com',
  [cd['to']])
sent = True
else:
form = EmailPostForm()
return render(request, 'blog/post/share.html', {'post': post,
'form': form,
'sent': sent})



URL

path('/share', views.post_share, name='post_share')

TEMPLATE

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

{% block title %}Share a post{% endblock %}

{% block content %}
  {% if sent %}
E-mail successfully sent

  "{{ post.title }}" was successfully sent to {{ form.cleaned_data.to }}.

  {% else %}
Share "{{ post.title }}" by e-mail

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

  {% endif %}
{% endblock %}

FORM

from django import forms


class EmailPostForm(forms.Form):
name = forms.CharField(max_length=25)
email = forms.EmailField()
to = forms.EmailField()
comments = forms.CharField(required=False, widget=forms.Textarea)

-- 
regards
Tribhuvan Kishor Bhaskar

-- 
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/CACiphSW6yT72zXRzcbq8M9X2m1dG6jBnGFJM0mOq2OeS2zXDLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Project initialization

2019-01-19 Thread tribhuvan kishor
first, check your Django properly installed or not.
and tell me which operating system you are using.

On Sun, Jan 20, 2019 at 4:36 AM Lara Garg  wrote:

> Why write django-admin startproject xyz and not just django startproject
> xyz?
> 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/045eb142-bd03-4891-9f8d-2343babe635a%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
regards
Tribhuvan Kishor Bhaskar

-- 
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/CACiphSUDNAgz%2BS%3DA4%2BCo3z%3DBVZ82gpG12E7bhLREt56PgF-f%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: AES Encryption

2019-01-19 Thread Alex Heyden
PyCrypto would be the Python-side library if you wanted to handle this in
application code, but personally, I'd prefer to handle it in my database of
choice. A lot of us use Postgres, and there's a django-pgcrypto library for
that.

That being said, reversible ciphers are hard to do meaningfully. You'd need
some sort of attack vector that includes getting unauthorized access to the
database, but not via the authorized application, an authorized user, or
access to the machine where the keys are readable. Often enough, that means
you messed up the auth rules on your database, RBAC in your application
code, or your OS read permissions, and you can't cipher your way out of
those issues. A lot of that isn't really Django-centric, and because it's
so rare to have a risk that's mitigated like that, most developers just
don't do it, and not just out of laziness.

What you might actually want is row-level read access, and something like
django-guardian would help you manage object-level permissions in the admin
screen.

If you're looking for further reading, OWASP really is the gold standard
for web security information. The site looks like amateur hour, but it's
not maintained by UI experts, it's maintained by security experts. It's
practically required reading in most security-conscious corporate
environments.

And finally, when in doubt, throw it away. It's a lot harder to have a
breach of data you didn't store anywhere.

On Sat, Jan 19, 2019 at 8:59 PM  wrote:

> Is there a blog or website dedicated to helping Django developers handle
> PII? I'd like to use AES 256 encryption to store all of our fields but have
> no guidance on the best practices for implementing security measures.
>
> --
> 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/64a50014-df54-4ec7-a4b1-f60879385c15%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/CA%2Bv0ZYWCuj5%3DjH8hmC%2BV2cPY%2BxFNP8go6dNnW%2BpTsRLjpPVgkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


AES Encryption

2019-01-19 Thread cpyle
Is there a blog or website dedicated to helping Django developers handle 
PII? I'd like to use AES 256 encryption to store all of our fields but have 
no guidance on the best practices for implementing security measures.

-- 
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/64a50014-df54-4ec7-a4b1-f60879385c15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2019-01-19 Thread Alex Heyden
You missed the +unsubscribe in the email name to accomplish that. From the
footer:

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/BL0PR0102MB3524B2BC6D8F8BBF9DC7B624F39E0%40BL0PR0102MB3524.prod.exchangelabs.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.


On Sat, Jan 19, 2019 at 6:34 PM Vikash Verma 
wrote:

> Please remove me
>
> Get Outlook for iOS 
>
> --
> 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/BL0PR0102MB3524B2BC6D8F8BBF9DC7B624F39E0%40BL0PR0102MB3524.prod.exchangelabs.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%2Bv0ZYVBC1i%2BZaMjkg8qotKE4XvUE6jwFMpddnpDoncAjJOpCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[no subject]

2019-01-19 Thread Vikash Verma
Please remove me

Get Outlook for iOS

-- 
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/BL0PR0102MB3524B2BC6D8F8BBF9DC7B624F39E0%40BL0PR0102MB3524.prod.exchangelabs.com.
For more options, visit https://groups.google.com/d/optout.


Project initialization

2019-01-19 Thread Lara Garg
Why write django-admin startproject xyz and not just django startproject 
xyz?
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/045eb142-bd03-4891-9f8d-2343babe635a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Adding default rows to Django admin inlines

2019-01-19 Thread Mohammad Etemaddar
If I get you right you need to add m2m objects with a default value.
In this situation, you can create an intermediate model to build m2m.
For example:
JobActionRel:
job = fk
action = fk-to-actions (default=Action.objects.get...)

And use it as through model:
https://docs.djangoproject.com/en/2.1/topics/db/models/#extra-fields-on-many-to-many-relationships

Now, in admin you see the default action.
Remember, before making it through, create JobActionRels from previous m2m 
objects.

-- 
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/445a903a-408b-445e-a8cb-4e09db5162d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django to APK

2019-01-19 Thread Jani Tiainen
Hi.

Theoretically speaking that could be possible. Android can run Python and
since Django is plain Python it could run but what would be the usecase?
Django pretty much lives with HTTP request-response cycle so running a
server software on mobile doesn't sound sensible.

On Sat, Jan 19, 2019 at 3:53 PM Jean Kyle  wrote:

> Is there a way of converting a Django website into an APK that can be
> installed on an Android phone?
>
> --
> 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/31a440ae-1638-4ce9-9539-b4edc57ee516%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
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/CAHn91od566LyTkHFeJdAC_6KYiPj_hyjdNqCEGoewfWEeopw3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django to APK

2019-01-19 Thread Nebojsa Hajdukovic
no, you need to create rest api, then to use api in some
language/framework/library that support android development (such as
flutter, ionic etc)

суб, 19. јан 2019. у 14:52 Jean Kyle  је
написао/ла:

> Is there a way of converting a Django website into an APK that can be
> installed on an Android phone?
>
> --
> 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/31a440ae-1638-4ce9-9539-b4edc57ee516%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/CAJ60hW2OFpM4M-KEin6ysLbO8QsPUvnWk9ySr7PqOToMsArdLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django to APK

2019-01-19 Thread Jean Kyle
Is there a way of converting a Django website into an APK that can be 
installed on an Android phone?

-- 
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/31a440ae-1638-4ce9-9539-b4edc57ee516%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] django-service-urls 1.1.0

2019-01-19 Thread Raffaele Salmaso
I'm happy to announce the 1.1.0 release of django-service-urls package, an
evolution of dj-database-url which can handle CACHES and EMAIL_BACKEND setting
other than DATABASES.

*News*
Simplified installation: instead of modifying the setting file (possibility
that is always available) just add import service_urls.patch in your
manage.py/wsgi.py files.

*Urls*
pypi and docs: https://pypi.org/project/django-service-urls/
main repo (bitbucket/mercurial):
https://bitbucket.org/rsalmaso/django-service-urls/
github mirror: https://github.com/rsalmaso/django-service-urls
gitlab mirror: https://gitlab.com/rsalmaso/django-service-urls
(I accept patches from every repository)

*Install*
$ python3 -m pip install django-service-urls


Add import service_urls.patch to manage.py and wsgi.py

*manage.py:*
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
import service_urls.patch

def main():
   os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_name.settings')
   try:
   from django.core.management import execute_from_command_line
   except ImportError as exc:
   raise ImportError(
   "Couldn't import Django. Are you sure it's installed and "
   "available on your PYTHONPATH environment variable? Did you "
   "forget to activate a virtual environment?"
   ) from exc
   execute_from_command_line(sys.argv)


if __name__ == '__main__':
   main()


*wsgi.py:*import os
import service_urls.patch
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_name.settings')
application = get_wsgi_application()

*Usage*
Configure your setting (see docs for better example).

DATABASES = {
'default': os.environ.get('DATABASE_DEFAULT',
'postgres://myuser:mypasswd@localhost:5432/mydb'),
}
CACHES = {
'default': os.environ.get('CACHE_DEFAULT', ''memcached://127.0.0.1:11211
'),
}
EMAIL_BACKEND = os.environ.get('EMAIL_BACKEND', 'smtp://localhost:25')


-- 
| Raffaele Salmaso
| https://salmaso.org
| https://bitbucket.org/rsalmaso
| https://github.com/rsalmaso

-- 
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/CABgH4Jsy4PXQXLj5SQc0FOq7fAAW%2BEcRexy2u9XV40-ry4uJXw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.