relationship(foreign key or many to many) betweeen the creating from the frontend to the backend

2024-10-26 Thread David James Nwoyie
good morning,  everyone  i have this project that I'm working on ,the 
project is foodapp where food vendor can register their eatery and 
customers will register and then  place their order  I'm using django,drf 
for backend and nextjs for frontend but the problem I'm having is that,I 
can't create something with that has relation shipwith other tables in the 
django model for example the restaurant and menu item has relation which is 
foreignkey  but when i create the  menu item from the frontend it will 
return 500 or 401 but when I create with drf it works, how can i connect my 
backend  with tables that share realtionship(foreignkey) to the frontend so 
that i can post(create) from the frontend to the backend

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/django-users/ef66e6ed-afba-4ab8-b5f7-3511e548df3an%40googlegroups.com.


Re: How can I acess Multilinestring(dim=3)

2024-02-24 Thread David James Nwoyie
Increase the dim to 4 because of the Django of use 0 as the starting point

On Sat, Feb 24, 2024, 8:48 PM Richard Mair  wrote:

> Hi i am using
>
> geom = models.MultiLineStringField(
> dim=3, srid=EPSG_CODE, blank=True, null=True, spatial_index=True
> ) # EPSG:3128=AustriaLambert
>
>
> and my PostGIS-DB is using (MultilinestringM
>
> ALTER TABLE IF EXISTS public."KMSYS"
> ADD COLUMN geom geometry(MultiLineStringM,31287);
>
> but when I access my Model I only get 2 dimensional response
>
> Can anybody lead me to the correct handling
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/ae4eaa11-3f4b-467a-9931-bbff5892a858n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKDLZAQpTNGta59SDQM0qzrR9siWr1Diwdj8D2X_qRMZkUfaNg%40mail.gmail.com.


Re: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-24 Thread David James Nwoyie
Am interested in the
+2349038924701

On Sun, Feb 18, 2024, 5:48 PM SURAJ TIWARI  wrote:

> 🚀 Join Our Django WhatsApp Bulk Messaging Project!
>
> 👋 Hello everyone,
>
> Are you looking for an exciting opportunity to gain hands-on experience in
> Django development? Do you want to work on a meaningful project that
> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join
> our dynamic team!
>
> 🌟 Benefits:
>
>- Get hands-on experience working on a real-world Django project.
>- Learn how to leverage WhatsApp for bulk messaging, a valuable skill
>in today's digital landscape.
>- Opportunities for hybrid work, allowing flexibility in your schedule.
>- Collaborate with experienced developers and gain valuable mentorship.
>- Access to cutting-edge tools and technologies.
>
> 💼 Opportunities Available:
>
>- Django developers
>- Frontend developers
>- UI/UX designers
>- Quality assurance testers
>
> 🤝 How to Join: Simply reply to this message expressing your interest,
> and we'll provide you with all the necessary details to get started on our
> project.
>
> Let's work together to create something amazing and gain valuable
> experience along the way! 💻✨
>
> Best regards,
>
> Suraj Tiwari
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e8a705fd-10d9-4c1a-b4ba-0a7b896dbfean%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKDLZAQ0%3DO414%2BzirUM%3DaFYKDy8_re47dsFJXBM-PzjuA-cOWg%40mail.gmail.com.


JOB | Lead Platform Engineer (Singapore/London)

2023-05-26 Thread James Tobin
Hello, I'm working with an employer that is looking to hire someone in 
London or Singapore to take lead on the modernisation of their on-premises 
environment.  Python experience is *mandatory*. Consequently, I had hoped 
that some members of this group may like to discuss.  I can be reached 
using "JamesBTobin (at) Gmail (dot) Com". Kind regards, James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6cc40ec3-dc19-4dab-82da-bbc43035b154n%40googlegroups.com.


Re: Django error while running

2023-03-22 Thread James Kalu
I think it ushould be 'rest_framework' in settings.py under installed apps.


On Wednesday, March 22, 2023 at 4:50:30 AM UTC+3 David Nugent wrote:

> Any traceback with this at the end:
>
>   _bootstrap._gcd_import(name[level..], package, level)
>
> Is almost always is due to a problem with your settings INSTALLED_APPS, 
> particularly if django\apps\registry.py Is further up the trace.
>
> A missing comma between items, perhaps?
>
> It would indeed be nice if Django would output a more sensible error 
> message for issues like this 😀 
> Hmm, an idea for a useful PR right there. Seems to be common issue (since 
> the very next message I read in this mail list is exactly the same thing).
>
> Regards,
> David
>
>
> "Chandresh . T"  writes
>
> Recently I was running a git clone (
> https://github.com/divanov11/StudyBud.git)
>
> after doing required steps like migrations, etc. I started to run it by 
> (python manage.py runserver) but I got this error.
>
> can anyone help me with this, please?
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c8c4bdcf-b242-4104-b5f5-ecc235790366n%40googlegroups.com.


Re: Django Admin

2023-03-13 Thread James Hunt
Hi there. I have yet to add a login/register page since I am only trying to 
access the admin page which is a part of the Django project setup. So in 
effect, there are no HTML pages setup and I cant access the Django admin 
page layout as this is an integral part of Django!!! This is the problem!! 

I'm not sure if anyone else who sets up a  Django project would need to 
create any HTML pages before they create a superuser login enabling them to 
access their admin section.

I cant resolve this issue!!

Cheers

J

On Monday, March 13, 2023 at 2:08:06 PM UTC Andrew Romany wrote:

> It's very simple you should add it in the login/register html page but 
> inside the  tag after &  to be specific after this 
> above line.
>
> On Mon, 13 Mar 2023, 11:15 a.m. James Hunt,  wrote:
>
>> I have yet to create a HTML page so I'm not sure that the inclusion of {% 
>> csrf_token %} is required. I mean it's just the admin page I am trying to 
>> access which is provided by Django and not a page created by me!!!
>>
>> I am very surprised there is no fix for this issue!!! I might need to 
>> abandon Django and move a different framework given that this issue is at 
>> the start of a project!!!
>>
>> Cheers
>>
>> Jay
>>
>> On Monday, March 13, 2023 at 3:06:42 AM UTC Mir Junaid wrote:
>>
>>> try including this line in your index.html or main HTML page 
>>> {% csrf_token %}
>>> if it still doesn't work do include it in every html page
>>>
>>> On Sat, 11 Mar 2023 at 23:33, James Hunt  wrote:
>>>
>>>> Hi there. I am fairly new to Django but have had previous success with 
>>>> creating an app and being able to access the Admin page.
>>>> Recently, if I attempt to access the admin page of a new Django app it 
>>>> throws the CSRF error upon trying to log in!!!
>>>>
>>>> I have attempted several ways to bypass this error including adding 
>>>> allowed hosts but I cant seem to get past this issue.
>>>>
>>>> Can someone please provide me with the definitive way of stopping CSRF 
>>>> error when simply trying to access the admin part of Django? I mean there 
>>>> are no post functions that really apply to this feature so I cant 
>>>> understand the CSRF token.
>>>>
>>>> I cant get past this issue which means I can never access the admin 
>>>> page!!
>>>>
>>>> Please help.
>>>>
>>>> Regards
>>>>
>>>> James
>>>>
>>>> -- 
>>>>
>>> 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 view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.com?utm_medium=email&utm_source=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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/6f8d686c-3075-4aff-8227-c2f86e3cn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/6f8d686c-3075-4aff-8227-c2f86e3cn%40googlegroups.com?utm_medium=email&utm_source=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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/447340ca-8977-4f28-9b1f-e2358c205914n%40googlegroups.com.


Re: Django Admin

2023-03-13 Thread James Hunt
I have yet to create a HTML page so I'm not sure that the inclusion of {% 
csrf_token %} is required. I mean it's just the admin page I am trying to 
access which is provided by Django and not a page created by me!!!

I am very surprised there is no fix for this issue!!! I might need to 
abandon Django and move a different framework given that this issue is at 
the start of a project!!!

Cheers

Jay

On Monday, March 13, 2023 at 3:06:42 AM UTC Mir Junaid wrote:

> try including this line in your index.html or main HTML page 
> {% csrf_token %}
> if it still doesn't work do include it in every html page
>
> On Sat, 11 Mar 2023 at 23:33, James Hunt  wrote:
>
>> Hi there. I am fairly new to Django but have had previous success with 
>> creating an app and being able to access the Admin page.
>> Recently, if I attempt to access the admin page of a new Django app it 
>> throws the CSRF error upon trying to log in!!!
>>
>> I have attempted several ways to bypass this error including adding 
>> allowed hosts but I cant seem to get past this issue.
>>
>> Can someone please provide me with the definitive way of stopping CSRF 
>> error when simply trying to access the admin part of Django? I mean there 
>> are no post functions that really apply to this feature so I cant 
>> understand the CSRF token.
>>
>> I cant get past this issue which means I can never access the admin page!!
>>
>> Please help.
>>
>> Regards
>>
>> James
>>
>> -- 
>>
> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.com?utm_medium=email&utm_source=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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6f8d686c-3075-4aff-8227-c2f86e3cn%40googlegroups.com.


Re: Django Admin

2023-03-12 Thread James Hunt
I did add this but no change!!! Just keep getting that CSRF token error 
when trying to access admin!! Which is strange as the CSRF token is 
predominantly for POST methods.

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

CSRF_TRUSTED_ORIGIN = (
'https://8000-famouswelsh-djangosetup-7vkpsqt0kez.ws-eu90.gitpod.io/')
# Application definition
On Sunday, March 12, 2023 at 12:57:19 PM UTC Muhammad Juwaini Abdul Rahman 
wrote:

> Have you tried my suggestion?
>
> On Sun, 12 Mar 2023 at 20:32, James Hunt  wrote:
>
>> I have literally set this up today just to prove that it happens for 
>> every Django project setup!!!
>>
>> So this is my settings :
>>
>>
>>  """
>> Django settings for DjangoTest project.
>>
>> Generated by 'django-admin startproject' using Django 4.1.7.
>>
>> For more information on this file, see
>> https://docs.djangoproject.com/en/4.1/topics/settings/
>>
>> For the full list of settings and their values, see
>> https://docs.djangoproject.com/en/4.1/ref/settings/
>> """
>>
>> from pathlib import Path
>>
>> # Build paths inside the project like this: BASE_DIR / 'subdir'.
>> BASE_DIR = Path(__file__).resolve().parent.parent
>>
>>
>> # Quick-start development settings - unsuitable for production
>> # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
>>
>> # SECURITY WARNING: keep the secret key used in production secret!
>> SECRET_KEY = 
>> 'django-insecure-zb-=l4$q!2t@wjwt!@cp#rz=16v0l)#uai#7h(u4n8eie@ddt%'
>>
>> # SECURITY WARNING: don't run with debug turned on in production!
>> DEBUG = True
>>
>> ALLOWED_HOSTS = []
>>
>>
>> # Application definition
>>
>> INSTALLED_APPS = [
>> 'django.contrib.admin',
>> 'django.contrib.auth',
>> 'django.contrib.contenttypes',
>> 'django.contrib.sessions',
>> 'django.contrib.messages',
>> 'django.contrib.staticfiles',
>> ]
>>
>> MIDDLEWARE = [
>> 'django.middleware.security.SecurityMiddleware',
>> 'django.contrib.sessions.middleware.SessionMiddleware',
>> 'django.middleware.common.CommonMiddleware',
>> 'django.middleware.csrf.CsrfViewMiddleware',
>> 'django.contrib.auth.middleware.AuthenticationMiddleware',
>> 'django.contrib.messages.middleware.MessageMiddleware',
>> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
>> ]
>>
>> ROOT_URLCONF = 'DjangoTest.urls'
>>
>> TEMPLATES = [
>> {
>> 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>> 'DIRS': [],
>> 'APP_DIRS': True,
>> 'OPTIONS': {
>> 'context_processors': [
>> 'django.template.context_processors.debug',
>> 'django.template.context_processors.request',
>> 'django.contrib.auth.context_processors.auth',
>> 'django.contrib.messages.context_processors.messages',
>> ],
>> },
>> },
>> ]
>>
>> WSGI_APPLICATION = 'DjangoTest.wsgi.application'
>>
>>
>> # Database
>> # https://docs.djangoproject.com/en/4.1/ref/settings/#databases
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.sqlite3',
>> 'NAME': BASE_DIR / 'db.sqlite3',
>> }
>> }
>>
>>
>> # Password validation
>> # 
>> https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
>>
>> AUTH_PASSWORD_VALIDATORS = [
>> {
>> 'NAME': 
>> 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'
>> ,
>> },
>> {
>> 'NAME': 
>> 'django.contrib.auth.password_validation.MinimumLengthValidator',
>> },
>> {
>> 'NAME': 
>> 'django.contrib.auth.password_validation.CommonPasswordValidator',
>> },
>> {
>> 'NAME': 
>> 'django.contrib.auth.password_validation.NumericPasswordValidator',
>> },
>> ]
>>
>>
>> # Interna

Re: Django Admin

2023-03-12 Thread James Hunt
I have literally set this up today just to prove that it happens for every 
Django project setup!!!

So this is my settings :


 """
Django settings for DjangoTest project.

Generated by 'django-admin startproject' using Django 4.1.7.

For more information on this file, see
https://docs.djangoproject.com/en/4.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
"""

from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 
'django-insecure-zb-=l4$q!2t@wjwt!@cp#rz=16v0l)#uai#7h(u4n8eie@ddt%'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'DjangoTest.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'DjangoTest.wsgi.application'


# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}


# Password validation
# 
https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 
'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/4.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'


On Sunday, March 12, 2023 at 9:46:04 AM UTC Muhammad Juwaini Abdul Rahman 
wrote:

> I think you need to add the following in settings.py:
>
> CSRF_TRUSTED_ORIGIN = ('')
>
>
>
> On Sun, 12 Mar 2023 at 02:04, James Hunt  wrote:
>
>> Hi there. I am fairly new to Django but have had previous success with 
>> creating an app and being able to access the Admin page.
>> Recently, if I attempt to access the admin page of a new Django app it 
>> throws the CSRF error upon trying to log in!!!
>>
>> I have attempted several ways to bypass this error including adding 
>> allowed hosts but I cant seem to get past this issue.
>>
>> Can someone please provide me with the definitive way of stopping CSRF 
>> error when simply trying to access the admin part of Django? I mean there 
>> are no post functions that really apply to this feature so I cant 
>> understand the CSRF token.
>>
>> I cant get past this issue which means I can never access the admin page!!
>>
>> Please help.
>>
>> Regards
>&g

Django Admin

2023-03-11 Thread James Hunt
Hi there. I am fairly new to Django but have had previous success with 
creating an app and being able to access the Admin page.
Recently, if I attempt to access the admin page of a new Django app it 
throws the CSRF error upon trying to log in!!!

I have attempted several ways to bypass this error including adding allowed 
hosts but I cant seem to get past this issue.

Can someone please provide me with the definitive way of stopping CSRF 
error when simply trying to access the admin part of Django? I mean there 
are no post functions that really apply to this feature so I cant 
understand the CSRF token.

I cant get past this issue which means I can never access the admin page!!

Please help.

Regards

James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e13c7765-831e-45c5-b091-c8fcfbed19c5n%40googlegroups.com.


Re: Custom user model password is not hashed

2023-01-26 Thread James
Yup, 100% correct. Glad to hear you fixed it. Custom user models that 
inherit from the abstractbaseuser class can be a little tricky at first.

On Friday, November 13, 2015 at 5:41:09 AM UTC-7 benjamin...@gmail.com 
wrote:

> The problem was, when creating a custom user, one has to define a custom 
> model form and model admin that handles the password properly. After that 
> it was solved.
>
> Thank you.
>
> On Thu, Nov 12, 2015 at 9:25 PM, Andreas Kuhne  
> wrote:
>
>> Try to debug and check what your password value is after the 
>> set_password() statement.  Also have you checked the database after trying 
>> to create a user with the new method? It should be hashed in the database. 
>> This is stuff that should "just work" in django (it's regulated by the 
>> AbstractBaseUser and is the same that I am using in a project).
>>
>> You did restart the django shell after changing the code?
>>
>> 2015-11-12 16:44 GMT+01:00 Benjamin Smith :
>>
>>> I have changed user.set_password(self.cleaned_data["password"]) to 
>>> user.set_password(password). 
>>> But I am getting the same result.
>>>
>>> On Thu, Nov 12, 2015 at 8:57 PM, Andreas Kuhne  
>>> wrote:
>>>
 As aRkadeFR says, you seam to have mixed code there

 The row:
 user.set_password(self.cleaned_data["password"])

 is taken from a form somewhere and won't work. It should instead be : 
 user.set_password(password)

 I suppose the password is going through to the create method via the 
 kwargs argument at the end of you create method. But if you change like I 
 said, everything should work.


 Med vänliga hälsningar,

 AndrĂŠas KĂźhne
 Software Development Manager
 Suitopia Scandinavia AB

 2015-11-12 16:20 GMT+01:00 aRkadeFR :

> Hello,
>
> I don't quite get the code in your method: '
> MyUserManager.create_user':
> user.set_password(self.cleaned_data["password"])
>
> You're in your Manager method but call self.cleaned_data ?
>
> You can set a breakpoint inside your method with pdb to see
> what's going on with your fields?
>
>
> On 11/12/2015 04:11 PM, Benjamin Smith wrote:
>
> I have my own custom User model, and its own Manger too.
>
> Models:
>
> class MyUser(AbstractBaseUser, PermissionsMixin):
> email = models.EmailField(max_length=255, unique=True)
> first_name = models.CharField(max_length=35)
> last_name = models.CharField(max_length=35)
> username = models.CharField(max_length=70, unique=True)
> date_of_birth = models.DateField()
> is_active = models.BooleanField(default=True)
> is_admin = models.BooleanField(default=False)
>
> @property
> def is_staff(self):
> return self.is_admin
>
> def get_full_name(self):
> return ('%s %s') % (self.first_name, self.last_name)
>
> def get_short_name(self):
> return self.username
>
> objects = MyUserManager()
> USERNAME_FIELD = 'email'
> REQUIRED_FIELDS = ['first_name', 'last_name', 'username', 
> 'date_of_birth']
>
>
> Manager:
>
> class MyUserManager(BaseUserManager):
> def create_user(self, email, first_name, last_name, username, 
> date_of_birth, password=None, **kwargs):
> if not email:
> raise ValueError('User must have an email address')
>
> user = self.model(
> email=self.normalize_email(email),
> first_name=first_name,
> last_name=last_name,
> username=username,
> date_of_birth=date_of_birth,
> **kwargs
> )
> user.set_password(self.cleaned_data["password"])
> user.save(using=self._db)
> return user
>
> def create_superuser(self, email, first_name, last_name, username, 
> date_of_birth, password, **kwargs):
> user = self.create_user(
> email,
> first_name=first_name,
> last_name=last_name,
> username=username,
> date_of_birth=date_of_birth,
> password=password,
> is_superuser=True,
> **kwargs
> )
> user.is_admin = True
> user.save(using=self._db)
> return user
>
>
> Everything works when creating a new user without any errors. But when 
> I try to login I can't. So I checked the user's email and password to 
> confirm. Then I noticed that the password is displayed as plain text (eg. 
> *strongpassword)*, and when changed the admin form to get the hashed 
> password using *ReadOnlyPasswordHashField()* I get an error inside 
> the password field, even though I used *set_password()* for the 
> Manger inside the *create_us

Re: Arrayfield constraint issue in 4.1

2022-12-12 Thread James Gillard
I agree it looks odd, but the docs I linked say that list is fine, and
here's example from a test inside Django itself:
https://github.com/django/django/blob/cb791a2540c289390b68a3ea9c6a79476890bab2/tests/postgres_tests/models.py#L51

[image: James from Journee] <https://www.journeetrips.com/ourstory>
*James Gillard*
*Technical Co-Founder at Journee*
Trustpilot 4.9⭑ <https://www.trustpilot.com/review/www.journeetrips.com>
Instagram <https://to.mysocial.io/s/rI_M3vpIK> | TikTok
<https://to.mysocial.io/s/Gs-RQu8n7>
Journee, London, United Kingdom
[image: Journee Logo] <https://www.journeetrips.com/>


On Mon, 12 Dec 2022 at 14:45, Manjusha  wrote:

> I think default should be assigned like this
>
>  default=[ ] or
> default= list()
>
>
> But I'm junior so may I don't know well
>
> On Mon, 12 Dec 2022, 03:13 James Gillard,  wrote:
>
>> The callable list is indeed assigned as the default for the ArrayField,
>> as documented here:
>> https://docs.djangoproject.com/en/4.1/ref/contrib/postgres/fields/#django.contrib.postgres.fields.ArrayField
>>
>> The original issue has already had a patch merged, which will be released
>> in 4.1.5, see the fix here:
>> https://docs.djangoproject.com/en/dev/releases/4.1.5/
>>
>> On Sunday, 11 December 2022 at 18:02:24 UTC manjushak...@gmail.com wrote:
>>
>>> Hello Sir, I need to understand the form.py  file because , what  is the
>>> only list you have assigned as default in arrayfield, is it the method
>>> list() ?
>>>
>>>
>>> On Sat, Dec 10, 2022 at 10:00 PM James Gillard 
>>> wrote:
>>>
>>>> Thanks for the feedback. I opened a ticket and it was indeed confirmed
>>>> as a bug: https://code.djangoproject.com/ticket/34205
>>>>
>>>> On Thursday, 8 December 2022 at 15:04:40 UTC Ryan Nowakowski wrote:
>>>>
>>>>> Might be a bug. Check the release notes for the post 4.0.8 versions to
>>>>> see if anything related changed. File a bug with the simplest example code
>>>>> that demonstrates the issue.
>>>>>
>>>>>
>>>>> On December 8, 2022 6:37:52 AM CST, James Gillard <
>>>>> ja...@journeetrips.com> wrote:
>>>>>>
>>>>>> I can't yet work out whether this is a Django bug or how I'm using
>>>>>> model constraints... Upgraded from 4.0.8 to 4.1.4 and have hit this issue
>>>>>> when saving this model in the admin. I'd read in the release notes that
>>>>>> these constraints would be validated on model save, and that's the code
>>>>>> that's leading to this exception. If it's not something I've done, it 
>>>>>> seems
>>>>>> ArrayField isn't working with this new validation of my condition. The 
>>>>>> same
>>>>>> happens for Q(phone_numbers__len__gte=0), and the error disappears if I
>>>>>> comment out this condition. It seems the generated code might be wrong, 
>>>>>> as
>>>>>> I see 12 "%s" and only 11 elements in params. All it's trying to do is
>>>>>> ensure that an empty list isn't considered unique.
>>>>>>
>>>>>> Here's the failing model:
>>>>>>
>>>>>> phone_numbers = ArrayField(models.CharField(max_length=200),
>>>>>> default=list, blank=True)
>>>>>>
>>>>>> class Meta:
>>>>>> constraints = [
>>>>>> models.UniqueConstraint(
>>>>>>fields=['phone_numbers'],
>>>>>>condition=~Q(phone_numbers__len=0),
>>>>>>name='unique_email_phones',
>>>>>> ),
>>>>>> ]
>>>>>> )
>>>>>>
>>>>>> [image: Screenshot 2022-12-08 at 12.30.35.png]
>>>>>>
>>>>>> --
>>>> 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 view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/4a8a0941-dd65-4c22-bf16-4e11181794a0n%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/django-users/4a8a0941-dd65

Re: Arrayfield constraint issue in 4.1

2022-12-11 Thread James Gillard
The callable list is indeed assigned as the default for the ArrayField, as 
documented 
here: 
https://docs.djangoproject.com/en/4.1/ref/contrib/postgres/fields/#django.contrib.postgres.fields.ArrayField

The original issue has already had a patch merged, which will be released 
in 4.1.5, see the fix 
here: https://docs.djangoproject.com/en/dev/releases/4.1.5/

On Sunday, 11 December 2022 at 18:02:24 UTC manjushak...@gmail.com wrote:

> Hello Sir, I need to understand the form.py  file because , what  is the 
> only list you have assigned as default in arrayfield, is it the method 
> list() ?
>  
>
> On Sat, Dec 10, 2022 at 10:00 PM James Gillard  
> wrote:
>
>> Thanks for the feedback. I opened a ticket and it was indeed confirmed as 
>> a bug: https://code.djangoproject.com/ticket/34205
>>
>> On Thursday, 8 December 2022 at 15:04:40 UTC Ryan Nowakowski wrote:
>>
>>> Might be a bug. Check the release notes for the post 4.0.8 versions to 
>>> see if anything related changed. File a bug with the simplest example code 
>>> that demonstrates the issue.
>>>
>>>
>>> On December 8, 2022 6:37:52 AM CST, James Gillard <
>>> ja...@journeetrips.com> wrote:
>>>>
>>>> I can't yet work out whether this is a Django bug or how I'm using 
>>>> model constraints... Upgraded from 4.0.8 to 4.1.4 and have hit this issue 
>>>> when saving this model in the admin. I'd read in the release notes that 
>>>> these constraints would be validated on model save, and that's the code 
>>>> that's leading to this exception. If it's not something I've done, it 
>>>> seems 
>>>> ArrayField isn't working with this new validation of my condition. The 
>>>> same 
>>>> happens for Q(phone_numbers__len__gte=0), and the error disappears if I 
>>>> comment out this condition. It seems the generated code might be wrong, as 
>>>> I see 12 "%s" and only 11 elements in params. All it's trying to do is 
>>>> ensure that an empty list isn't considered unique.
>>>>
>>>> Here's the failing model:
>>>>
>>>> phone_numbers = ArrayField(models.CharField(max_length=200), 
>>>> default=list, blank=True)
>>>>
>>>> class Meta:
>>>> constraints = [
>>>> models.UniqueConstraint(
>>>>fields=['phone_numbers'],
>>>>condition=~Q(phone_numbers__len=0),
>>>>name='unique_email_phones',
>>>> ),
>>>> ]
>>>> )
>>>>
>>>> [image: Screenshot 2022-12-08 at 12.30.35.png]
>>>>
>>>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/4a8a0941-dd65-4c22-bf16-4e11181794a0n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/4a8a0941-dd65-4c22-bf16-4e11181794a0n%40googlegroups.com?utm_medium=email&utm_source=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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/29d9d224-3027-4346-9552-8fcadedd21dfn%40googlegroups.com.


Re: Arrayfield constraint issue in 4.1

2022-12-10 Thread James Gillard
Thanks for the feedback. I opened a ticket and it was indeed confirmed as a 
bug: https://code.djangoproject.com/ticket/34205

On Thursday, 8 December 2022 at 15:04:40 UTC Ryan Nowakowski wrote:

> Might be a bug. Check the release notes for the post 4.0.8 versions to see 
> if anything related changed. File a bug with the simplest example code that 
> demonstrates the issue.
>
>
> On December 8, 2022 6:37:52 AM CST, James Gillard  
> wrote:
>>
>> I can't yet work out whether this is a Django bug or how I'm using model 
>> constraints... Upgraded from 4.0.8 to 4.1.4 and have hit this issue when 
>> saving this model in the admin. I'd read in the release notes that these 
>> constraints would be validated on model save, and that's the code that's 
>> leading to this exception. If it's not something I've done, it seems 
>> ArrayField isn't working with this new validation of my condition. The same 
>> happens for Q(phone_numbers__len__gte=0), and the error disappears if I 
>> comment out this condition. It seems the generated code might be wrong, as 
>> I see 12 "%s" and only 11 elements in params. All it's trying to do is 
>> ensure that an empty list isn't considered unique.
>>
>> Here's the failing model:
>>
>> phone_numbers = ArrayField(models.CharField(max_length=200), 
>> default=list, blank=True)
>>
>> class Meta:
>> constraints = [
>> models.UniqueConstraint(
>>fields=['phone_numbers'],
>>condition=~Q(phone_numbers__len=0),
>>name='unique_email_phones',
>> ),
>> ]
>> )
>>
>> [image: Screenshot 2022-12-08 at 12.30.35.png]
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4a8a0941-dd65-4c22-bf16-4e11181794a0n%40googlegroups.com.


Favicon Error While Using Inline Favicon

2022-11-13 Thread James
Hello,

So everything is working but I get errors in my logs that I could just 
suppress, but I would rather just fix the error.

NGINX Error:
775#775: *2421 open() "/usr/share/nginx/html/favicon.ico" failed (2: No 
such file or directory)

Django Error (warning):
Not Found: /favicon.ico

So here's where things get interesting. I don't want to serve a favicon 
this way because I can't do a media query. I inline my favicon such that I 
can do a media query to detect light/dark mode and change the color of the 
favicon accordingly. If I save the inline code as a svg the media query 
will not work.

Is there a way around this, or I am forced to choose from implementing the 
media query at the nginx layer or not having my theme-responsive favicon?

Thanks very much! I hope this is interesting to someone because I think 
it's super neat to have the favicon change color based on a media query.

Best Regards,

-James Logan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/649de193-8817-402d-aa7c-39eed5737de2n%40googlegroups.com.


Re: Apps aren't loaded yet exception when trying to run migrate Django oscar

2022-11-12 Thread James
I fixed something similar once by having the model that was causing the 
problem be set to abstract in its class meta.

O you need to "makemigrations user" if you've opened up the usermodel 
and changed a lot of stuff (also had that problem before)

Hope these simple solutions work!

On Friday, November 11, 2022 at 11:38:44 AM UTC-7 imper...@gmail.com wrote:

> I'm trying to get to know django-oscar and this is what happens when i try 
> to make migrations : 
> Traceback (most recent call last):
>   File "C:\Users\Leslie\Desktop\GrandmarketV3\Grandmarket\manage.py", line 
> 22, in 
> main()
>   File "C:\Users\Leslie\Desktop\GrandmarketV3\Grandmarket\manage.py", line 
> 18, in main
> execute_from_command_line(sys.argv)
>   File 
> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\core\management\__init__.py",
>  
> line 419, in execute_from_command_line
> utility.execute()
>   File 
> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\core\management\__init__.py",
>  
> line 363, in execute
> settings.INSTALLED_APPS
>   File 
> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\conf\__init__.py",
>  
> line 82, in __getattr__
> self._setup(name)
>   File 
> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\conf\__init__.py",
>  
> line 69, in _setup
> self._wrapped = Settings(settings_module)
>   File 
> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\conf\__init__.py",
>  
> line 170, in __init__
> mod = importlib.import_module(self.SETTINGS_MODULE)
>   File 
> "C:\Users\Leslie\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py",
>  
> line 126, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 1050, in _gcd_import
>   File "", line 1027, in _find_and_load
>   File "", line 1006, in 
> _find_and_load_unlocked
>   File "", line 688, in _load_unlocked
>   File "", line 883, in exec_module
>   File "", line 241, in 
> _call_with_frames_removed
>   File 
> "C:\Users\Leslie\Desktop\GrandmarketV3\Grandmarket\Grandmarket\settings.py", 
> line 18, in 
> from oscar.core.compat import get_user_model
>   File 
> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\oscar\core\compat.py",
>  
> line 6, in 
> from django.contrib.auth.models import User
>   File 
> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\contrib\auth\models.py",
>  
> line 3, in 
> from django.contrib.auth.base_user import AbstractBaseUser, 
> BaseUserManager
>   File 
> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\contrib\auth\base_user.py",
>  
> line 48, in 
> class AbstractBaseUser(models.Model):
>   File 
> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\db\models\base.py",
>  
> line 108, in __new__
> app_config = apps.get_containing_app_config(module)
>   File 
> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\apps\registry.py",
>  
> line 253, in get_containing_app_config
> self.check_apps_ready()
>   File 
> "C:\Users\Leslie\Desktop\GrandmarketV3\Market\lib\site-packages\django\apps\registry.py",
>  
> line 136, in check_apps_ready
> raise AppRegistryNotReady("Apps aren't loaded yet.")
> django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
>
> This is my settings.py file:
> import os
> import oscar
>
> import django
> from django.conf import settings
> from oscar.core.compat import get_user_model
> from oscar.defaults import *
> from pathlib import Path
>
> # Build paths inside the project like this: BASE_DIR / 'subdir'.
> BASE_DIR = Path(__file__).resolve().parent.parent
>
>
>
> # Quick-start development settings - unsuitable for production
> # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
>
> # SECURITY WARNING: keep the secret key used in production secret!
> SECRET_KEY = 
>
> # SECURITY WARNING: don't run with debug turned on in production!
> DEBUG = True
>
> ALLOWED_HOSTS = []
>
>
> # Application definition
>
> INSTALLED_APPS = [
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'django.contrib.sites',
> 'django.contrib.flatpages',
>
> 'Grandmarket.'
> 'oscar.config.Shop',
> 'oscar.apps.analytics.apps.AnalyticsConfig',
> 'oscar.apps.checkout.apps.CheckoutConfig',
> 'oscar.apps.address.apps.AddressConfig',
> 'oscar.apps.shipping.apps.ShippingConfig',
> 'oscar.apps.catalogue.apps.CatalogueConfig',
> 'oscar.apps.catalogue.reviews.apps.CatalogueReviewsConfig',
> 'oscar.apps.communication.apps.CommunicationConfig',
> 'oscar.apps.partner.apps.PartnerConfig',
> 'oscar.apps.basket.apps.BasketConfig',
> 'oscar.apps.payment.apps.PaymentConfig',
> 'oscar.apps.offer.apps.OfferConfig',
> 'oscar.apps.order.apps.OrderConfig',
> 'oscar.apps.customer.apps.C

Re: Can't Load Django Dev Sever

2022-11-11 Thread James
Thanks so much! I thought I was doing something wrong when I deleted the 
cache and cookies and nothing happened. Just needed to restart my computer 
after clearing the cache/cookies; may have been a firefox bug!

Thanks again for you help!

Best Regards,

-James Logan

On Friday, November 11, 2022 at 1:01:56 AM UTC-7 ahmadabd...@gmail.com 
wrote:

> Try clearing cache and cookies for 127.0.0.1
>
> On Fri, Nov 11, 2022, 8:36 AM Mike Dewhirst  wrote:
>
>> Try visiting http://localhost:8000 instead
>>
>> No guarantees and I'm not going to test it myself ;-)
>>
>>
>>
>>
>>
>> --
>> (Unsigned mail from my phone)
>>
>>
>>
>>  Original message 
>> From: James  
>> Date: 11/11/22 16:13 (GMT+10:00) 
>> To: Django users  
>> Subject: Can't Load Django Dev Sever 
>>
>> Hello,
>>
>> I can't connect to my django web server and it's all my fault. I turned 
>> on SECURE_HSTS_SECONDS to 60 by accident in development, in another 
>> project, a few days ago.
>>
>> Now I can not load http://127.0.0.1:8000 on FireFox and I don't know how 
>> to fix it. And yes runserver is set to that port/ip and yes I can connect 
>> in incognito mode and in chrome.
>>
>> I have cleared all caches and cookies.
>>
>> Thanks very much!
>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/29a776ee-e840-45ad-885b-3f5752c9466fn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/29a776ee-e840-45ad-885b-3f5752c9466fn%40googlegroups.com?utm_medium=email&utm_source=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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/636dfb79.050a0220.368b6.8b8fSMTPIN_ADDED_MISSING%40gmr-mx.google.com
>>  
>> <https://groups.google.com/d/msgid/django-users/636dfb79.050a0220.368b6.8b8fSMTPIN_ADDED_MISSING%40gmr-mx.google.com?utm_medium=email&utm_source=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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a1f86756-0bd9-4743-a7fb-8c32d32b709cn%40googlegroups.com.


Can't Load Django Dev Sever

2022-11-10 Thread James
Hello,

I can't connect to my django web server and it's all my fault. I turned on 
SECURE_HSTS_SECONDS to 60 by accident in development, in another project, a 
few days ago.

Now I can not load http://127.0.0.1:8000 on FireFox and I don't know how to 
fix it. And yes runserver is set to that port/ip and yes I can connect in 
incognito mode and in chrome.

I have cleared all caches and cookies.

Thanks very much!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/29a776ee-e840-45ad-885b-3f5752c9466fn%40googlegroups.com.


Re: Django multistep form

2022-11-07 Thread James
Hi,

Can you also link the relevant urls.py please? 

Thanks!

On Monday, November 7, 2022 at 2:58:01 AM UTC-7 uobod...@gmail.com wrote:

> I have a multi-step form that is 3 steps but it has 4 forms. In the first 
> form, the user has to choose from two choices. The user’s first form 
> choices will determine the next form that will be displayed.
> The code is not working as it should. The first form choices are radio 
> buttons which are commercial and private. If the user chooses commercial it 
> brings the next form and if the user chose private it brings a different 
> form. My problem is that if the user chose private or commercial it brings 
> the same form.
> Views.py
> template
> forms.py
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f782c4e7-5d09-42d9-b3e7-a177ecce8368n%40googlegroups.com.


Re: HOW TO GET DJANGO MODELS FIELD VALUE FROM MODEL OBJECT IN TEMPLATE TAGS-DJANGO

2022-11-07 Thread James
Hi;

There's a method you're supposed to override in your views (inherit from 
Views) to do what you want, it's called "get_context_data". This method 
will pump whatever data you send to it into your template tags.


On Sunday, November 6, 2022 at 4:15:35 AM UTC-7 rani...@gmail.com wrote:

> my models.py
>
> class Locations(models.Model):
> region = models.ForeignKey(Regions, 
> on_delete=models.CASCADE,blank=True,null=True)
> name = models.CharField(max_length=255)
> active_flag = models.BooleanField(default=True)
> created_at = models.DateTimeField(auto_now_add = True)
> updated_at = models.DateTimeField(auto_now=True)
>
> def __str__(self):
> return self.name
>
>
> class Regions(models.Model):
> region_name = models.CharField(max_length=255)
> working_hours_per_day = models.CharField(max_length=255,null=True)
> days_per_week = models.CharField(max_length=255,null=True)
> hours_per_week = models.CharField(max_length=255,null=True)
> week_per_month = models.CharField(max_length=255,null=True)
> hours_per_month = models.CharField(max_length=255,null=True)
> days_per_year = models.CharField(max_length=255,null=True)
> weeks_per_year = models.CharField(max_length=255,null=True)
> active_flag = models.BooleanField(default=True)
> show_flag = models.BooleanField(default=True)
> created_at = models.DateTimeField(auto_now_add = True)
> updated_at = models.DateTimeField(auto_now=True)
>
> def __str__(self):
> return self.region_name
>
>
> views.py
>
> def center(request):
> locations = Locations.objects.select_related('region')
> td_serializer = LocationSerializer(locations,many=True)
> x=td_serializer.data
> data = {
> 'td':td_serializer.data,
> #'centers':center_serializer.data,
> } 
> return response.Response(data,status.HTTP_200_OK)
>
>
>
>
> template:
>
> fetchLocationsList(){
> this.$axios.$post('/projects/chcenter',config).then(response => {
> if(response){
> this.locations =response.td;
> for(let i=0;i  this.x=this.locations[i].name
> this.y=this.locations[i].region
> this.z=this.y + "-" +this.x
> this.result.push(this.z)
>
>
> How to get region_name ?
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/be86acab-55f2-4ce2-a1b5-930b1b5c77aen%40googlegroups.com.


Re: Static files is not loading while deploying the project to AWS ec2

2022-11-07 Thread James
It sounds like nginx doesn't know where your static files are being served 
from. If you don't want to bother with NGINX you can use Whitenoise.

Django doesn't serve staticfiles in production; something that isn't overly 
apparent. You still need something like apache or nginx or whitenoise to 
serve static files in production.

On Saturday, November 5, 2022 at 1:35:31 AM UTC-6 nishan...@gmail.com wrote:

> Hi all,
>
> I deployed the django project to AWS ec2 instance using nginx and gunicorn 
> but the static file is not loading at all.
>
> Can someone suggest where did I do wrong?
>
> Note - I've not created Profile before deploying 
>
> Here is my settings.py file
> STATIC_URL = 'static/'
> STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
> STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)
>
> Project URl - http://54.242.38.208/
> Github- https://github.com/Nishant-Sagar/BaskinSolar
>
> Thank you for your help,
> Nishant
>
>
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b2af5c41-3202-4bd4-b195-777a80f144e1n%40googlegroups.com.


Re: hello guys I need help

2022-08-30 Thread Rotimi Michael james
my name is engr rotimi michael james , i think i can help you please just
make the model  one to one relations , that is  one user to a page and a
page to one user, hope it help.

On Mon, Aug 29, 2022 at 3:06 PM ISTEEN ISAC  wrote:

> I am beginner ,  how to redirect different types of pages to different
> users after login in django
> <https://stackoverflow.com/questions/38199931/how-to-redirect-different-types-of-pages-to-different-users-after-login-in-djang>
>  ?
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/90a18a68-d66f-44d9-82e5-4498fa6c5fcen%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/90a18a68-d66f-44d9-82e5-4498fa6c5fcen%40googlegroups.com?utm_medium=email&utm_source=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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKbLKW3_q1ZaOO47mc9X%2B%3D8dUJ4rSCF9Z3C-S2VP8n4WLFiSAw%40mail.gmail.com.


Re: Job -Fullstack python expert ( Django framework)

2022-08-25 Thread Rotimi Michael james
am interested in the job

On Thu, Aug 18, 2022 at 8:03 PM Each1Teach1 <
pcintegral.pcintegr...@gmail.com> wrote:

> This project is very straight to the point. We are building a micro
> service on top of Django framework. We currently have a virtual private
> cloud on DO and will like to migrate to AWS in the nearest future. This
> hosts our encryption SDK including authentication APIs and licensing
> mechanism.
>
> Our current stack is Django framework (major code in java) using python
> over the py4j bridge to call and run it. This consumed via API (RestFul).
> We recently added Springboot.
>
> What we want to accomplish:
> We really need the qualified person to be ready to hit the ground running
> with new ideas and able to train or teach other fullstack developers. We
> fully cloud based.
> 1. Design and Build a micro service with clusters to address demand with
> licensing of our SDK orchestrated in a way that unauthorized cannot break
> to use it.
> 2. Automate our licensing protocols as we release bearer tokens for the
> use of our algorithm
> 3. Expand the API to include other functionality with 2 other companies
> 4. Build a fetch request based on push from clients mobile and web
> application in which our encryption algo is already embedded.
> 5. Integrate with eth staking for challenge where the actionable parameter
> e.g BMI could now be shared with data brokers n a secure and privacy
> preserving way.
>
> If you have the skills and believe that you are a good fit don't hesitate
> to reach me asap.
> We require that you will be available online e.g skype, whatsapp and as
> well as in our app for message..There could be a possible long term
> opportunity for the right candidate.
>
> There are many interesting projects.
>
> Be certain that you are a guru and can impart knowledge to others.
>
> Reach if you are interested.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BGDpiShO%2BF%3DtF_eB12kt0DSbVRWKRJ-39KpBfPfB%2BHmfvofKg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKbLKW3DLtrJbGKNPdLPARugzsC07rUsJikRYk1tnQ4XCm5EZQ%40mail.gmail.com.


Re: Django project(website) and cpane

2021-06-18 Thread James Maina
the hosting  company should provide a username and password for cpanel
login after you link with your domain and you'll be able to access the
login page using domainname.com/cpanel then use the login info and you'll
see a dashboard for uploading your files

On Fri, 18 Jun 2021, 00:14 Peter Kirieny,  wrote:

> would somebody please help me with the procedure on how to upload my
> django website on cpanel
> i used: python, pycharm, django,html css and some javascript
> I've already bought a domain name and hosting and i can log into cpanel
> please help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAL8t8eqJTRnRaZJo42U2EhiWpP6m_LLiwr1SK%3DQ35b6-BqkQpg%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO8x%3DSAOPKBFMZxst7jRaNQ7v1DVzqyJ9WjNma8yA7LcF9ftCA%40mail.gmail.com.


os module import error

2021-05-31 Thread James Ndubuisi
Good afternoon.
It seems on creating the Django project using django-admin startproject
command , the os module isn't imported by default, causing an error.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4ckVVeaT75CAPQWZeD6q6ewraHmaRH07W_6JQRemX6QV%2BXNA%40mail.gmail.com.


Re: Weird Django-admin bug

2021-02-04 Thread James Gutu
Sometimes this happens when there are issues with the html, css and
javascript files of the admin. Try re-installing django or restoring the
admin files.

On Wed, Feb 3, 2021 at 6:56 PM 'rossm6' via Django users <
django-users@googlegroups.com> wrote:

> Sorry to hear this but there is absolutely no way anybody could help based
> on this information alone.
>
> On Tue, Feb 2, 2021 at 6:25 PM yes...@gmail.com  wrote:
>
>> Hi
>>
>> I am having this situation where I try to have a look at an instance of a
>> specific model through Django-admin and the requests just goes on and on
>> and finally times out. This happens with only one of my models and all that
>> time there is absolutely no output in stdout.
>>
>> ex :
>> http://localhost:8001/admin/portfolio/achievement/ec2949e5-1c34-415f-ba30-f5aa51819891/change/
>>
>> This also happens on every browser running on localhost BUT it does not
>> happen if I try to see the same model instance from another computer on my
>> local network ?!?!
>>
>> ex :
>> http://192.168.0.4:8001/admin/portfolio/achievement/ec2949e5-1c34-415f-ba30-f5aa51819891/change/
>>
>> This happens with manage,py runserver. It does not happen in my
>> production environment (DjangoEurope) but I discovered this problem after
>> my last upload.
>>
>> Anybody has any clue as to what may be going on or how to find out ?
>>
>> Thanks !
>>
>> Django-3.1.5 / Python 3.9.1 / MacOS 10.11.6
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/53050d5c-2d8b-44d7-a9f1-c478adfca10cn%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/53050d5c-2d8b-44d7-a9f1-c478adfca10cn%40googlegroups.com?utm_medium=email&utm_source=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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJXS7_Pdo4%3DAxGNPM6oEBHTExJdAWuBn74YDVJ72Qzt5Hjqmcw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJXS7_Pdo4%3DAxGNPM6oEBHTExJdAWuBn74YDVJ72Qzt5Hjqmcw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 

-- 
Regards,
James Gutu

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOnWGO%2Br-6DW3Khh-uPQ5c%2BNat%2BQD1bB7%3DeBwvjGygg1mkJ3KQ%40mail.gmail.com.


Missing staticfiles manifest entry on heroku app, runs fine locally

2020-06-25 Thread James
Hi everyone,

I'm getting server error 500 when I deploy my app to heroku. The logs show 
an issue with staticfiles, even though I'm serving static and media from an 
S3 bucket:

ValueError: Missing staticfiles manifest entry for 'images/favicon.ico'

What's odd is that run I run locally, even with DEBUG=False, the app runs 
fine and I verified that the images are loading from the S3 bucket (both 
media and static). However, for some reason heroku is unable to load from 
S3.

Settings.py:

import os
import storages
import django_heroku


# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))




# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '***'


# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = (os.environ.get('DEBUG_VALUE') == 'True')
#DEBUG = False


ALLOWED_HOSTS = ['localhost', 'testapp.herokuapp.com', 'testapp.tv']




# Application definition
# NOTE: django_cleanup should be placed last in INSTALLED_APPS.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'taggit',
'storages',
'post.apps.PostConfig',
'ckeditor',
'sorl.thumbnail',
'django_cleanup.apps.CleanupConfig',
]


MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]


ROOT_URLCONF = 'testapp.urls'


TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]


WSGI_APPLICATION = 'testapp.wsgi.application'




# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases


DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}




# Password validation
# 
https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators


AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 
'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 
'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]




# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/


LANGUAGE_CODE = 'en-us'


TIME_ZONE = 'UTC'


USE_I18N = True


USE_L10N = True


USE_TZ = True




# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/


# STATIC_URL = '/static/'


# # Add these new lines
# STATICFILES_DIRS = (
# os.path.join(BASE_DIR, 'static'),
# )


# STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')


# Form messages
from django.contrib.messages import constants as messages


MESSAGE_TAGS= {
messages.DEBUG: 'alert-info',
messages.INFO: 'alert-info',
messages.SUCCESS: 'alert-success',
messages.WARNING: 'alert-warning',
messages.ERROR: 'alert-danger',
}


# Memcached settings
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}


# Amazon S3 settings and variables
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = 'testapp-files'


AWS_S3_FILE_OVERWRITE = False
AWS_DEFAULT_ACL = None


AWS_LOCATION = 'static'
AWS_S3_CUSTOM_DOMAIN='%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
AWS_S3_OBJECT_PARAMETERS = {
 'CacheControl': 'max-age=86400',
}


DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
#DEFAULT_FILE_STORAGE = 'testapp.storage_backends.MediaStorage'
STATICFILES_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
] 
STATIC_URL='https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, AWS_LOCATION)
ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'
STATICFILES_FINDERS = (   
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectori

Re: HOW TO PROTECT SOURCE CODE DEPLOYED TO A REMOTE SERVER

2020-05-20 Thread James Shen
try to deploy using a container technology like a docker , only expose port
80, and keep the login to SSH to yourself.

On Wed, May 20, 2020 at 4:54 PM John McClain  wrote:

> Hello Sunday,
>
> I wonder if you could deploy to git and use one of the licenses there to
> protect the code. I think they would be bound by the use the license
> permits. Have you looked at this as a possibility?
>
> John
>
> On Tue, 19 May 2020 at 02:35, Sunday Iyanu Ajayi 
> wrote:
>
>> I get your point but my solution is kind of a  SaaS Application. the
>> client wants to host it on his controlled server  and if they get the
>> source code, they can replicate, modify and maybe sell it.  Is there a way
>> to host the compiled file or lock the directory to the project.
>> *AJAYI Sunday *
>> (+234) 806 771 5394
>> *sunnexaj...@gmail.com *
>>
>>
>>
>> On Mon, May 18, 2020 at 9:28 PM Jim Armstrong 
>> wrote:
>>
>>> When I work on client projects, I deploy to a test server that is under
>>> my control. Once the project is complete and they have paid the invoice, I
>>> deploy to the production server under their control. At that point, I don't
>>> care if they have access to the code - my contracts give the clients all
>>> rights to the project code upon completion of the project.
>>>
>>>
>>> On Friday, May 15, 2020 at 9:22:33 AM UTC-4, Sunday Iyanu Ajayi wrote:

 I am working for a client that wants to deploy a project I am working
 on in a remote server and I will like to project my source code when
 deployed so that they will not be able to mess with it.

 How can  I  go about it please?

 *AJAYI Sunday *
 (+234) 806 771 5394
 *sunne...@gmail.com*

 --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/636f0636-30df-4ce2-8629-2be8b208ec37%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAKYSAw3Hqjuz5rD_AsZ5Wa%2B3WBzQ9LN0GzZKHx3D-irztJ1G0A%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> John McClain
>
> Cell: 085-1977-823
> Skype: jmcclain0129
> Email: jmcclain0...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN-hv_pbGUu7Qjm%2BZO7fOmT2H1W2C8Xy%2BhTk_6_BQcUcwc-XbA%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEmHaVuC4MJG6G1wfvJ_0QOEP7aRQK_OaSE5i_aWN19yt%3DGLog%40mail.gmail.com.


[ANNOUNCE] A new governance model has been adopted for the Django project

2020-03-12 Thread James Bennett
For several years, there have been efforts underway to change the way
the Django open-source software project is run. This eventually
produced a concrete proposal, which then went through discussion,
revision, and voting by the Django core team, Django Technical Board,
and Django Software Foundation Board, and has now been accepted.

There's a blog post up with a summary and link to the full new
governance document:

https://www.djangoproject.com/weblog/2020/mar/12/governance/

But if you want a super-short summary: up until now, there have been
around 50 "core" developers with full commit access and
decision-making power, and a Technical Board to act as a tie-breaker.
But this wasn't how the project actually worked -- most "core"
developers were inactive, and most decisions were made by consensus on
the django-developers mailing list or in the bug tracker. So we are
moving to a system that formally recognizes this, and officially
adopts a more open, consensus-based process that does away with the
special group of "core" developers. Since this is mostly just saying
officially that we'll do things the way they've been working, users of
Django probably will not notice any change :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL13Cg9hvNNHLM3nZqVAtT3vRbjTFibuZt-%3DgbgARwhk%2B489uw%40mail.gmail.com.


Channel 1 and Django 2.2 compatibility

2020-01-09 Thread James
Hello guys just a quick question, I have a project running channel 1, we 
are looking at upgrading to django 2.2, does channel 1 work with django 2.2 
without upgrading to channel 2?

Cheers

James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b14f62fd-c8cb-4dc3-8a2a-58090ae2d56a%40googlegroups.com.


Re: field error in live how to reslove

2019-12-20 Thread James Dunn
double underscore needed before the lte by the looks of it

On Wed, 18 Dec 2019 at 04:27, Ahmad Ebrahim  wrote:

> Show me your model and view
>
> On Tue, 17 Dec 2019, 20:11 MEGA NATHAN,  wrote:
>
>> Hi all.
>>
>> field error in live how to reslove
>> below i have to attach the screensh please find out and let 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/5b3c4129-583f-43d2-baee-8c4d2bcc74ce%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABrrHYo6a57aR0qf6ej8ev5pFgMTLF9gabwYnPc3PNQ0fypV4w%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOB9Tah6tmnbyLaRELVJ9dq20NK2Dut5PaTrCcEM1HsTHwhJtQ%40mail.gmail.com.


Re: Should a custom user have meta.swappable

2019-12-17 Thread James Bennett
On Tue, Dec 17, 2019 at 10:47 PM Mike Dewhirst 
wrote:

> ... and I wonder if my custom user model should have an identical Meta
> attibute?
>

No, The 'swappable' Meta attribute is private/undocumented API; if it were
meant to be a thing you needed to set, the documentation would tell you to
set it, rather than it being hidden away in the source code.

It exists to support Django's ability to replace the default User model
with a custom-defined model class; only the model class that is meant to be
replaceable declares the 'swappable' attribute.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL13Cg-G7zqWABf_VyZeUO9PtY67d5S-S7gpGdQwQXwR27mSbA%40mail.gmail.com.


Re: How to display on Django page based on user's condition?

2019-11-21 Thread James Dunn
In your view you can do:

user = request.user

Then you can get Employee with:

employee = Employee.objects.get(user=user)
Then just get the attributes from the models that you need:
eg:

employee.division


On Thu, 21 Nov 2019 at 19:57, Pema Galey  wrote:

> Hi All,
> I am Employee model directly link with User model and Employee holds User
> ID and division from Division model.
> Every employee holds single Division.
>
> class Employee(models.Model):
> user = models.OneToOneField(User, on_delete=models.CASCADE)
> division = models.ForeignKey(
> Division,
>
>
> )
>
> Now, I want to do following things:
> 1) Get current username /ID
> 2) Get Employee division ID/name
> 3) Display the other data based on Employee's division. [That particular
> Employee should be accessible to their own Division data only]
>
> Someone help me to handle this one please.
>
> Thank you 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a536c1fb-6852-48f9-8476-463c696926a2%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOB9TahHDNa36gXMPUbJw2W1drYpm1NGerJ_oc5CajsTRnixrg%40mail.gmail.com.


Re: Updates in production not showing up

2019-10-23 Thread James Gutu
If uwsgi is not installed, try gunicorn.

Like this article here
<https://www.digitalocean.com/community/questions/django-doesn-t-reflect-changes-made-to-settings-py-in-production>

On Wed, Oct 23, 2019 at 3:02 PM Tommy Delage  wrote:

> Thank you for the quick response
>
> it was easy to restart the ngnix server, but uwsgi is showing me a list
> like this ¸
>
> The program 'uwsgi' can be found in the following packages:
>  * uwsgi-core
>  * uwsgi-plugin-alarm-curl
>  * uwsgi-plugin-alarm-xmpp
>  * uwsgi-plugin-curl-cron
>  * uwsgi-plugin-emperor-pg
>  * uwsgi-plugin-erlang
>  * uwsgi-plugin-geoip
>  * uwsgi-plugin-graylog2
>  * uwsgi-plugin-jvm-openjdk-6
>  * uwsgi-plugin-jvm-openjdk-7
>  * uwsgi-plugin-ldap
>  * uwsgi-plugin-lua5.1
>  * uwsgi-plugin-lua5.2
>  * uwsgi-plugin-php
>  * uwsgi-plugin-psgi
>  * uwsgi-plugin-python
>  * uwsgi-plugin-python3
>  * uwsgi-plugin-rack-ruby1.9.1
>  * uwsgi-plugin-router-access
>  * uwsgi-plugin-sqlite3
>  * uwsgi-plugin-v8
>  * uwsgi-plugin-xslt
> Ask your administrator to install one of them
>
> When I look that up, it's all about installing and not restarting.
>
> Also, the changes I made are in lib/site-packages/
>
> What should I do next?
>
>
> Le mardi 22 octobre 2019 11:32:54 UTC-4, Tommy Delage a ĂŠcrit :
>>
>> I'm using django suit on digitalocean
>>
>> Anything I do in the files *.py doesn't show up in the production
>> environement,
>>
>> DigitalOcean doesn't want to go and take a look because those are files
>> in the application,
>>
>> I'm stuck big time, could you help me and go in my application and make a
>> minor change and tell me step by step how you did?
>>
>> I wish we could discuss this in private for the logins and stuff,
>>
>> Also I never used this Google Group thing so I don't know how or when I'm
>> gonna receive an answer
>>
>> Greatly 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a05585c4-df89-41cc-83ec-a41775da2a0f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a05585c4-df89-41cc-83ec-a41775da2a0f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

-- 
Regards,
James Gutu

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOnWGOLyx%2BR0pomck%3DOxEScj3kpK%2B240z-poZz8ceewk8nO0uw%40mail.gmail.com.


Re: Updates in production not showing up

2019-10-22 Thread James Gutu
Restart you uwsgi and/or nginx server.

On Tue, Oct 22, 2019 at 4:32 PM Tommy Delage  wrote:

> I'm using django suit on digitalocean
>
> Anything I do in the files *.py doesn't show up in the production
> environement,
>
> DigitalOcean doesn't want to go and take a look because those are files in
> the application,
>
> I'm stuck big time, could you help me and go in my application and make a
> minor change and tell me step by step how you did?
>
> I wish we could discuss this in private for the logins and stuff,
>
> Also I never used this Google Group thing so I don't know how or when I'm
> gonna receive an answer
>
> Greatly 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f9c37712-72fc-4ff0-bcf1-05a83fc1fe50%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f9c37712-72fc-4ff0-bcf1-05a83fc1fe50%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

-- 
Regards,
James Gutu

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOnWGOJH0_aWE8YZ4kY%3DtbLPXOGe7%2BOatZkkXV1GWciTapmLwA%40mail.gmail.com.


Re: Implementing multiple choice selection

2019-10-18 Thread James Gutu
Check this out here
<https://simpleisbetterthancomplex.com/tutorial/2018/01/29/how-to-implement-dependent-or-chained-dropdown-list-with-django.html>
.
It shows the solution at the form level.

On Fri, Oct 18, 2019 at 3:59 PM briodev  wrote:

> Halo guys, in the below snapshot, both Campus and Faculty classes have
> tuple of choices in the model.py file. I'd want a user to get available
> faculties depending on the choice selected on the campus, but I don't know
> how to implement this in the code. Help kindly.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0630f042-9fa8-4237-a293-d0adcffbe83b%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/0630f042-9fa8-4237-a293-d0adcffbe83b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

-- 
Regards,
James Gutu

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOnWGOKvbYF4oqjbLo9ArnpWfdKZYBA_B%3DBtaQkxzA15oYv4qQ%40mail.gmail.com.


Re: send_mail error

2019-10-18 Thread James Gutu
What error are you getting? Look at the traceback, or even copy paste it
here.
Ensure you have set the EMAIL_HOST_USER, EMAIL_HOST_PASSWORD,
EMAIL_HOST_PORT correctly in the settings.py file.

On Thu, Oct 17, 2019 at 3:27 PM challa.Harikrishna chowdary <
challahari0...@gmail.com> wrote:

> Hi
>
>   i am sending the mail from front end to gmail account please help he
>
>
>
>
> thanks and  regards
> ch.Hari
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f7cf2f08-86f8-4d53-9c31-1066a4bf1476%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f7cf2f08-86f8-4d53-9c31-1066a4bf1476%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

-- 
Regards,
James Gutu

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOnWGOLN%3Dcugc59Z1AfNOfi4p7_nueHfoq_NAbFXCXefA3vRuw%40mail.gmail.com.


Re: Arbitrary GROUP BY fields

2019-10-18 Thread James Gutu
I am thinking along the lines of this:

page_titles =
PageTitles.object.select_related('category','rating').values('id',
'category_id', 'rating_id').order_by('date','id').annotate(
allow=Sum('allow'),
block=Sum('block'),
hits=Sum('hits'))

To get it right, you may have to share your models. Hope this helps. Let me
know how it goes.

On Fri, Oct 18, 2019 at 12:00 AM thinkwell 
wrote:

> I'm using pg-partitioning
> <https://github.com/chaitin/django-pg-partitioning> to partition tables
> on Django 2.2 & Postgres 11. It's working great as far as that goes, except
> that I bumped hard into annotated queries. Since PG can't guarantee PK
> uniqueness across partitioned tables, it requires including all fields in
> the GROUP BY that will in the output.
>
> Django generates this query:
>
> SELECT
>
>   "page_titles"."id",
>
>   "page_titles"."date",
>
>   "page_titles"."name",
>
>   "page_titles"."title",
>
>   SUM("page_titles"."allow") AS "allow",
>
>   SUM("page_titles"."block") AS "block",
>
>   SUM("page_titles"."hit_count") AS "hits",
>
>   "categories_category"."name" AS "category_name",
>
>   "categories_rating"."name" AS "rating_name"
>
> FROM
>
>   "page_titles"
>
>   LEFT OUTER JOIN "categories_category" ON ("page_titles"."category_id" =
> "categories_category"."id")
>
>   LEFT OUTER JOIN "categories_rating" ON ("page_titles"."rating_id" =
> "categories_rating"."id")
>
> GROUP BY
>
>   "page_titles"."id",
>
>   "categories_category"."name",
>
>   "categories_rating"."name"
>
> ORDER BY
>
>   "page_titles"."date" DESC,
>
>   "page_titles"."id" DESC;
>
> That query raises an error:
>
> ERROR:  column "page_titles.date" must appear in the GROUP BY clause or
> be used in an aggregate function
>
> LINE 3: "page_titles"."date",
>
> ^
>
> So if we add all the (non-summed) fields in the GROUP BY that the query
> will return, as the query below, then the query runs successfully.
>
>
> SELECT
>
>   "page_titles"."id",
>
>   "page_titles"."date",
>
>   "page_titles"."name",
>
>   SUM("page_titles"."allow") AS "allow",
>
>   SUM("page_titles"."block") AS "block",
>
>   SUM("page_titles"."hit_count") AS "hits",
>
>   "categories_category"."name" AS "category_name",
>
>   "categories_rating"."name" AS "rating_name"
>
> FROM
>
>   "page_titles"
>
>   LEFT OUTER JOIN "categories_category" ON ("page_titles"."category_id" =
> "categories_category"."id")
>
>   LEFT OUTER JOIN "categories_rating" ON ("page_titles"."rating_id" =
> "categories_rating"."id")
>
> GROUP BY
>
>   "page_titles"."id",
>
>   "page_titles"."date",
>
>   "page_titles"."name",
>   "page_titles"."title",
>   "categories_category"."name",
>
>   "categories_rating"."name"
>
> ORDER BY
>
>   "page_titles"."date" DESC,
>
>   "page_titles"."id" DESC;
>
>
> I really can't be using raw SQL for these queries because of dynamic WHERE
> clauses. Is there a way to use / extend the ORM to add arbitrary GROUP BY
> fields?
>
> Or any other suggestion about how to use the ORM to generate queries on
> partitioned tables where Postgres doesn't have a global index...?
>
> TIA!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/414d3e70-418c-41e9-becb-65209ed0b7eb%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/414d3e70-418c-41e9-becb-65209ed0b7eb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

-- 
Regards,
James Gutu

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOnWGOJD%2B-Mb8PwPgYwyY8odkfU%2B%2BW1CPXZiEBNTk-nQj%3Dgtew%40mail.gmail.com.


Re: Creating an app that generates static files

2019-10-18 Thread James Gutu
Jack,
That sounds about right.

On Thu, Oct 17, 2019 at 11:22 PM Jack Sundberg 
wrote:

> Thank you, James! This seems like a good fix. From reading through the
> documentation (here
> <https://docs.djangoproject.com/en/2.2/topics/http/sessions/>), this is
> how I understand the workflow -- so correct me if I'm wrong please!
>
>  > First, I can activate Django sessions by
> adding 'django.contrib.sessions' to my installed apps.
>  > Django by-default stores session info in the SQLite database --
> therefore, each session entry will have an ID assigned to it automatically.
>  > I can use each session_id to create a temporary folder in some
> directory (say /tmp) where the generated files can be made. So folder
> structure will look like:
> tmp/
> [session_id1]/
> file1.tlgf
> file2.bin
> [session_id2]/
> file1.tlgf
> file2.bin
> 
>  > when sessions data hits a certain threshold, I can call
> django.contrib.sessions.clearsessions which will delete expired session
> entries in the database
>  > pull out which entries were deleted and then delete the corresponding
> tmp/[session_id] directory
>
> Is that the best way to do it?
>
> -Jack
>
>
> On Thursday, October 17, 2019 at 4:42:04 PM UTC-4, James Gutu wrote:
>>
>> Jack,
>>
>> From what I understand it looks like a conflict of uniquely named files
>> when they are generated simultaneously.
>> Could you resolve this by creating a folder named from the session_id,
>> with the file inside of that. So that if two users request the same file,
>> there will never be a conflict, as the unique file will be created in both
>> folders.
>>
>> [user_1_session_id]/entry123.jpeg
>> [user_2_session_id]/entry123.jpeg
>>
>> Though, this might seem like a fix, but the issue may be more fundamental
>> than file names.
>> Let me know what you think.
>>
>> Regards,
>> James
>>
>> On Thu, Oct 17, 2019 at 4:23 PM Jack Sundberg 
>> wrote:
>>
>>> Yes, I tried getting the idea across in layman terms, as I hope this
>>> helps discussion of the issue -- and then I can later translate the
>>> solution into django implementation.
>>>
>>> I avoided the full process in my original post for clarity. I used the
>>> *.jpeg file as an illustrative example, when I'm actually generating *.gltf
>>> and *.bin files. These files are typically a couple hundred KB in size, but
>>> I will have thousands of them (millions as I add to my database). These
>>> files are used in coordination with Verge3D  - an app built on top of
>>> Three.js for 3D rendering. Verge3D allows use of Blender for CAD, which is
>>> a python-based program that my scripts are written in. Running of these
>>> scripts are certainly cpu intensive; however I am going to get around this
>>> by using an  of this Verge3D request.
>>>
>>> So to be more specific, my app does the following:
>>>  - the url mapping pulls a database entry
>>>  - the app serves the proper html template with an  embedded in
>>> it. It displays a loading screen while the 3D model is created backend.
>>>  - the  calls a separate app using the identical data entry
>>>  - using the data entry, static files are created from the data (Blender
>>> script creates a *.gltf and *.bin)
>>>  - the app serves the html template with the generated static files
>>> embedded inside the 
>>>
>>> Is this helpful? Also thank you for the quick response. I really
>>> appreciate the help.
>>>
>>> -Jack
>>>
>>>
>>> On Thursday, October 17, 2019 at 10:56:56 AM UTC-4, vineet daniel wrote:
>>>>
>>>> This problem can happen with any stack and shouldn't be considered as
>>>> django specific. What you are looking for is a solution in a layman
>>>> terms.which then can be translated to django implementation.
>>>>
>>>> Before that i would like to know image size and kind of image that you
>>>> create. Is it some qr code or what?
>>>>
>>>> Please note that working with images on the fly is always a cpu
>>>> intensive operation. Ill can come up with something once you share the
>>>> details with me.
>>>>
>>>> On Thu, 17 Oct 2019, 20:00 Jack Sundberg,  wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>&

Re: Creating an app that generates static files

2019-10-17 Thread James Gutu
Jack,

>From what I understand it looks like a conflict of uniquely named files
when they are generated simultaneously.
Could you resolve this by creating a folder named from the session_id, with
the file inside of that. So that if two users request the same file, there
will never be a conflict, as the unique file will be created in both
folders.

[user_1_session_id]/entry123.jpeg
[user_2_session_id]/entry123.jpeg

Though, this might seem like a fix, but the issue may be more fundamental
than file names.
Let me know what you think.

Regards,
James

On Thu, Oct 17, 2019 at 4:23 PM Jack Sundberg 
wrote:

> Yes, I tried getting the idea across in layman terms, as I hope this helps
> discussion of the issue -- and then I can later translate the solution into
> django implementation.
>
> I avoided the full process in my original post for clarity. I used the
> *.jpeg file as an illustrative example, when I'm actually generating *.gltf
> and *.bin files. These files are typically a couple hundred KB in size, but
> I will have thousands of them (millions as I add to my database). These
> files are used in coordination with Verge3D  - an app built on top of
> Three.js for 3D rendering. Verge3D allows use of Blender for CAD, which is
> a python-based program that my scripts are written in. Running of these
> scripts are certainly cpu intensive; however I am going to get around this
> by using an  of this Verge3D request.
>
> So to be more specific, my app does the following:
>  - the url mapping pulls a database entry
>  - the app serves the proper html template with an  embedded in
> it. It displays a loading screen while the 3D model is created backend.
>  - the  calls a separate app using the identical data entry
>  - using the data entry, static files are created from the data (Blender
> script creates a *.gltf and *.bin)
>  - the app serves the html template with the generated static files
> embedded inside the 
>
> Is this helpful? Also thank you for the quick response. I really
> appreciate the help.
>
> -Jack
>
>
> On Thursday, October 17, 2019 at 10:56:56 AM UTC-4, vineet daniel wrote:
>>
>> This problem can happen with any stack and shouldn't be considered as
>> django specific. What you are looking for is a solution in a layman
>> terms.which then can be translated to django implementation.
>>
>> Before that i would like to know image size and kind of image that you
>> create. Is it some qr code or what?
>>
>> Please note that working with images on the fly is always a cpu intensive
>> operation. Ill can come up with something once you share the details with
>> me.
>>
>> On Thu, 17 Oct 2019, 20:00 Jack Sundberg,  wrote:
>>
>>> Hi all,
>>>
>>> I am currently writing an app that generates static files before serving
>>> them, and I could use some input! Here's a step-by-step example of how the
>>> app is setup:
>>>
>>>  - the url mapping pulls a database entry
>>>  - using the data entry, static files are created from the data (for
>>> example, a *.jpeg or a *.gltf)
>>>  - the app serves the html template with the generated static files
>>> embedded (for example, via an  tag)
>>>
>>> The issue comes with the creation of the unique static files. I can have
>>> the app create a file in the static folder, send it off, then delete the
>>> file to ready for the next request -- but the webpage will run into issues
>>> if multiple requests are made at the same time. If two people request the
>>> same url at the same time, the app will fail because both requests are
>>> trying to create/serve/delete an identical file (i.e. entry123.jpeg) at the
>>> same time. Trying to mess with the filename to avoid this won't work here
>>> either (i.e. naming entry123.01.jpeg, entry123.02.jpeg, entry123.03.jpeg,
>>> ...).
>>>
>>> I can think of two solutions, but they both are things I'd like to avoid:
>>>  1. have the files premade and stored -- I want to avoid this because of
>>> the massive filesize required for all these files
>>>  2. have the static files generated in a user-specific directory -- I
>>> want to avoid this because I'd rather not have registered users on my
>>> website
>>>
>>> Is there another solution to this? I'm still relatively new with Django,
>>> so there might be something simple I'm missing.
>>>
>>> -Jack
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe fro

Re: set school year and change boolean to False when school year is not active

2019-10-17 Thread James Gutu
It depends what you are trying to achieve.
What do you mean by "then when school year end  this would automatically
in_active"?
Do you need to determine start_date <= self.end_year *only when saving* or
you need to check *everyday* to see if datetime.now() > self.end_year?

On Thu, Oct 17, 2019 at 4:27 PM Rain  wrote:

> Hi Guys!! Hope Fully someone can help me any hint or answer really
> appreaciated..
> ireally stuck here in a couple of days now.
> My Problem is i want to set a school year using
> start_year and end_year field then when school year end  this would
> automatically in_active
> for example
> start_year: 2019-01-01
> end_year: 2020-01-01
> active_year: True
>
> then when 2020-01-01 ends
> the boolean will automatically change the status to
> active_year:False
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e429d5d2-a6fc-4bf1-82b0-1c12e08f3f49%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e429d5d2-a6fc-4bf1-82b0-1c12e08f3f49%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

-- 
Regards,
James Gutu
Mobile: +447368461508
Skype: jmgutu

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOnWGOLqLHhZeo9brsWuVNipaOX3yyxuW%2BN22tq7xbe_XEg7hA%40mail.gmail.com.


Re: where to report django issues?

2019-09-22 Thread James Schneider
>From the main website: https://code.djangoproject.com/

Also from the FAQ:

https://docs.djangoproject.com/en/2.2/faq/help/#i-think-i-ve-found-a-bug-what-should-i-do

https://docs.djangoproject.com/en/2.2/internals/contributing/bugs-and-features/#reporting-bugs

HTH,

-James

On Sun, Sep 22, 2019, 10:53 AM MW  wrote:

> unlike other github project, there is no "issues" link on
>
> https://github.com/django/django
>
>
> I'm wondering where to report django (source code) issues?
>
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2228313e-f816-4386-aa0d-6ebdff5963da%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2228313e-f816-4386-aa0d-6ebdff5963da%40googlegroups.com?utm_medium=email&utm_source=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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWtPzafHcUqy%3DG7J%2BfGVBq_-jKev4rAX0r2DRqkzPnm%2BQ%40mail.gmail.com.


Re: Reverse for 'modification' with no arguments not found issue

2019-08-31 Thread James Schneider
>
> The line with a problem is that one
>
> return render(request, 'insertion/modification.html', locals())
>
>
>
> And I really can't figure it out why, according the fact that "locals()"
> contains my variable and even if I send directly my variable instead, I get
> the same !
>

There's probably a URL tag in that template that is missing a variable or
has a typo in the variable reference. The error is complaining about a
reverse call, not a render call. It might be in a different part of the
traceback or error page. You need to look closer at the original error
page, it probably cites something in the modification.html template, and
you didn't post that one.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXbr%3DtVaF5HredGqGK0LQ_9SiHuNKcv1%2Be0HFn1cX-zEQ%40mail.gmail.com.


Re: Reverse for 'modification' with no arguments not found issue

2019-08-28 Thread James Schneider
On Wed, Aug 28, 2019, 2:00 AM Ali IMRANE  wrote:

> Thanks James for your help.
>
> Indeed, I tought about that problem but I already managed to see an number
> on an other page, as well as using that ID to read information behind my
> informations (as you can see in the third line I gave on "lire.html"). A
> number is printed. How can I know that it is an *int* and not a *string*
> use in there ?
>

In the template it won't matter whether it is an int or a string, it gets
implicitly converted to a string for the regex match anyway.



>> # Nous pourrions ici envoyer l'e-mail grâce aux donnÊes
>> # que nous venons de rĂŠcupĂŠrer
>> envoi = True
>> redirect(home)
>>
>>
What is the home variable in the redirect statement above? It isn't defined
in your view. I think that will need an extra argument. What line is the
traceback actually complaining about?

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUugGMgB6JhMkLpYc59s7%3DFi6ES3ccvRgPk%2BtXNCX2DxA%40mail.gmail.com.


Re: page not found but url exists

2019-08-26 Thread James Schneider
> Using the URLconf defined in bnt.urls, Django tried these URL patterns,
> in this order:
>
>1. admin/
>2. [name='home']
>3. /login [name='clogin']
>4. /login/customer [name='cpage']
>5. /register [name='cregister']
>6. /register/customer [name='cpage']
>
> The current path, register, didn't match any of these.
>


I'm assuming your template has a typo in the {% url %} tag referencing
'register' instead of 'cregister'.

The rest of the error page should indicate the line that is making the URL
name resolution call.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWdirAoL_xMRJEdD%3DRY6omVH4UC6xsFFb4RfH747LaSNA%40mail.gmail.com.


Re: reload the page and the logged in user converted to the admin

2019-08-24 Thread James Schneider
> request.user there is a current user, but if I reload the page, the
> currennt user converted to the admin ?
> Enter code here...
> def countries_rate(request):
> auth_user = request.user
> if request.user.is_authenticated:
> auth_user = request.user
> if (user_rate.objects.filter(user_id=auth_user).delete()):
> print(auth_user,' OK deleted .')
> formset = countriesFormset(request.POST or None)
>


Not sure if it's related, but is there a reason you immediately delete the
logged-in user as soon as the page loads? Even before any forms are
submitted?

-James

>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUTY%3DyMCqqRVQWPQyaq7%3D7D2-Zs-3wNK0HfH%2BCXRURkAQ%40mail.gmail.com.


Re: Get queryset outside models.py

2019-08-23 Thread James Schneider
>
>
> I would like to know if it is possible to retrieve *models*.mymodel
> instance from outside the models.py to retrieve a queryset.
>

Yes, a vast majority of the time you'll be retrieving instances from your
views and templates. There are only a few cases where you would retrieve
instances within models.py.


> I want to make a selection in a specific model but I am not inside the
> model.
>

In almost all cases you will NOT be inside of the code for the model when
pulling instances from the database.


> I need to perform some update in my action  model but the information is
> in another entity.
>
> I tryed to use Manager (mymodel = models.Manager() but I havn't found any
> function to get an specific queryset from Manager.
>
> Could someone help me with this issue?
>

Without the specific code you are using, I can't comment on what issue you
are having, however, the one line you provided doesn't appear to follow the
convention if you are replacing the default model manager. More information
can be found here:


https://docs.djangoproject.com/en/2.2/topics/db/managers/#custom-managers


However, given the other questions you are asking, I doubt you have need
for a custom model manager at this stage. I have a feeling you are
implementing it simply to address other built-in functionality you want
that you may not be aware of how to access. I could be wrong, though.

I'd recommend running through the official tutorial, as that covers the
information to answer your questions and broaden your understanding in some
detail.


https://docs.djangoproject.com/en/2.2/intro/tutorial01/



-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUZRkfJ2YsjfwRZncgSkarOU2EeJ9%3D6QHp6X77FmRtePQ%40mail.gmail.com.


Re: Hello, everybody! I've tried using FormMixin with DetailView and I get error 405 on post method. Can anybody help me? Thanks a lot.

2019-08-22 Thread James Schneider
Post the full error message and/or traceback reported by the server when
the error occurs.

-James

On Thu, Aug 22, 2019, 12:31 PM Catalina Popescu <
catalina.t.pope...@gmail.com> wrote:

> views.py
>
> class BookDisplay(DetailView):
> model = Book
> template_name = 'books/book_detail.html'
>
> def get_context_data(self, **kwargs):
> context = super().get_context_data(**kwargs)
> context['form'] = WishBookForm()
> return context
>
> class WishBook(SingleObjectMixin, FormView):
> form_class = WishBookForm()
> template_name = 'books/book_detail.html'
> model = Status
>
> def post(self, request):
> if not request.user.is_authenticated:
> return HttpResponseForbidden()
> self.object = self.get_object()
> return super().post(request)
>
> def get_success_url(self):
> return reverse('books/book_detail', kwargs = {'pk': self.object.pk
> })
>
>
> class BookDetail(View):
> def get(self, request):
> view = BookDisplay.as_view()
> return view(request)
>
> def post(self, request):
> view = WishBook.as_view()
> return view(request)
>
> forms.py
>
> class WishBookForm(forms.Form):
> status = forms.ChoiceField(choices=Status.GIVEAWAY_STATUS[:2],
> initial='Cu chef de ducă')
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/231fd7dc-3bf2-465c-993b-c476b0ca4dc1%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/231fd7dc-3bf2-465c-993b-c476b0ca4dc1%40googlegroups.com?utm_medium=email&utm_source=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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciX1baRiKGuYZZcjdMeDyPpicaiqk9aP2fyLMnQEBFQdDw%40mail.gmail.com.


Re: Reverse for 'modification' with no arguments not found issue

2019-08-22 Thread James Schneider
>
> lire.html
> ...
>type="button">Editer larequĂŞte
> ...
>
> urls.py
> path('edit/', views.view_modif, name='modification'),
> error :
> NoReverseMatch at /edit/1
>
> Reverse for 'modification' with no arguments not found. 1 pattern(s) tried: 
> ['edit/(?P[0-9]+)$']
>
> Request Method: GET
> Request URL: http://127.0.0.1:8000/edit/1
> Django Version: 2.0
> Exception Type: NoReverseMatch
> Exception Value:
>
> Reverse for 'modification' with no arguments not found. 1 pattern(s) tried: 
> ['edit/(?P[0-9]+)$']
>
> Exception Location: /usr/lib/python3.7/site-packages/django/urls/resolvers.py
> in _reverse_with_prefix, line 632
> Python Executable: /usr/bin/python
>



The error is saying you have no arguments to the {% url %} tag. Make sure
that req.id is actually resolving to an integer value.

Templates are fun when they mask missing values like that. You already have
it displayed earlier in the template. Comment out the {% url %} tag and see
if a number is displayed in your template.

-James

>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWV4K7%2BvTb8q8sGQBnbsY9t4srQK%2BH_NSZMCKSNp6KnAA%40mail.gmail.com.


Re: Syntax Error django, python issue

2019-07-28 Thread James Schneider
On Sun, Jul 28, 2019, 10:54 AM Kean  wrote:

> Hi Chetan
>
> pls see setup below
>

It looks like you may have copied in the ellipses (...) from the example.
Remove those lines and try again.

-James

>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWmVnVz8tckY1yf%3DU6nr2neZ_HbHK1K9pLc1NCkisCvGQ%40mail.gmail.com.


Re: How to set (global) context value from a templatetag?

2019-07-28 Thread James Schneider
>
>
>
> from django.template import RequestContext; rc = RequestContext(request)
>
>
> rc contains all the context that had been passed on to TemplateResponse
> within the view, o I want to add few more there from the template tag and
> just cant figure out how.
>
> Thanks a lot for any ideas!
>

First thing that comes to mind:

https://docs.djangoproject.com/en/2.2/howto/custom-template-tags/#setting-a-variable-in-the-context


If you'll be using these same variables in a majority of your templates,
then I'd recommend looking at a custom template context processor:

https://docs.djangoproject.com/en/2.2/howto/custom-template-tags/#setting-a-variable-in-the-context

That way you can define constants in you application code and have them
automatically pulled in as template variables in all your templates without
having to repeat a template tag in every template.

-James

>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVc6t6NCVgHOGX_WUpgBnkVe%2BtxF-8gG6-i5Ou-G_4Rbg%40mail.gmail.com.


Re: Running pending migrations in Middleware

2019-07-28 Thread James Schneider
On Sun, Jul 28, 2019, 12:47 AM David Grant  wrote:

> Anyone see any problems with running migrations in Middleware?
>

What's the actual problem you are trying to solve by doing this? This is a
bad idea for a number of reasons, and I can't think of any good ones.

-James

>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciU%3DL5K-sBT6PkeUk4MpQYxxrSVLDLQ%3DZE2MmTF76BY7Uw%40mail.gmail.com.


Re: use of migrate command and how to see the tables

2019-07-19 Thread James Bennett
On Fri, Jul 19, 2019 at 2:58 AM yasar arafath Kajamydeen 
wrote:

> Thanks for the reply. Please try to solve the error which i shared (screen
> shot ).
>

It is not an error. You have no migrations to apply, so the migrate command
is telling you it sees nothing to do.

It may help you to read the official Django tutorial, which includes
creating models and migrations and applying them:

https://docs.djangoproject.com/en/2.2/intro/tutorial01/

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


Help filtering choice_set based on size of set in Django Tutorial

2019-07-09 Thread James Boulger
till new to this and I assume it may be due to the difference between 
the generic Listview and the generic DetailView, or some issue with how the 
content of the html templates polls/detail.html or polls/index.html is 
rendered but I have no previous experience with html and only understand 
Python in principle without working on any previous big projects like this. 

Any help would be appreciated.

James

-- 
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/a9d794d0-e8d4-43ac-bf2f-5aa7f4078098%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: do i need a custom admin app or should i just use django admin?

2019-06-17 Thread James Farris
Read the docs regarding this.
https://docs.djangoproject.com/en/2.2/topics/auth/default/#permissions-and-authorization


On Mon, Jun 17, 2019 at 11:31 AM Rajat Chopra  wrote:

> What are the reasons not to use Django Admin?
>
> Also with regards to creating views and giving those views permissions -
> are there any examples someone can point to help illustrate?
>
>
>
> On Monday, June 17, 2019 at 11:40:53 AM UTC-5, James Farris wrote:
>>
>> Think of the Django Admin as a tool for developers or Database Admins.
>> IMO, it should never be used by an end user.  Create views as Andreas
>> mentioned and give those views permissions.
>>
>> On Monday, June 17, 2019 at 4:12:53 AM UTC-7, Arya wrote:
>>>
>>> i'm planning to build a full ecommerce business to business website.
>>> there are several user types.
>>> *premium users need to create products and edit them. they need to
>>> communicate to each other. see statistics and access some premium content.*
>>> do you suggest to user the default django admin? or i'm better off
>>> creating a custom admin app ?
>>>
>> --
> 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/1LpORyVyQls/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/2b4f9ad1-2c29-42ca-b585-3b96e0a07118%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2b4f9ad1-2c29-42ca-b585-3b96e0a07118%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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/CAMdMWAURSPzwwxWAdf9dw_YApzH7S1jfso7_JObaPhg1MLfZTQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: do i need a custom admin app or should i just use django admin?

2019-06-17 Thread James Farris
Think of the Django Admin as a tool for developers or Database Admins.  
IMO, it should never be used by an end user.  Create views as Andreas 
mentioned and give those views permissions.

On Monday, June 17, 2019 at 4:12:53 AM UTC-7, Arya wrote:
>
> i'm planning to build a full ecommerce business to business website. there 
> are several user types.
> *premium users need to create products and edit them. they need to  
> communicate to each other. see statistics and access some premium content.*
> do you suggest to user the default django admin? or i'm better off 
> creating a custom admin app ?
>

-- 
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/851b7542-0dcf-49ca-85e6-1e306899720a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: my file uploads missing/deleted

2019-06-13 Thread James Farris
; File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in render_annotated
>   904. return self.render(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/loader_tags.py"
> in render
>   150. return compiled_parent._render(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in _render
>   163. return self.nodelist.render(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in render
>   937. bit = node.render_annotated(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in render_annotated
>   904. return self.render(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/loader_tags.py"
> in render
>   62. result = block.nodelist.render(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in render
>   937. bit = node.render_annotated(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in render_annotated
>   904. return self.render(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in render
>   987. output = self.filter_expression.resolve(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in resolve
>   671. obj = self.var.resolve(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in resolve
>   796. value = self._resolve_lookup(context)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/template/base.py"
> in _resolve_lookup
>   837. current = getattr(current, bit)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/fields/files.py"
> in url
>   62. return self.storage.url(self.name)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/utils/functional.py"
> in inner
>   256. self._setup()
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py"
> in _setup
>   363. self._wrapped = get_storage_class()()
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py"
> in get_storage_class
>   358. return import_string(import_path or
> settings.DEFAULT_FILE_STORAGE)
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django/utils/module_loading.py"
> in import_string
>   17. module = import_module(module_path)
>
> File "/app/.heroku/python/lib/python3.6/importlib/__init__.py" in
> import_module
>   126. return _bootstrap._gcd_import(name[level:], package, level)
>
> File "" in _gcd_import
>   994. 
>
> File "" in _find_and_load
>   971. 
>
> File "" in _find_and_load_unlocked
>   955. 
>
> File "" in _load_unlocked
>   665. 
>
> File "" in exec_module
>   678. 
>
> File "" in _call_with_frames_removed
>   219. 
>
> File
> "/app/.heroku/python/lib/python3.6/site-packages/django_dropbox_storage/storage.py"
> in 
>   8. from StringIO import StringIO
>
> Exception Type: ModuleNotFoundError at /8/clubpage/
> Exception Value: No module named 'StringIO'
>
>
> On Thursday, June 13, 2019 at 5:11:37 PM UTC+2, omar ahmed wrote:
>>
>> i added django_dropbox_storage in installed apps in settings.py
>> what should i add else ?
>> thanks
>> On Thursday, June 13, 2019 at 4:43:23 PM UTC+2, James Farris wrote:
>>>
>>> That means it wasn’t installed or it wasn’t added to your settings.py
>>> file in the installed apps section
>>>
>>> Sent from my mobile device
>>>
>>> On Jun 13, 2019, at 7:07 AM, omar ahmed  wrote:
>>>
>>> i followed the steps
>>> when i typed
>>> python manage.py test [--settings=test_settings]
>>> i found this error
>>> ModuleNotFoundError: No module named '[--settings=test_settings]'
>>> and when i tried to open my site (club page that has image) i foun this
>>> error
>>>
>>> No module named 'StringIO'
>>>
>>> i sea

Re: my file uploads missing/deleted

2019-06-13 Thread James Farris
When you run the server does it give you any errors?

On Thu, Jun 13, 2019 at 8:12 AM omar ahmed  wrote:

> i added django_dropbox_storage in installed apps in settings.py
> what should i add else ?
> thanks
> On Thursday, June 13, 2019 at 4:43:23 PM UTC+2, James Farris wrote:
>>
>> That means it wasn’t installed or it wasn’t added to your settings.py
>> file in the installed apps section
>>
>> Sent from my mobile device
>>
>> On Jun 13, 2019, at 7:07 AM, omar ahmed  wrote:
>>
>> i followed the steps
>> when i typed
>> python manage.py test [--settings=test_settings]
>> i found this error
>> ModuleNotFoundError: No module named '[--settings=test_settings]'
>> and when i tried to open my site (club page that has image) i foun this
>> error
>>
>> No module named 'StringIO'
>>
>> i searched at Google but no similar issues
>>
>> On Thursday, June 13, 2019 at 1:03:10 AM UTC+2, James Farris wrote:
>>>
>>> This python package may be a better choice for you, since I assume you
>>> want all user generated content (images) to be stored in Dropbox.
>>>
>>> This has pretty good documentation.
>>> https://pypi.org/project/django-dropbox-storage/
>>>
>>> If you use this package, remove the sample code I sent
>>>
>>>
>>> On Wed, Jun 12, 2019 at 3:53 PM omar ahmed  wrote:
>>>
>>>> i added this function at the end of views.py file
>>>> def connect_to_dropbox():
>>>> dbx = dropbox.Dropbox(‘your access token)
>>>> dbx.users_get_current_account()
>>>> and i put given access token from dropbox
>>>> then what about call
>>>> do you mean in any view function that will show page included images
>>>> add
>>>> connect_to_dropbox()
>>>> and what about
>>>>
>>>> for entry in dbx.files_list_folder('').entries:
>>>> print(entry.name)
>>>>
>>>>
>>>>
>>>> On Thursday, June 13, 2019 at 12:38:11 AM UTC+2, James Farris wrote:
>>>>>
>>>>> You would add this code to the views.py file, which is where the
>>>>> business logic goes.
>>>>>
>>>>> https://docs.djangoproject.com/en/2.2/topics/http/views/
>>>>>
>>>>> Likely would add a class with properties and methods or a definition
>>>>> (a function) like below:
>>>>>
>>>>> For example in your apps views.py file:
>>>>>
>>>>> def connect_to_dropbox():
>>>>> dbx = dropbox.Dropbox(‘your access token)
>>>>> dbx.users_get_current_account()
>>>>>
>>>>> # this stuff likely would go in a separate function
>>>>> for entry in dbx.files_list_folder(‘’).entries:
>>>>> print(entry.name)
>>>>>
>>>>>
>>>>> At some point in your code you would call the function:
>>>>> connect_to_dropbox()
>>>>>
>>>>> On Wed, Jun 12, 2019 at 3:10 PM omar ahmed  wrote:
>>>>>
>>>>>> i opened the documentation for django-storages ... and i installed
>>>>>> Dropbox in my environment and i created my app folder  but i didn't
>>>>>> complete docs .
>>>>>> somethings not clear ... like :
>>>>>> Link an account
>>>>>>
>>>>>> dbx = dropbox.Dropbox('YOUR_ACCESS_TOKEN')
>>>>>>
>>>>>> dbx.users_get_current_account()
>>>>>> Try some API requests
>>>>>>
>>>>>> for entry in dbx.files_list_folder('').entries:
>>>>>> print(entry.name)
>>>>>>
>>>>>> where should i write these commands ?
>>>>>> thanks
>>>>>>
>>>>>> On Wednesday, June 12, 2019 at 1:13:11 AM UTC+2, James Farris wrote:
>>>>>>>
>>>>>>> You might try the docs from Dropbox
>>>>>>> https://www.dropbox.com/developers/documentation/python#overview
>>>>>>>
>>>>>>> You can checkout this project for ideas
>>>>>>> https://github.com/singingwolfboy/django-with-dropbox
>>>>>>>
>>>>>>> and here is documentation for django-storages
>>>>>>>
>>>>>>> https://django-storages.

Re: my file uploads missing/deleted

2019-06-13 Thread James Farris
That means it wasn’t installed or it wasn’t added to your settings.py file in 
the installed apps section 

Sent from my mobile device

> On Jun 13, 2019, at 7:07 AM, omar ahmed  wrote:
> 
> i followed the steps
> when i typed 
> python manage.py test [--settings=test_settings]
> i found this error 
> ModuleNotFoundError: No module named '[--settings=test_settings]'
> and when i tried to open my site (club page that has image) i foun this error
> No module named 'StringIO'
> i searched at Google but no similar issues
> 
>> On Thursday, June 13, 2019 at 1:03:10 AM UTC+2, James Farris wrote:
>> This python package may be a better choice for you, since I assume you want 
>> all user generated content (images) to be stored in Dropbox. 
>> 
>> This has pretty good documentation. 
>> https://pypi.org/project/django-dropbox-storage/
>> 
>> If you use this package, remove the sample code I sent
>> 
>> 
>>> On Wed, Jun 12, 2019 at 3:53 PM omar ahmed  wrote:
>>> i added this function at the end of views.py file 
>>> def connect_to_dropbox():
>>> dbx = dropbox.Dropbox(‘your access token)
>>> dbx.users_get_current_account()
>>> and i put given access token from dropbox
>>> then what about call
>>> do you mean in any view function that will show page included images add  
>>> connect_to_dropbox()
>>> and what about 
>>> for entry in dbx.files_list_folder('').entries:
>>> print(entry.name)
>>> 
>>> 
>>> 
>>>> On Thursday, June 13, 2019 at 12:38:11 AM UTC+2, James Farris wrote:
>>>> You would add this code to the views.py file, which is where the business 
>>>> logic goes. 
>>>> 
>>>> https://docs.djangoproject.com/en/2.2/topics/http/views/
>>>> 
>>>> Likely would add a class with properties and methods or a definition (a 
>>>> function) like below:
>>>> 
>>>> For example in your apps views.py file:
>>>> 
>>>> def connect_to_dropbox():
>>>> dbx = dropbox.Dropbox(‘your access token)
>>>> dbx.users_get_current_account()
>>>> 
>>>> # this stuff likely would go in a separate function
>>>> for entry in dbx.files_list_folder(‘’).entries:
>>>> print(entry.name)
>>>> 
>>>> 
>>>> At some point in your code you would call the function:
>>>> connect_to_dropbox()
>>>> 
>>>>> On Wed, Jun 12, 2019 at 3:10 PM omar ahmed  wrote:
>>>>> i opened the documentation for django-storages ... and i installed 
>>>>> Dropbox in my environment and i created my app folder  but i didn't 
>>>>> complete docs .
>>>>> somethings not clear ... like :
>>>>> Link an account 
>>>>> dbx = dropbox.Dropbox('YOUR_ACCESS_TOKEN')
>>>>> dbx.users_get_current_account()
>>>>> Try some API requests
>>>>> 
>>>>> for entry in dbx.files_list_folder('').entries:
>>>>> print(entry.name)
>>>>> where should i write these commands ?
>>>>> thanks
>>>>> 
>>>>> 
>>>>>> On Wednesday, June 12, 2019 at 1:13:11 AM UTC+2, James Farris wrote:
>>>>>> You might try the docs from Dropbox
>>>>>> https://www.dropbox.com/developers/documentation/python#overview
>>>>>> 
>>>>>> You can checkout this project for ideas
>>>>>> https://github.com/singingwolfboy/django-with-dropbox
>>>>>> 
>>>>>> and here is documentation for django-storages
>>>>>> https://django-storages.readthedocs.io/en/latest/backends/dropbox.html
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Tue, Jun 11, 2019 at 2:17 PM omar ahmed  wrote:
>>>>>>> yes James you are right i need to upload images using the Django 
>>>>>>> admin, ... how can i use Dropbox for this issue ? 
>>>>>>> i need a good tutorial
>>>>>>> 
>>>>>>>> On Tuesday, June 11, 2019 at 6:14:10 PM UTC+2, James Farris wrote:
>>>>>>>> He is saying these aren’t static files. It sounds like he uploads them 
>>>>>>>> using the Django admin, which of course is like an end user on a 
>>>>>>>> client uploading files to the media directory. 
>&g

Re: my file uploads missing/deleted

2019-06-12 Thread James Farris
This python package may be a better choice for you, since I assume you want
all user generated content (images) to be stored in Dropbox.

This has pretty good documentation.
https://pypi.org/project/django-dropbox-storage/

If you use this package, remove the sample code I sent


On Wed, Jun 12, 2019 at 3:53 PM omar ahmed  wrote:

> i added this function at the end of views.py file
> def connect_to_dropbox():
> dbx = dropbox.Dropbox(‘your access token)
> dbx.users_get_current_account()
> and i put given access token from dropbox
> then what about call
> do you mean in any view function that will show page included images add
> connect_to_dropbox()
> and what about
>
> for entry in dbx.files_list_folder('').entries:
> print(entry.name)
>
>
>
> On Thursday, June 13, 2019 at 12:38:11 AM UTC+2, James Farris wrote:
>>
>> You would add this code to the views.py file, which is where the business
>> logic goes.
>>
>> https://docs.djangoproject.com/en/2.2/topics/http/views/
>>
>> Likely would add a class with properties and methods or a definition (a
>> function) like below:
>>
>> For example in your apps views.py file:
>>
>> def connect_to_dropbox():
>> dbx = dropbox.Dropbox(‘your access token)
>> dbx.users_get_current_account()
>>
>> # this stuff likely would go in a separate function
>> for entry in dbx.files_list_folder(‘’).entries:
>> print(entry.name)
>>
>>
>> At some point in your code you would call the function:
>> connect_to_dropbox()
>>
>> On Wed, Jun 12, 2019 at 3:10 PM omar ahmed  wrote:
>>
>>> i opened the documentation for django-storages ... and i installed
>>> Dropbox in my environment and i created my app folder  but i didn't
>>> complete docs .
>>> somethings not clear ... like :
>>> Link an account
>>>
>>> dbx = dropbox.Dropbox('YOUR_ACCESS_TOKEN')
>>>
>>> dbx.users_get_current_account()
>>> Try some API requests
>>>
>>> for entry in dbx.files_list_folder('').entries:
>>> print(entry.name)
>>>
>>> where should i write these commands ?
>>> thanks
>>>
>>> On Wednesday, June 12, 2019 at 1:13:11 AM UTC+2, James Farris wrote:
>>>>
>>>> You might try the docs from Dropbox
>>>> https://www.dropbox.com/developers/documentation/python#overview
>>>>
>>>> You can checkout this project for ideas
>>>> https://github.com/singingwolfboy/django-with-dropbox
>>>>
>>>> and here is documentation for django-storages
>>>> https://django-storages.readthedocs.io/en/latest/backends/dropbox.html
>>>>
>>>>
>>>>
>>>> On Tue, Jun 11, 2019 at 2:17 PM omar ahmed  wrote:
>>>>
>>>>> yes James you are right i need to upload images using the Django
>>>>> admin, ... how can i use Dropbox for this issue ?
>>>>> i need a good tutorial
>>>>>
>>>>> On Tuesday, June 11, 2019 at 6:14:10 PM UTC+2, James Farris wrote:
>>>>>>
>>>>>> He is saying these aren’t static files. It sounds like he uploads
>>>>>> them using the Django admin, which of course is like an end user on a
>>>>>> client uploading files to the media directory.
>>>>>>
>>>>>> Since that is the case it sounds like the Dropbox option is the best.
>>>>>> Documentation was provided earlier. So being that it seems like he read
>>>>>> through the documentation, my question is where is he stuck in the 
>>>>>> Dropbox
>>>>>> implementation?
>>>>>
>>>>> --
>>>>> 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/8O8BS7DhF30/unsubscribe
>>>>> .
>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>> django...@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/3d50f417-cceb-4141-9b6d-9d2f5d0feee4%40googlegroups.com
>>>>> &

Re: my file uploads missing/deleted

2019-06-12 Thread James Farris
You would add this code to the views.py file, which is where the business
logic goes.

https://docs.djangoproject.com/en/2.2/topics/http/views/

Likely would add a class with properties and methods or a definition (a
function) like below:

For example in your apps views.py file:

def connect_to_dropbox():
dbx = dropbox.Dropbox(‘your access token)
dbx.users_get_current_account()

# this stuff likely would go in a separate function
for entry in dbx.files_list_folder(‘’).entries:
print(entry.name)


At some point in your code you would call the function:
connect_to_dropbox()

On Wed, Jun 12, 2019 at 3:10 PM omar ahmed  wrote:

> i opened the documentation for django-storages ... and i installed Dropbox
> in my environment and i created my app folder  but i didn't complete docs .
> somethings not clear ... like :
> Link an account
>
> dbx = dropbox.Dropbox('YOUR_ACCESS_TOKEN')
>
> dbx.users_get_current_account()
> Try some API requests
>
> for entry in dbx.files_list_folder('').entries:
> print(entry.name)
>
> where should i write these commands ?
> thanks
>
> On Wednesday, June 12, 2019 at 1:13:11 AM UTC+2, James Farris wrote:
>>
>> You might try the docs from Dropbox
>> https://www.dropbox.com/developers/documentation/python#overview
>>
>> You can checkout this project for ideas
>> https://github.com/singingwolfboy/django-with-dropbox
>>
>> and here is documentation for django-storages
>> https://django-storages.readthedocs.io/en/latest/backends/dropbox.html
>>
>>
>>
>> On Tue, Jun 11, 2019 at 2:17 PM omar ahmed  wrote:
>>
>>> yes James you are right i need to upload images using the Django
>>> admin, ... how can i use Dropbox for this issue ?
>>> i need a good tutorial
>>>
>>> On Tuesday, June 11, 2019 at 6:14:10 PM UTC+2, James Farris wrote:
>>>>
>>>> He is saying these aren’t static files. It sounds like he uploads them
>>>> using the Django admin, which of course is like an end user on a client
>>>> uploading files to the media directory.
>>>>
>>>> Since that is the case it sounds like the Dropbox option is the best.
>>>> Documentation was provided earlier. So being that it seems like he read
>>>> through the documentation, my question is where is he stuck in the Dropbox
>>>> implementation?
>>>
>>> --
>>> 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/8O8BS7DhF30/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> django...@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/3d50f417-cceb-4141-9b6d-9d2f5d0feee4%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/3d50f417-cceb-4141-9b6d-9d2f5d0feee4%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> 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/8O8BS7DhF30/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/e8763fdb-d559-4d5b-9274-a59c7c0e9198%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e8763fdb-d559-4d5b-9274-a59c7c0e9198%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
*James Farris*
Web Application Developer | Web and Digital Solutions
External Relations & Advancement Marketing Communications
University Development and Alumni Relations | UC Berkeley
510-664-4512 | jfar...@berkeley.edu

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


Re: my file uploads missing/deleted

2019-06-11 Thread James Farris
You might try the docs from Dropbox
https://www.dropbox.com/developers/documentation/python#overview

You can checkout this project for ideas
https://github.com/singingwolfboy/django-with-dropbox

and here is documentation for django-storages
https://django-storages.readthedocs.io/en/latest/backends/dropbox.html



On Tue, Jun 11, 2019 at 2:17 PM omar ahmed  wrote:

> yes James you are right i need to upload images using the Django
> admin, ... how can i use Dropbox for this issue ?
> i need a good tutorial
>
> On Tuesday, June 11, 2019 at 6:14:10 PM UTC+2, James Farris wrote:
>>
>> He is saying these aren’t static files. It sounds like he uploads them
>> using the Django admin, which of course is like an end user on a client
>> uploading files to the media directory.
>>
>> Since that is the case it sounds like the Dropbox option is the best.
>> Documentation was provided earlier. So being that it seems like he read
>> through the documentation, my question is where is he stuck in the Dropbox
>> implementation?
>
> --
> 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/8O8BS7DhF30/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/3d50f417-cceb-4141-9b6d-9d2f5d0feee4%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/3d50f417-cceb-4141-9b6d-9d2f5d0feee4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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/CAMdMWAWR1zurFJbU-yPnojEJ_iLLLgXbE1VvthRQNHxzgS21Ow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Unknown column 'boericke_joints.id' in 'field list

2019-06-11 Thread James Farris
If the database was originally created by Django, it would have been built with 
an ID field. Django is confused because it can’t find that field in the 
database. If you added ID to the model, did you run python manage.py 
makemigrations and then python manage.py migrate

-- 
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/cf82c1b4-3b7a-4d7c-87a3-9b182c92b59a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: my file uploads missing/deleted

2019-06-11 Thread James Farris
He is saying these aren’t static files. It sounds like he uploads them using 
the Django admin, which of course is like an end user on a client uploading 
files to the media directory. 

Since that is the case it sounds like the Dropbox option is the best. 
Documentation was provided earlier. So being that it seems like he read through 
the documentation, my question is where is he stuck in the Dropbox 
implementation?

-- 
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/c19daa24-8b3c-43de-816f-b1c37f85450e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Module lock error when starting development server

2019-06-11 Thread James Farris
Do you have a venv running in another venv? 

You could try installing and running gdb 
https://wiki.python.org/moin/DebuggingWithGdb

It may give you more insight. But Deadlocking is essentially one python process 
clobbering another causing the app to lock up. 

-- 
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/dfd8b345-c713-4944-8ca9-721479f4a814%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: mysqlclient installation error

2019-06-11 Thread James Farris
I have Django 2.2.x running with mysqlclient successfully

mysql-connector-python==8.0.15
mysqlclient==1.3.13

-- 
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/7acd7a9f-a524-442e-892a-c72184cb96bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing request from form

2019-05-31 Thread James Schneider
>
> Don't beat yourself up :)
>

It's actually slightly cathartic and humbling to do that every once in a
great while. ;-)


> No-one stops looking and just waits for the answer. You have to assume
> your own motivation to find it is stronger than everyone else's. It is just
> good manners to report back so others can stop looking. And it would be bad
> manners to say you fixed it without revealing the fix.
>

Yeah, that's a pet peeve of mine so I made sure to include the answer.


> Actually, no-one else even looks unless they are particularly interested
> or they encountered the same problem within recent memory.
>

Can't say I'm not guilty of doing that as well. I'm a college lecturer in
one of my many positions, so I do like the academic challenge that some of
these questions pose, even if I haven't needed it myself. However, on more
than one occasion I have run into one of the landmines that I've helped out
on in the past, and it's saved me a fair amount of time.


> Except you. You have helped me more than once in the past and I appreciate
> it. Thank you. Ten extra points!
>

Haha, thanks. I'll take the points. I wish I had the time to be more active
on this list, but the wife says I have to pay attention to her and the
kids, and I'm only allowed to have 2 jobs and 1 hobby. Luckily my current
hobby overlaps with Django so here I am.

-James

>

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


Re: Accessing request from form

2019-05-30 Thread James Schneider
I always dread being the guy that responds to his own thread with "Hey
guys, I fixed it."

At any rate, I'm currently stuck having to create relatively empty
> ModelForm shell classes for the simple reason of including a form mixin
> that grabs the request before __init__() (because the ModelForm complains
> if I don't), and overrides save() to save the fields with the user object,
> in addition to specifying the form_class in the CBV along with a view mixin
> for sending the request over via get_form_kwargs(). It's quite a process,
> especially when dealing with multiple models. I could drop a significant
> amount of code if I could flag the CBV to include the request with the form
> initialization. Heck, there could even be some magic to have the form
> associate the user with specific fields on save from the view as
> form_kwargs.
>
> Or am I making things hard on myself? Thanks.
>

For the use case above, I had an epiphany did some more experimenting and
figured out how to update the audit fields without needing to mangle a
Form/ModelForm, entirely from the CBV:

 def form_valid(self, form):
form.instance.updated_by = self.request.user
return super().form_valid(form)

Fully compatible with an implicit ModelForm, and only 3 lines of code!

This is an easy drop in a view mixin, which I already have for other
overrides anyway. However, this feels really gross, and I feel like I'm
violating some prime directive by attaching data to an instance that was
not validated by the form. I think I can forgive myself since the data I'm
attaching is coming from Django and not some other source, and I have to
assume Django handles these things properly.

Of course while writing this message, I then stumbled on this exact
solution buried in the Django docs:

https://docs.djangoproject.com/en/dev/topics/class-based-views/generic-editing/#models-and-request-user

So, feel free to ignore me. I will grant myself a point for coming up with
the same solution already blessed by the Django devs. I'm also deducting a
point from myself for not RTFM properly, so I break even.

-James

-- 
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%2Be%2BciVKk6V6gpwF5FW8%3D-1ib%3D-xj6UX4-cceL3Fco12BpkfUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Accessing request from form

2019-05-30 Thread James Schneider
Does anyone know a philosophical reason (or I suppose a technical one,
although I don't think that's the case) why the request is not made
available by default in ModelForms when using CBV's?

Almost all of the models I use have "audit" fields (created_by, updated_by,
etc.) that reference the current logged in user. A ModelForm has no access
to the current request, and as such can't update these fields without a
User object. I have other use cases as well, but this one is probably the
most prevalent among other developers.

At any rate, I'm currently stuck having to create relatively empty
ModelForm shell classes for the simple reason of including a form mixin
that grabs the request before __init__() (because the ModelForm complains
if I don't), and overrides save() to save the fields with the user object,
in addition to specifying the form_class in the CBV along with a view mixin
for sending the request over via get_form_kwargs(). It's quite a process,
especially when dealing with multiple models. I could drop a significant
amount of code if I could flag the CBV to include the request with the form
initialization. Heck, there could even be some magic to have the form
associate the user with specific fields on save from the view as
form_kwargs.

Or am I making things hard on myself? Thanks.

-James

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


Re: set python 3.6.8 default in my ubuntu

2019-05-22 Thread James Schneider
No
On Wed, May 22, 2019, 10:22 AM johnpaul mulongo 
wrote:

>
>
> On Wednesday, May 22, 2019 at 3:48:16 PM UTC+3, omar ahmed wrote:
>>
>> hello ..
>> just finished my first project with django but i can not publish it
>> because my default python is python 2.7.12 and Heroku now does not support
>> it ..
>> now i installed python 3.6.8  how can i set it as default python
>> version to make my projects with virtualenv ?
>> thanks in advance
>>
>
> You could also try to check out pyenv .
> It's a pretty handy when dealing with python versions.
>
> --
> 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/7d9828d2-eaae-4f78-a551-b612edd89080%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%2Be%2BciU0N0zO2EHeB5z-tmB5fxKt%3DxWsvTGd%3DoEoRSqz%3DdMNQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Troubling installing Python 3 on my iMac

2019-04-30 Thread James
Thanks Suresh!  This did the trick.

On Tuesday, April 30, 2019 at 7:36:30 AM UTC-6, Suresh Kannan wrote:
>
> Hi,
>
> Try these steps
>
> https://wsvincent.com/install-python3-mac/
>
> https://stackoverflow.com/a/20868669/4037275 
>
> On Tue, Apr 30, 2019 at 8:39 AM James > 
> wrote:
>
>> I downloaded the file from the python website and went through the entire 
>> installation process... accepting all of the default values.  However, when 
>> I went to my Terminal window and typed python, it still shows the older 
>> version:
>>
>> Python 2.7.10 (default, Feb 22 2019, 21:17:52) 
>>
>> [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
>>
>> What did I do wrong?  I need to get this all setup before I can start the 
>> Django tutorial.
>>
>> 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...@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/d4a9335d-5067-4620-882e-e10a6d04dbcd%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/d4a9335d-5067-4620-882e-e10a6d04dbcd%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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/5e0cd72d-a09d-4597-81d8-036a7c3a952c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Troubling installing Python 3 on my iMac

2019-04-30 Thread James
I downloaded the file from the python website and went through the entire 
installation process... accepting all of the default values.  However, when 
I went to my Terminal window and typed python, it still shows the older 
version:

Python 2.7.10 (default, Feb 22 2019, 21:17:52) 

[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin

What did I do wrong?  I need to get this all setup before I can start the 
Django tutorial.

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/d4a9335d-5067-4620-882e-e10a6d04dbcd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Lazy ForeignKey references break in upgrade from 1.9 to 1.10

2019-03-11 Thread James
Hey everyone,

While upgrading from 1.9 to 1.10, I got errors that lazy ForeignKey 
references cannot be resolved similar to the following (full stack trace is 
included below):

ValueError: Related model 'appname.ModelName' cannot be resolved

This occurs with anything from simple models to abstract models, 
referencing other models within the same app, other apps, and recursive 
relationships ('self').

In searching, I've found similar issues relating to migrations, however 
this happens when I call manage.py "runserver" or "shell". I haven't run or 
defined any migrations in 1.10 yet.



Full stack trace (using Django 1.10; directories and the app name have been 
obfuscated from the original)
Note: This error references a model using an abstract model, but as stated 
above this is just one instance where it doesn't work. If I were to 
temporarily comment out the field, it would just error out with the next 
one.

user@host:/pwd$ python manage.py shell
Traceback (most recent call last):
  File "./manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/
__init__.py", line 367, in execute_from_command_line
utility.execute()
  File "/usr/local/lib/python2.7/site-packages/django/core/management/
__init__.py", line 341, in execute
django.setup()
  File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 
27, in setup
apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", 
line 108, in populate
app_config.import_models(all_models)
  File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 
199, in import_models
self.models_module = import_module(models_module_name)
  File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in 
import_module
__import__(name)
  File "/pwd/app/models.py", line 482, in 
class Employee(EmployeeDatedFieldsAbstractModel, AbstractBaseUser, 
PermissionsMixin):
  File "/usr/local/lib/python2.7/site-packages/django/db/models/base.py", 
line 309, in __new__
new_class._prepare()
  File "/usr/local/lib/python2.7/site-packages/django/db/models/base.py", 
line 349, in _prepare
if not opts.managers or cls._requires_legacy_default_manager():
  File "/usr/local/lib/python2.7/site-packages/django/utils/functional.py", 
line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/options.py", 
line 374, in managers
manager = copy.copy(manager)
  File "/usr/local/lib/python2.7/copy.py", line 88, in copy
rv = reductor(2)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", 
line 208, in __getstate__
self._fetch_all()
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", 
line 1085, in _fetch_all
self._result_cache = list(self.iterator())
  File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", 
line 54, in __iter__
results = compiler.execute_sql()
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler
.py", line 824, in execute_sql
sql, params = self.as_sql()
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler
.py", line 369, in as_sql
extra_select, order_by, group_by = self.pre_sql_setup()
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler
.py", line 46, in pre_sql_setup
self.setup_query()
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler
.py", line 37, in setup_query
self.select, self.klass_info, self.annotation_col_map = 
self.get_select()
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler
.py", line 194, in get_select
for c in self.get_default_columns():
  File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler
.py", line 516, in get_default_columns
column = field.get_col(alias)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/fields/
related.py", line 954, in get_col
return super(ForeignKey, self).get_col(alias, output_field or 
self.target_field)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/fields/
related.py", line 855, in target_field
return self.foreign_related_fields[0]
  File "/usr/local/lib/python2.7/site-packages/django/db/models/fields/
related.py", line 595, in foreign_related_fields
return tuple(rhs_field for lhs_field, rhs_field in self.related_fields 
if rhs_field)
  File "/usr/local/lib/python2.7/site-packages/django/db/models/fields/
related.py", line 582, in related_fields
self._related_fields = self.resolve_related_fields()
  File "/usr/local/lib/python2.7/site-packages/django/db/models/fields/
related.py", line 567, in resolve_related_fields
raise ValueError('Related model %r cannot be resolved' % 
self.remote_field.model)
ValueError: Related model 'app.Department' cannot be resolved


-- 

Re: How to remove a model definition completely in Django when it previously had foreign keys

2019-03-08 Thread James Bennett
When you need to remove any piece of code that's been referenced in
migrations, generally there's a multi-step process.

For sake of a simple example, let's assume you have Model A in App A, and
Model B in App B. And at some point you added a foreign key from Model A to
Model B, but now you want to completely remove Model B. The process is:

1. Remove the foreign key from Model A and generate a migration for that.
Apply the migration. DO NOT DELETE MODEL B'S CODE YET.
2. Generate a migration with a RemoveModel operation for Model B. DO NOT
DELETE MODEL B'S CODE YET.
3. Squash migrations for App A, starting at the point the foreign key to
Model B was added, and ending at the point the foreign key to Model B was
removed. DO NOT DELETE MODEL B'S CODE YET.
4. Now that only a single migration file references Model B, either remove
the AddField/RemoveField operations from it entirely, or replace them with
migrations.RunPython.noop operations. DO NOT DELETE MODEL B'S CODE YET.
5. Verify that you can bring up a fresh database correctly with the
migrations you now have. DO NOT DELETE MODEL B'S CODE YET.
6. Finally: delete Model B's code from your codebase.

if you referred to this model from multiple apps/models, you will need to
do steps 1-5 once for each app/model that had a reference.

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


Re: AuthenticationForm 'data' keyword argument?

2019-02-14 Thread james . peter . schinner
So I should be using:

form = AuthenticatioForm(request)

It seems odd that the signature for various form aren't the same, at least 
in respect to *args. **kwags I can understand being different. Regardless I 
wanted to highlight a gotcha that wasn't immediately obvious. 

Also, I received no error from using:

form = AuthenticatioForm(request.POST)

If it's wrong shouldn't django let me know?


On Friday, February 15, 2019 at 1:49:55 AM UTC+11, Tim Graham wrote:
>
> From the docs for AuthenticationForm: "Takes request as its first 
> positional argument, which is stored on the form instance for use by 
> sub-classes."
>
>
> https://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.forms.AuthenticationForm
>
> On Thursday, February 14, 2019 at 7:47:23 AM UTC-5, 
> james.pete...@gmail.com wrote:
>>
>> Hi,
>>
>> I have just been following the Django documention on forms:
>>
>> https://docs.djangoproject.com/en/2.1/topics/forms/
>>
>> And I was having an issue with validating the posted data in the view 
>> code. 
>>
>> I came across this Stack Overflow post :
>>
>>
>> https://stackoverflow.com/questions/45824046/djangos-authentication-form-is-always-not-valid
>>
>> Where the solution to my problem was to use the data Keyword argument 
>> when creating a form from the POST'd data. Looking back on the docs I 
>> noticed that this wasn't specified. 
>>
>> So my view function now looks like this:
>>
>> def login(request):
>> if request.method == 'POST':
>> form = LoginForm(data=request.POST)  #<- This is where I had to use 
>> the data kwarg
>> if form.is_valid():
>> return HttpResponseRedirect('#')
>> return render(request, 'scoreboard/login.html', {'form': form})
>> else:
>> return render(request, 'scoreboard/login.html', {'form': 
>> LoginForm()})
>>
>>
>>
>>
>> [image: data kwarg.png]
>>
>>
>>

-- 
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/8bc872d2-8e23-4b8f-b4cc-d21479898e87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


AuthenticationForm 'data' keyword argument?

2019-02-14 Thread james . peter . schinner
Hi,

I have just been following the Django documention on forms:

https://docs.djangoproject.com/en/2.1/topics/forms/

And I was having an issue with validating the posted data in the view code. 

I came across this Stack Overflow post :

https://stackoverflow.com/questions/45824046/djangos-authentication-form-is-always-not-valid

Where the solution to my problem was to use the data Keyword argument when 
creating a form from the POST'd data. Looking back on the docs I noticed 
that this wasn't specified. 

So my view function now looks like this:

def login(request):
if request.method == 'POST':
form = LoginForm(data=request.POST)  #<- This is where I had to use the 
data kwarg
if form.is_valid():
return HttpResponseRedirect('#')
return render(request, 'scoreboard/login.html', {'form': form})
else:
return render(request, 'scoreboard/login.html', {'form': LoginForm()})




[image: data kwarg.png]


-- 
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/701d94cb-1e3d-4b3f-8497-7ec9df351a57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Password Policy Adherence. Cannot use the passwords used before

2019-02-08 Thread James Bennett
I'm going to suggest you step back and consider whether the policies you
want to implement are good policies. A good, solidly-researched set of
recommendations is NIST SP800-63B:

https://pages.nist.gov/800-63-3/sp800-63b.html

In particular, NIST suggests the following:

* Do not use a policy which automatically "expires" passwords and forces
users to change them periodically. Only force a password change when you
have evidence that a password has been compromised.
* Do not try to impose artificial "complexity" rules (like requiring a mix
of uppercase/lowercase, numbers and symbols).
* When a user changes their password, compare it against lists of
known-compromised passwords.

Forcing users to change their passwords on a set schedule just encourages
them to choose weak passwords that are easy to remember. If you force me to
change my password every three months, for example, here's what I'll do:

* P@ssword!2019_1
* P@ssword!2019_2
* P@ssword!2019_3
* P@ssword!2019_4

These passwords are all different from each other, and they each contain at
least one uppercase and one lowercase letter, at least one number and at
least one symbol. They're also terrible passwords that would probably get
cracked within minutes, if not seconds, by any good automated cracker.
That's a year's worth of passwords, each of which is different from the
last, each contains one

-- 
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/CAL13Cg9Xi7QdCCffqROi_FjLzKimtWYBR%3DusMxf6ihf_E6%3D-9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Poor Performance for Form Rendering In Django 1.11

2018-12-10 Thread James Bennett
On Mon, Dec 10, 2018 at 6:29 AM John Lehmann  wrote:

> So my takeaway from what you are saying is that no one is running a
> production site with a Django select field to render a country or currency
> option (e.g., django-countries or django-money), because either of these
> would have well over a hundred entries (and my form happens to have both).
> Instead they would be loading these options via AJAX or using a different
> widget all together like an auto-complete.  (I get it that a long list is
> not the best UX but that's a bit of a different discussion).
>

Have you profiled a country select on its own?

Your original post suggested you had multiple large (hundreds of options)
selects in a single form that you were rendering. Whether any specific
individual select in the form is the sole culprit, or whether it's the
combination of them, is something you still haven't pinned down, and it's a
bit combative to jump to "nobody must have a country select" from that.

In general, a select with a large set of options is going to be slower to
render. It may turn out that this has nothing whatsoever to do with your
problem, but we don't have enough information to precisely diagnose your
problem; all we can do here is give you general advice like "avoid
rendering a template hundreds of times if you can, or use a
faster-rendering template option if you can't".

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


Re: Poor Performance for Form Rendering In Django 1.11

2018-12-10 Thread James Bennett
On Mon, Dec 10, 2018 at 5:31 AM John Lehmann  wrote:

> I am still hoping however for someone to explain to me why the default
> renderer cannot handle my use case, such as that a few hundred inputs is
> too many, or that I am doing something else improperly.  Surely this kind
> of a change would not be made to the framework that would cause such an
> unacceptable performance (500+ms added). Kind of disappointing to spend a
> whole week upgrading only to end up wanting to downgrade again.
>

The Django template language is not really optimized for speed of
rendering. Even with a caching loader, rendering a template hundreds of
times will be an expensive enough operation to show up in your profiling.

The solutions are to use something faster (Jinja) if you absolutely must be
rendering hundreds of things, or find a way to make the form more efficient
(generally, when a form has hundreds of options to display in a select,
that's a sign of issues with the design of the form).

-- 
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/CAL13Cg9amLPan9-pj%2BHpHc7vns6_5EJcvNHvF0VPakf651%3DT1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: Easiest front end JavaScript framework to integrate with a Djangobackend?

2018-11-27 Thread Sir Robert James Patterson
What Alfred said . . . . .and than some 😉

https://django-angular.readthedocs.io/en/latest/ 



Sent from Mail for Windows 10

From: Alfredo Sumague
Sent: Tuesday, November 27, 2018 8:13 PM
To: django-users@googlegroups.com
Subject: Re: Easiest front end JavaScript framework to integrate with a 
Djangobackend?

you can use AngularJS framework with Django.

goodluck,
Alfred

On Tue, Nov 27, 2018 at 12:21 PM Simon Connah  wrote:
I'm in the process of building a website in Django and need to make a 
specific part of my application dynamic. Because of that I'd like to use 
a JavaScript frontend framework to build this portion of the site.

I was wondering if anyone had any recommendations for which JavaScript 
framework I should use that integrates well with a Django backend?

If anyone is curious I am working on an auction style website.

Thank you for any help.

-- 
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/ee666748-f8c9-37c9-5c12-491ef61ab70d%40gmail.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/CAGF6mrTW8GFXLeM4XaA%2BS7DBv5vjOoDXL%3DvjOSaZmoEBYgUuHw%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/5bfdf35d.1c69fb81.fb1cc.28a6%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


editing website menus

2018-10-11 Thread James Otombolo
I run this script which i want to customize.I have installed it already on 
my server,edited top menus on settings.py,saved,refreshed but nothing.can 
you help me on how to go about it?
http://rdsnewyork .com/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/2836c288-5fae-4c6c-ae3f-0152700fb5a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Code distribution to customers.

2018-10-09 Thread James Bennett
Have them sign licensing agreements that force them to pay you lots and
lots of money if they copy your code.

Seriously, this is the kind of problem you solve with lawyers, not with
code.

On Tue, Oct 9, 2018 at 10:10 PM vineeth sagar 
wrote:

> We deploy our web applications on the infrastructure provided by the
> customer, how do you keep the code non-accessible to others. WHAT are the
> strategies you use. It doesn't have to be fool proof just it should become
> very hard to look at the code. Any ideas?
>
> --
> 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/566c79a7-db61-4104-a1de-d74ba2e73ff0%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/CAL13Cg8MpppE8Gv0sf4nXU9eDz-0gGTdeDkBO91uyHvpPi77Cg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Postgres Intermediary doesn't set ON DELETE CASCADE

2018-06-23 Thread James Bellaby
Indeed! I have actually used the admin site to do it before I posted this 
it's just something I didn't know was by design. After numerous searches I 
came here but I may have been asking the wrong questions in google :). 

The shell would be good if I have quite a few I need to delete. Thankfully 
I had only one entry.

Thanks for help, Jason.

On Saturday, 23 June 2018 14:46:44 UTC+1, Jason wrote:
>
> well, nothing stopping you from doing the same in the django shell and 
> doing `Group.objects.get(pk = some_pk).delete`.  that would be an 
> alternative for going straight to the db.
>
> I can see some issues with this coming up, especially if you're doing 
> deletes with django's raw sql capability.  But that should never happen, 
> you should do a select then iterate and delete.
>
> On Saturday, June 23, 2018 at 9:28:15 AM UTC-4, James Bellaby wrote:
>>
>> OK. So it's by design.
>>
>> So during development I can't go straight to the database and delete a 
>> "Group" quickly due to an error I made. I'd have to set up tests to deal 
>> with it at an application level.
>>
>> No probs though. I'm just happy I know it can't be done and not that it's 
>> a bug I'd have to wait for.
>>
>> Thanks for the answers :)
>>
>> On Saturday, 23 June 2018 14:16:33 UTC+1, Melvyn Sopacua wrote:
>>>
>>> On zaterdag 23 juni 2018 14:40:30 CEST Jason wrote: 
>>> > Not quite.  If you run python manage.py sqlmigrate  
>>> > , you can see the SQL generated for that migration. 
>>> > 
>>> > 
>>> https://docs.djangoproject.com/en/2.0/ref/django-admin/#django-admin-sqlmigr
>>>  
>>> > ate 
>>> > 
>>> > Because Django emulates Cascade, its done outside of the db, and 
>>> therefore 
>>> > shouldn't be a db-level constraint. 
>>>
>>> The case for and against can be made pretty much with the same argument: 
>>> - for: if a row is deleted outside of Django, so by direct database 
>>> manipulation, then the relations become inconsistent, so having database 
>>> reflect models prevents this. 
>>> - against: if a row is deleted outside of Django, so by direct database 
>>> manipulation, then signals are not processed and objects are deleted 
>>> regardless. The consequences of this are unpredictable and application 
>>> specific. 
>>>
>>> Django chose to not align model relations with database representation. 
>>> Knowing this means you have to handle things through Django exclusively 
>>> where 
>>> it matters. 
>>>
>>> -- 
>>> Melvyn Sopacua 
>>>
>>

-- 
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/00e2d392-99d5-43a6-b6f7-65f348b2185c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Postgres Intermediary doesn't set ON DELETE CASCADE

2018-06-23 Thread James Bellaby
OK. So it's by design.

So during development I can't go straight to the database and delete a 
"Group" quickly due to an error I made. I'd have to set up tests to deal 
with it at an application level.

No probs though. I'm just happy I know it can't be done and not that it's a 
bug I'd have to wait for.

Thanks for the answers :)

On Saturday, 23 June 2018 14:16:33 UTC+1, Melvyn Sopacua wrote:
>
> On zaterdag 23 juni 2018 14:40:30 CEST Jason wrote: 
> > Not quite.  If you run python manage.py sqlmigrate  
> > , you can see the SQL generated for that migration. 
> > 
> > 
> https://docs.djangoproject.com/en/2.0/ref/django-admin/#django-admin-sqlmigr 
> > ate 
> > 
> > Because Django emulates Cascade, its done outside of the db, and 
> therefore 
> > shouldn't be a db-level constraint. 
>
> The case for and against can be made pretty much with the same argument: 
> - for: if a row is deleted outside of Django, so by direct database 
> manipulation, then the relations become inconsistent, so having database 
> reflect models prevents this. 
> - against: if a row is deleted outside of Django, so by direct database 
> manipulation, then signals are not processed and objects are deleted 
> regardless. The consequences of this are unpredictable and application 
> specific. 
>
> Django chose to not align model relations with database representation. 
> Knowing this means you have to handle things through Django exclusively 
> where 
> it matters. 
>
> -- 
> Melvyn Sopacua 
>

-- 
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/3d0c543f-3be6-4c24-92a4-18f19182441d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Postgres Intermediary doesn't set ON DELETE CASCADE

2018-06-23 Thread James Bellaby
OK, understood. However, If you set up CASCADE on the model surely when it 
creates the table on the database level it surely should set ON DELETE 
CASCADE not ON DELETE NO ACTION on the CONSTRAINT?

On Saturday, 23 June 2018 10:54:44 UTC+1, Melvyn Sopacua wrote:
>
> On zaterdag 23 juni 2018 00:56:36 CEST James Bellaby wrote:
>
>  
>
> > However when looking are the SQL in Postgresql it's created the 
> Membership
>
> > table constraint for the Group id with "ON DELETE NO ACTION"
>
> > 
>
> > CONSTRAINT groups_membership_group_id_d4404a8c_fk_groups_group_id FOREIGN
>
> > KEY (group_id)
>
> > REFERENCES public.groups_group (id) MATCH SIMPLE
>
> > ON UPDATE NO ACTION
>
> > ON DELETE NO ACTION
>
> > DEFERRABLE INITIALLY DEFERRED,
>
> > 
>
> > My understanding was that setting CASCADE on the group in the Membership
>
> > modal would set ON DELETE CASCADE for the Membership table CREATE?
>
> > 
>
> > If it's not a bug and I've missed something, I apologies in advance.
>
>  
>
> You missed the part where Django implements this at the application level 
> by emulating this 
> <https://docs.djangoproject.com/en/2.0/ref/models/fields/#django.db.models.CASCADE>.
>  
> This is (among other things) to be able to run signals 
> <https://github.com/django/django/blob/master/django/db/models/deletion.py#L276>,
>  
> which it can't do if the database is doing the deletion.
>
>  
>
> -- 
>
> Melvyn Sopacua
>

-- 
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/eb0457ef-fda9-4bca-8a46-1e66455ccf2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Postgres Intermediary doesn't set ON DELETE CASCADE

2018-06-22 Thread James Bellaby
I'm having a little trouble with my "through" table. I've set the modal to 
have two Foreign Key fields. Ex. below:

class Person(models.Model):
title = models.CharField(max_length=255)


class Group(models.Model):
title = models.CharField(max_length=255)
members= models.ManyToManyField(Person, through='Membership', 
through_fields=('group', 'person'))


class Membership(models.Model):
group = models.ForeignKey(Group, on_delete=models.CASCADE)
person = models.ForeignKey(Person, on_delete=models.PROTECT)



I want it to keep the "Person" entries when deleted but if a group is 
deleted in needs to cascade.

However when looking are the SQL in Postgresql it's created the Membership 
table constraint for the Group id with "ON DELETE NO ACTION"

CONSTRAINT groups_membership_group_id_d4404a8c_fk_groups_group_id FOREIGN 
KEY (group_id)
REFERENCES public.groups_group (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
DEFERRABLE INITIALLY DEFERRED,

My understanding was that setting CASCADE on the group in the Membership 
modal would set ON DELETE CASCADE for the Membership table CREATE?

If it's not a bug and I've missed something, I apologies in advance.

Cheers,
James


-- 
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/d489db86-aeea-4272-9fc9-a1d5ffcd3736%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: This site can’t be reached 127.0.0.1 refused to connect.

2018-06-05 Thread James Farris
What’s the actual error?

Did you mean ALLOWED_HOSTS? If so you can just add:
ALLOWED_HOSTS=[‘*’]

On Tue, Jun 5, 2018 at 12:55 PM Jamie Roberts 
wrote:

> Hi,
>
> This is from memory and may not be your problem but ... I had to add
> 127.0.0.1 to ALLOWED_USERS in settings.py
>
> Sent from my iPhone
>
> On 5 Jun 2018, at 16:38, Avitab Ayan Sarmah  wrote:
>
> While going through the turolal 7 of the django project, couldn't connect
> to the url.Please comment why my local host refused to connect
>
> --
> 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/e948142e-163f-4a82-bc91-46c16c292c5d%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/93BADF4F-E86D-47B7-9034-1D61408850D6%40gmail.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/CAE-E-_0fGD-7a%3DY4w-%2BjvR%3DZ3Zj6QdyRmZgc9PDWjXuaW_gX2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: calculate the followers difference/grow by day

2018-06-05 Thread James Farris
I think you can do something like this

stats = Statistics.objects.all().order_by('-last_update')
latest_stat = 0
for stat in stats:
print(abs(latest_stat - stat.followers))
latest_stat = stat.followers

On Mon, Jun 4, 2018 at 11:24 AM, Daniel Germano Travieso <
danielgtravi...@gmail.com> wrote:

> Hello!
> I don't quite understand what you mean by the followers difference by day,
> but as that difference by day is not a property of each model tuple, but a
> property of a specific day, you can write a view to handle that processing.
> Custom model Managers are used to either add manager methods or to
> customize and change the QuerySet your model returns. If you wish to use
> the model manager for this, it could be used to add a field to your model
> that makes a query to the last followers on that day and calculates the
> difference (?). You could also use a @property on your Model class for that
> too.
>
> Hope it helps!
>
> *[]'s*
> *Daniel Germano Travieso*
> *Engenharia da Computação Turma: 013*
> *Unicamp*
>
> On Thu, May 31, 2018 at 11:14 AM, JoĂŁo Paulo 
> wrote:
>
>>
>> Hey guys,
>>
>> I´m using SQLite and trying to calculate the followers difference by day
>>
>> This is my model:
>>
>> class Statistics(models.Model):
>> followers = models.IntegerField()
>> last_update = models.DateTimeField(auto_now_add=True)
>>
>> This are my database rows:
>>
>> "6" "50" "*2018-05-29* 00:25:48.276102"
>> "1" "100" "*2018-05-29* 00:26:48.276102"
>> "3" "200" "*2018-05-30* 00:27:04.178444"
>> "5" "250" "*2018-05-30* 00:30:04.178444"
>> "4" "300" "*2018-05-31* 00:27:04.178444"
>>
>> And the result I´m tryting to achieve is:
>>
>> followers | last_update
>> 150
>> *2018-05-30*50
>>
>> *2018-05-31*
>> *# I´m new to Django and thinking about use a Manager, but don't know
>> if´s doable using a Manager# Does anyone has a suggestion ?*
>>
>> --
>> 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/ms
>> gid/django-users/3196a628-a53f-41ac-bcbf-6cc8b8a66016%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/CABF8kZNYHY8zWYNw3WKTxLMcnsxxD
> U9hPAep4wpzk9i4c-veRg%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/CAE-E-_0j3r6g-DHrhif9P_HhpKHCPDohuS6jn86_XPzcg4zFJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: error: can not import the name 'path'

2018-06-04 Thread James Farris
As the previous reply suggests, what Django version are you using?
Using django.conf.urls is a Django 1.11 and below utility function,

Django 2.x uses this
from django.urls import path

*If you are using Django 1.x* this is what your urls.py should look like:

from django.conf.urls import urlfrom django.contrib import admin
from . import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^index/', views.index, name="index"),]

*If you're using Django 2.x* this is what your urls.py should look like

from django.urls import pathfrom django.contrib import admin
from . import views
urlpatterns = [
path('admin/', admin.site.urls),
path('index/', views.index, name="index"),]









On Mon, Jun 4, 2018 at 3:12 PM, Aphiso Media  wrote:

> Whats version are you using? Im on mobile so i cant open urls.py.
>
> If you're using a version earlier than 2.0 you need to use url instead of
> path.
>
> Do you have from django.urls import path?
>
> On Mon, Jun 4, 2018, 4:29 PM anguboy  wrote:
>
>> i am new in django, so in my first app ,am stack at mapping the URL and I
>> get an error that can not import name 'path' ,,which is in the tmn(my_app)
>> folder , please help
>>
>> --
>> 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/88ca007c-c716-4050-a7ce-7bb1b7214fe0%
>> 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/CAJiup7FSUuROtUXyArQqVgFTfOSnf9oBn-zY6TFWyttib%2B5g-Q%
> 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/CAE-E-_33zTiPH4sDNc1mY1X0N_RD6nmGzTGfWODKDfzeULrytw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sponsor subdomain pointing to part of our Django site?

2018-06-04 Thread James Schneider
On Mon, Jun 4, 2018, 12:37 PM Melvyn Sopacua  wrote:

> On maandag 4 juni 2018 20:40:03 CEST Richard Brockie wrote:
>
> > On Mon, Jun 4, 2018 at 9:01 PM Melvyn Sopacua 
> wrote:
>
> > > This isn't a problem. Neither url nor reverse is capable of returning
> URLs
>
> > > with hostnames, at least not that I'm aware of. Only
> django.contrib.site
>
> > > <
> https://docs.djangoproject.com/en/2.0/ref/contrib/sites/#getting-the-curr
>
> > > ent-domain-for-display> module can do this for out-of-band
> communications.
>
> >
>
> > Aha - there's an error in how I posed the question. I was confusing the
> url
>
> > and reverse() outputs with the links as interpreted by a browser.
>
> >
>
> > If http_host is ''subdomain.sponsor.url" we are at the site using the
>
> > sponsor's alias which maps to a unique "/year/slug/" on our site (just
> one
>
> > of many). In this case, we require the output of {% url %} and reverse()
> to
>
> > have 2 possibilities:
>
> >
>
> > 1. Normal operation (with our default http_host): returns the full path:
>
> > "/year/slug/some/more/path/"
>
> > 2. Sponsor http_host: returns a trimmed path: "/some/more/path". Here
>
> > "/year/slug" is suppressed as it is built into the
>
> > ''subdomain.sponsor.url" alias.
>
> >
>
> > I hope this clarifies what we think we need to do
>
>
>
> Aha! Now I get it! This should be solveable at the WSGI layer:
>
>
>
> PATH_INFO
>
> The remainder of the request URL's "path", designating the virtual
> "location" of the request's target within the application. This may be an
> empty string, if the request URL targets the application root and does not
> have a trailing slash.
>
>
>
> See https://www.python.org/dev/peps/pep-0333/
>
>
>
> A URL rewrite or proxy at the webserver level should work as well. It may
> take a bit of experimenting.
>


Would URL rewrites solve this? How does that affect URL's generated in the
template?

It sounds like a separate 'site' with the sites framework is needed, along
with a modified urls.py that does not include the year and slug in the path.

Your might be able to use the existing urls.py by making the year and slug
optional in the regex. When using the sponsored site, you would pass along
extra context to the URL dispatcher that includes the year/slug or whatever
data is being assumed by the usage of the sponsor URL.

Basically, you need two different paths to the same resource, dependent on
the domain name or site in question.

Why not just leave the year and slug in and save yourself the extra work?
Is the vanity path a requirement or just 'nice to have'?

-James

-- 
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%2Be%2BciVucZjzfOxfRwwJijUc%2BxpNVgJWJO%3Dc%2Bg_Ygo-t3tXdcQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is it possible to instantiate a model (create an object) and flag the instance as unsaveable?

2018-06-02 Thread James Schneider
On Sat, Jun 2, 2018, 6:14 PM Bernd Wechner  wrote:

> I'd like to instantiate a model, and play around with it, but ensure it's
> never saved. At bare minimum instantiate it, play around with it then
> delete it, but ideally disable saving somehow. I imagine I can override
> save() on the instance, but am wondering if anyone has experience doing
> this or if there's a canonical method for doing it. I'll experiment but in
> the mean time fishing as I said for experience and any standard methods out
> there.
>

One way to make an obvious indication that the model instance is read-only
is to use a proxy model of the original, with all the saving bits turned
off. Keeps a nice separation of code while utilizing inheritance, and
allows usage of the original/standard behavior.

IMO, overriding the save() method in the proxy model is probably the
cleanest way to prevent an accidental save by a signal, etc.

https://docs.djangoproject.com/en/dev/topics/db/models/#proxy-models

-James

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


Re: Is it possible to instantiate a model (create an object) and flag the instance as unsaveable?

2018-06-02 Thread James Bradshaw
Hey Bernd,

I'm curious about your use case. It's common to create a read-only database
user to make sure no data is modified, but I've never come across anything
at the instance/row level.

-Jimmy

On Sat, Jun 2, 2018, 8:14 PM Bernd Wechner  wrote:

> I'd like to instantiate a model, and play around with it, but ensure it's
> never saved. At bare minimum instantiate it, play around with it then
> delete it, but ideally disable saving somehow. I imagine I can override
> save() on the instance, but am wondering if anyone has experience doing
> this or if there's a canonical method for doing it. I'll experiment but in
> the mean time fishing as I said for experience and any standard methods out
> there.
>
> Regards,
>
> Bernd.
>
> --
> 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/c14ca134-cc54-498a-b5fa-78e80b768102%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/CADEEVemMcE0YMK74hUsbpUc9yDzdd33KMd%3DLgCEacnYoKN45Gw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Starting a poll

2018-05-24 Thread James Farris
If you open the app once the server is started by going to 127.0.0.1:8000
is it loading the website or are you getting a 404 error in the browser?

I see the favicon 404 error all the time, but it doesn’t halt my site.
It’s just django looking for a favicon. That shouldn’t break anything.

Another 404 you might see is django looking for a robots.txt file. This is
normal until you have these setup.

On Thu, May 24, 2018 at 2:15 PM Jorge Gimeno  wrote:

>
>
> On Thu, May 24, 2018, 10:06 AM Caleb Bryson  wrote:
>
>> So I am follow the instructions on the django site to make a poll. I am
>> at the current step where you run the server and everything went fine when
>> i typed in the command. But now it is just there at saying "GET
>> /favicon.ico HTTP/1.1" 404 1977 on the last command line. I was wondering
>> should i wait, or close the cmd prompt and open a new one to continue the
>> steps, or quit the server with CTRL-BREAK(not sure which button represents
>> break on the key board)?
>>
>> --
>> 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/e500ed8f-e5b4-4d3b-aced-29f33dfeb7ec%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout
>
>
>
> Caleb,
>
> If I recall correctly, Ctrl-C stops the server.  Django dpes know when
> some changes are made, but unless I know for sure I always stop and restart
> the server.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To 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/CANfN%3DK80LL-H3hETKcKMv8yLajgONuz4zKTFeJujS9VH0wZQJg%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/CAE-E-_2xmTM3o4z8f5i26o7hLH8T_cRYKb1GMSsNvHFkK7_Kdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re:

2018-05-23 Thread James Farris
I assume you mean TemplateDoesNotExist and I also assume you have created a
templates folder in your project and have details.html in it.

If that’s the case did you check your settings.py for your template
settings?

It should look something like this.

TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates'), ], 'APP_DIRS': True,
...More code here...

On Wed, May 23, 2018 at 3:16 AM Umar Kambala  wrote:

> Yes its spelled correctly on the command window its telling me
> TemplateDoesNotExit: polls/detail.html
> On May 23, 2018 9:58 AM, "tango ward"  wrote:
>
> Check if your template name is correct in your views.py
>
> On Wed, May 23, 2018 at 5:56 PM, Umar Kambala 
> wrote:
>
>> Plz need help
>> I found this problem TemplateDoesNotExit at /polls/1/ where might have I
>> gone 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/CAPkbFbZwVPyBpVsA65UTjeJNgKHnQqpsTVmOmeO5GFeusnVfww%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/CAA6wQLLkxWQd3wDOMPNDEAPPNeTfVJhU7L1GP4au75yrU6Bcuw%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/CAPkbFbZmHibrrij317hQeczBiWqFB_QexEZFxKcko2qpsbzEww%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/CAE-E-_3n7kHV2N9tYLbC1XeANQXXN4eyM-Y3-jZetfZSxnmxbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django

2018-05-21 Thread James Farris
Start with the Django docs tutorials
https://docs.djangoproject.com/en/2.0/intro/tutorial01/


On Mon, May 21, 2018 at 12:20 PM chaitanya goud 
wrote:

> Google "full stack python "
>
> On 22-May-2018 12:49 am, "Shivprasad Khandapure" <
> shivkhandapure...@gmail.com> wrote:
>
> Hii everyone
> I'm interested to learn django framework. I'm new in python and
> django so give some important important ideas, details about django and its
> basics. How can i work with django and its python libraries and its
> templates.
>  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/CAFR1ACRU_YGo-otVE-hD9nBTNCcznuXMhy8m00%3DoaPz%2B9%2BmsBw%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/CA%2BkSnu6kWcePXQtFWot2ZMrbMd%2BTLBjSFmFaX2fY2zdV3J8oow%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/CAE-E-_3%3D3R%3D25QYifm8NneDFE6j6Cqw18jRNzGTTFtAm0%3DjvLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: need help

2018-05-19 Thread James Farris
What does your settings.py look for k like? Can you copy/paste it here?

On Sat, May 19, 2018 at 9:00 AM Umar Kambala  wrote:

> DEBUG is on but when I runserver the content on my header.html is not
> displaying on de browser. It gives me not found on de cmd window n 404
> error on de webpage.
> On May 19, 2018 3:37 PM, "James Farris"  wrote:
>
> If you set DEBUG = True
> Then restart your python server then reload the page, what is the output?
>
> It’s best to leave debug on until you have all the bugs worked out since
> it provides a lot of information that will tell you what’s happening
>
>
> Sent from my mobile device
>
> On May 19, 2018, at 8:32 AM, Umar Kambala  wrote:
>
> I have been following de tutorials on web development but got lost on de
> peronal. Wen I run my server its gud to go but it won't display de content
> on de web browser. It always give me 404 error
> On May 19, 2018 3:28 PM, "James Farris"  wrote:
>
>> Are you asking where DEBUG = False is?
>> If so, it would be in your project folder/project name/settings.py
>>
>>
>> Sent from my mobile device
>>
>> On May 19, 2018, at 4:36 AM, Umar Kambala  wrote:
>>
>> How to I set my debug = false? On my django settings.. I don't know where
>> to get de settings
>> On May 3, 2018 12:52 AM, "Gerald Brown"  wrote:
>>
>> Have you tried "pip install django" without the "== 2.0.5". I think that
>> if you do not specify a version pip will install the latest version.
>>
>> On Thursday, 03 May, 2018 12:46 AM, umarkamb...@gmail.com wrote:
>>
>> please  this is the massage i keep on getting when trying to install
>> django.. what do i do?
>>
>>
>> C:\Users\Admin>pip install Django==2.0.5
>> Collecting Django==2.0.5
>>   Retrying (Retry(total=4, connect=None, read=None, redirect=None,
>> status=None)) after connection broken by
>> 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read
>> timed out. (read timeout=15)",)': /simple/django/
>>   Downloading
>> https://files.pythonhosted.org/packages/23/91/2245462e57798e9251de87c88b2b8f996d10ddcb68206a8a020561ef7bd3/Django-2.0.5-py3-none-any.whl
>> (7.1MB)
>> 0% || 10kB 1.2kB/s eta
>> 1:36:24Exception:
>> Traceback (most recent call last):
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\urllib3\response.py",
>> line 302, in _error_catcher
>> yield
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\urllib3\response.py",
>> line 384, in read
>> data = self._fp.read(amt)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py",
>> line 60, in read
>> data = self.__fp.read(amt)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\http\client.py",
>> line 449, in read
>> n = self.readinto(b)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\http\client.py",
>> line 493, in readinto
>> n = self.fp.readinto(b)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\socket.py",
>> line 586, in readinto
>> return self._sock.recv_into(b)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", line
>> 1009, in recv_into
>> return self.read(nbytes, buffer)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", line
>> 871, in read
>> return self._sslobj.read(len, buffer)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", line
>> 631, in read
>> v = self._sslobj.read(len, buffer)
>> socket.timeout: The read operation timed out
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\basecommand.py",
>> line 215, in main
>> status = self.run(options, args)
>>   File
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\commands\install.py",
>> line 324, in run
>> requirement_set.prepare_files(finder)
>>   File
>> "c:\users\admin\appdata\local\programs\p

Re: need help

2018-05-19 Thread James Farris
If you set DEBUG = True 
Then restart your python server then reload the page, what is the output?

It’s best to leave debug on until you have all the bugs worked out since it 
provides a lot of information that will tell you what’s happening 

Sent from my mobile device

> On May 19, 2018, at 8:32 AM, Umar Kambala  wrote:
> 
> I have been following de tutorials on web development but got lost on de 
> peronal. Wen I run my server its gud to go but it won't display de content on 
> de web browser. It always give me 404 error
> 
>> On May 19, 2018 3:28 PM, "James Farris"  wrote:
>> Are you asking where DEBUG = False is?
>> If so, it would be in your project folder/project name/settings.py
>> 
>> 
>> Sent from my mobile device
>> 
>>> On May 19, 2018, at 4:36 AM, Umar Kambala  wrote:
>>> 
>>> How to I set my debug = false? On my django settings.. I don't know where 
>>> to get de settings
>>> 
>>> On May 3, 2018 12:52 AM, "Gerald Brown"  wrote:
>>> Have you tried "pip install django" without the "== 2.0.5". I think that if 
>>> you do not specify a version pip will install the latest version.
>>> 
>>>> On Thursday, 03 May, 2018 12:46 AM, umarkamb...@gmail.com wrote:
>>>> please  this is the massage i keep on getting when trying to install 
>>>> django.. what do i do?
>>>> 
>>>> 
>>>> C:\Users\Admin>pip install Django==2.0.5
>>>> Collecting Django==2.0.5
>>>>   Retrying (Retry(total=4, connect=None, read=None, redirect=None, 
>>>> status=None)) after connection broken by 
>>>> 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read 
>>>> timed out. (read timeout=15)",)': /simple/django/
>>>>   Downloading 
>>>> https://files.pythonhosted.org/packages/23/91/2245462e57798e9251de87c88b2b8f996d10ddcb68206a8a020561ef7bd3/Django-2.0.5-py3-none-any.whl
>>>>  (7.1MB)
>>>> 0% || 10kB 1.2kB/s eta 
>>>> 1:36:24Exception:
>>>> Traceback (most recent call last):
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\urllib3\response.py",
>>>>  line 302, in _error_catcher
>>>> yield
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\urllib3\response.py",
>>>>  line 384, in read
>>>> data = self._fp.read(amt)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py",
>>>>  line 60, in read
>>>> data = self.__fp.read(amt)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\http\client.py",
>>>>  line 449, in read
>>>> n = self.readinto(b)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\http\client.py",
>>>>  line 493, in readinto
>>>> n = self.fp.readinto(b)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\socket.py", 
>>>> line 586, in readinto
>>>> return self._sock.recv_into(b)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", 
>>>> line 1009, in recv_into
>>>> return self.read(nbytes, buffer)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", 
>>>> line 871, in read
>>>> return self._sslobj.read(len, buffer)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", 
>>>> line 631, in read
>>>> v = self._sslobj.read(len, buffer)
>>>> socket.timeout: The read operation timed out
>>>> 
>>>> During handling of the above exception, another exception occurred:
>>>> 
>>>> Traceback (most recent call last):
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\basecommand.py",
>>>>  line 215, in main
>>>> status = self.run(options, args)
>>>>   File 
>>>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\commands

Re: need help

2018-05-19 Thread James Farris
Are you asking where DEBUG = False is?
If so, it would be in your project folder/project name/settings.py


Sent from my mobile device

> On May 19, 2018, at 4:36 AM, Umar Kambala  wrote:
> 
> How to I set my debug = false? On my django settings.. I don't know where to 
> get de settings
> 
> On May 3, 2018 12:52 AM, "Gerald Brown"  wrote:
> Have you tried "pip install django" without the "== 2.0.5". I think that if 
> you do not specify a version pip will install the latest version.
> 
>> On Thursday, 03 May, 2018 12:46 AM, umarkamb...@gmail.com wrote:
>> please  this is the massage i keep on getting when trying to install 
>> django.. what do i do?
>> 
>> 
>> C:\Users\Admin>pip install Django==2.0.5
>> Collecting Django==2.0.5
>>   Retrying (Retry(total=4, connect=None, read=None, redirect=None, 
>> status=None)) after connection broken by 
>> 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read 
>> timed out. (read timeout=15)",)': /simple/django/
>>   Downloading 
>> https://files.pythonhosted.org/packages/23/91/2245462e57798e9251de87c88b2b8f996d10ddcb68206a8a020561ef7bd3/Django-2.0.5-py3-none-any.whl
>>  (7.1MB)
>> 0% || 10kB 1.2kB/s eta 1:36:24Exception:
>> Traceback (most recent call last):
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\urllib3\response.py",
>>  line 302, in _error_catcher
>> yield
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\urllib3\response.py",
>>  line 384, in read
>> data = self._fp.read(amt)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py",
>>  line 60, in read
>> data = self.__fp.read(amt)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\http\client.py",
>>  line 449, in read
>> n = self.readinto(b)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\http\client.py",
>>  line 493, in readinto
>> n = self.fp.readinto(b)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\socket.py", 
>> line 586, in readinto
>> return self._sock.recv_into(b)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", line 
>> 1009, in recv_into
>> return self.read(nbytes, buffer)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", line 
>> 871, in read
>> return self._sslobj.read(len, buffer)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\ssl.py", line 
>> 631, in read
>> v = self._sslobj.read(len, buffer)
>> socket.timeout: The read operation timed out
>> 
>> During handling of the above exception, another exception occurred:
>> 
>> Traceback (most recent call last):
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\basecommand.py",
>>  line 215, in main
>> status = self.run(options, args)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\commands\install.py",
>>  line 324, in run
>> requirement_set.prepare_files(finder)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py",
>>  line 380, in prepare_files
>> ignore_dependencies=self.ignore_dependencies))
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\req\req_set.py",
>>  line 620, in _prepare_file
>> session=self.session, hashes=hashes)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py",
>>  line 821, in unpack_url
>> hashes=hashes
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py",
>>  line 659, in unpack_http_url
>> hashes)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py",
>>  line 882, in _download_http_url
>> _download_url(resp, link, content_file, hashes)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py",
>>  line 603, in _download_url
>> hashes.check_against_chunks(downloaded_chunks)
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\utils\hashes.py",
>>  line 46, in check_against_chunks
>> for chunk in chunks:
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py",
>>  line 571, in written_chunks
>> for chunk in chunks:
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\utils\ui.py",
>>  line 139, in iter
>> for x in it:
>>   File 
>> "c:\users\admin\appdata\local\programs\python\python36-32\lib\site-packages\pip\download.py",
>>  line 560, in resp_read
>> decode_content=False):
>>   File 
>> "c:\users\ad

Re: getting error while reloading the url"http://localhost:8000/polls/".The error is given below.Please tell my why i am seeing this error?

2018-05-18 Thread James Farris
What does your urls.py look like?

According to the error it doesn’t appear that polls/ is defined in your
urls.py file

On Fri, May 18, 2018 at 10:05 AM Avitab Ayan Sarmah 
wrote:

> Page not found (404)
> Request Method: GET
> Request URL: http://localhost:8000/polls/
>
> Using the URLconf defined in mysite.urls, Django tried these URL
> patterns, in this order:
>
>1. [name='index']
>2. / [name='detail']
>3. /results/ [name='results']
>4. /vote/ [name='vote']
>5. admin/
>
> The current path, polls/, didn't match any of these.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a standard
> 404 page.
>
> --
> 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/54b07f4e-663c-4ed0-a419-541d735148a1%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/CAE-E-_2Gms%3DtqeXpJ_FFJ1p6_i1ECAf15yGmw1PCJz%3DN4yZQYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ImportError : cannot import name include

2018-05-18 Thread James Farris
If you are not using a virtual env, did you install pip3? If so, since you
are using puthon3 -V to get that python version, try running
$ pip3 install django
And see if you get a different result

I think what is happening is when you run pip install it’s referencing
another python version, not python 3.

At least that is what I experienced back before I used virtual envs

On Fri, May 18, 2018 at 9:01 AM Journal-Immo 
wrote:

> Thank you for all your answers
>
> I know my problem with version
>
> So for me it's very strange...
>
> python3 -V
>
> Python 3.5.3
>
> pip install Django==2.0.5
>
> Collecting Django==2.0.5...
>
> Could nt find a version... 1.2.1, 1.2.2 etc and the last one 1.11.13
>
> No matching distribution found fot Django==2.0.5
>
> Do you think Virtual Envirenment will solve my problem ?
>
> Many thank again
>
> Le 18/05/2018 Ă  16:38, Daniel Hepper a ĂŠcrit :
>
> Your problem is right here:
>
> > django-admin --version 1.11.13
> You are using Django 1.11. The documentation you are using refers to a
> newer version of Django, version 2.0.
>
> Use the right documentation for your version of Django:
>
> https://docs.djangoproject.com/en/1.11/
>
> You are seeing this specific error because in Django 2.0, you can write
> "from django.urls import include", while in Django 1.11, you have to write
> "from django.conf.urls import include".
>
> Note that using Debian packages, you won't get the latest version of
> Django (or any other Python packages). You might want to consider
> installing the latest version with pip.
>
>
> https://docs.djangoproject.com/en/2.0/topics/install/#installing-official-release
>
> Hope that helps,
> Daniel
>
> On Fri, May 18, 2018 at 4:20 PM, Journal-Immo 
> wrote:
>
>> Thank
>>
>> But (I use debian 9)
>>
>> Apt-get update
>>
>> Apt-get install python python3 python-django
>>
>> django-admin --version 1.11.13
>>
>> Where is the problem ?
>>
>> Le 17/05/2018 Ă  21:01, Fidel Leon a ĂŠcrit :
>>
>> You are using the wrong combination of Django and tutorial: “include” is
>> available in Django 2 and up, but you’re using Django 1.11.
>>
>> Fidel Leon
>> fi...@flm.cat
>> Phone: +34 622 26 44 92 
>> GPG: 2585 30C2 E3C7 7151 0864  946B 7423 F94B 5753 5FC7
>>
>> El 17 de mayo de 2018 a las 20:56:56, Tristan Demot (
>> cont...@journal-immo.com) escribiĂł:
>>
>> Hello,
>>
>>  I use docs.djangoproject.co/en/2.0
>>  Python 2 7 13
>> Gjango 1.11.13
>>
>> Creating the Polls app OK
>> Write your first view OK
>> But python manage runserver don't work
>> With : python -Wall manage.py test
>> ImportError : cannot import name include
>> If you want to see something, ask me
>> Many 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/1fe7df04-dc85-4a3d-940e-4dde7de31477%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/CAHXg%3DN090U8JCFfdvZJWH1qSoWQgp2mQH6z2RfCzj3384epQKQ%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/7e9e643b-6e7e-681c-eed2-dc9ab9be94e6%40journal-immo.com
>> .
>>
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Grou

  1   2   3   4   5   6   7   8   9   10   >