Re: Insert values in python manage.py shell using custom sql

2018-08-23 Thread Vishak Raj
Thank you..

I  am new to django,.
How can we say the data are in order to django and it asked the value for
the id column..
How can it get the last id column..
Thanks in advance

shanmu

On Fri 24 Aug, 2018, 12:13 AM Aware Fun,  wrote:

> We dont need to give primary key it automatically define the key.
>
> rahul
>
> On Thu, Aug 23, 2018, 11:20 PM Vishak Raj  wrote:
>
>> Hello
>>
>> Thanks for replying..
>>
>> I have a confusion
>>
>> In normal python shell, we import sqlite3 and insert values without
>> giving the  Id or primary key..
>>
>> Why we giving primary key in django..
>> Is it possible to insert values without primary key like we give in
>> python shell..
>>
>> Thanks in advance
>>
>> On Thursday, August 23, 2018, 'Vinod Kumar' via Django users <
>> django-users@googlegroups.com> wrote:
>>
>>> By default model have id column , so you have to put value of id.
>>>
>>> On Thu, Aug 23, 2018, 5:00 PM Vishak Raj 
>>> wrote:
>>>
 hello,

 i am inserting the values in the table using custome sql in django
 shell..

 p.execute('INSERT INTO webapp_information 
 VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)',i)

 i is the list of values

 it shows the error:OperationalError: table webapp_information has 32 
 columns but 31 values were supplied

 I created the only 31 columns in models.py


 What to do.. 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/10ad145e-5e0b-4d52-a8c9-54af6fa69fba%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> 
>>>
>>> *This e-mail and all attachments are intended solely for use by the
>>> intended recipient and may contain confidential / proprietary information
>>> of KiwiTech, LLC, subject to important disclaimers and conditions including
>>> restrictions on the use, disclosure, transfer or export of such
>>> information.* *If you have received this message in error or are not
>>> the named recipient(s), please immediately notify the sender at the
>>> telephone number stated above or by reply e-mail and delete this e-mail
>>> from your computer*
>>>
>>> --
>>> 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/CAJOHC1xufhygtCtBOjxZhUf26oonYYLxaZeqv05QRJS%3DK%2BPOJQ%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> vishakraj
>>
>> --
>> 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/CAFL71Cz5ZrAwDc2EgrXfX-QOLt-nL4tcM3fyMHGGRZQEjyrJJw%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%2B8bEuRd7uqkw2dHt3_3J7QqJvXFD4_Kt4bAVXS2ynQtf9B9_w%40mail.gmail.com
> 

Re: Django performance issue that's troubling

2018-08-23 Thread Jim Illback
Vijay, you are exactly correct. Thank you much!

Now, knowing the problem, I still don’t have a great solution. Here’s how it is 
supposed to work.

Someone chooses a client from the list or a search. All the possible support 
records are shown, whether they exist or not, on a screen to hyperlink to one 
of them. If the record exists, the URL includes the PK and transfers to the 
UpdateView. This is similar for an AddView if the record does not exist. 
However, in the Update or Add, I don’t want the primary key changed. So, I hid 
the field (and thus all the records were read). However, now I can’t limit that 
field to only one value. If I format the entire SELECT tag with only one 
OPTION, Django gives an invalid expression for the ID or Name because it is 
based on my query set I passed in that fills out the values (ID and name). If I 
use the form’s field value, all the fields are read. Especially on an Add, I 
don’t know a way to fill the client ID field in such a way that Django will 
take it as valid.

My thoughts on possible solutions:
1. Override the get query set method to only pass in the single record - will 
that work?
2. I’ve been trying to show the field in a  tag and override the View’s post 
method by aftering is_valid(), but it always returns invalid expression errors.

What am I missing?

Thanks much again -
Jim


On Aug 23, 2018, at 3:48 PM, Vijay Khemlani 
mailto:vkhem...@gmail.com>> wrote:

Maybe your update form has a field related to a model with thousands of 
records? like rendering a select combo box with thousands of choices?

On Thu, Aug 23, 2018 at 5:30 PM Jim Illback 
mailto:subaru...@hotmail.com>> wrote:
I have a Django app in development that performed perfectly with about 20 
client records. Each client could have one or more support records and there 
are 40 potential support records, connected to the client with a ForeignKey 
(client_id). Then, I loading about 37K client records. Search queries perform 
almost instantaneously. A paginated list of support records with 40 pages and 
10 clients per page comes back in half a second. Great performance.

However, when I click on any record in the list to go to update a specific 
support record for that specific client (it uses the PK in the URL so is a 
direct call to the UpdateView routine), I get about 10 second response times 
and these kind of statistics from Django-debug-toolbar:
SQL: 5 queries, 20ms (so clearly not a DB related performance issue)
TIME:  Resource usage:
User CPU time 8827 msec
System CPU time 137 msec
Elapsed time 9003 msec
Context switches 1 voluntary, 9639 involuntary
Browser timing:
domLoading 9026 (+52130) msec

CACHE: 0 calls in 0.00ms (so clearly not a cache issue either)

Here are some details: Django 2.1, python 3.6.3
Hardware: iMac with 32GB, i7 quad core
Installed apps: Bootstrap3 v9.1.0, crispy forms v1.7.0, easyPDF v0.1.1, 
registration-redux v2.2, Pillow v4.3.0

Here’s one of the specific UpdateView routines being executed - there are only 
5 fields in the AddictionForm plus the prime key (no image or file attachments).

class AddictionUpdate(PermissionRequiredMixin, UpdateView):
model = Addiction
form_class = AddictionForm
template_name = 'addiction_update.html'
permission_required = 'clientapp.change_addiction'

The slow response appears to be on UpdateView pages only, even though all 
updates are called with the prime key (ID) in the URL. Can anyone give me 
guidance where to look for improving the performance? Why all the involuntary 
context switches? Why the large domLoading time?

Thanks in advance -
Jim

--
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/76F251D2-A429-4700-9F69-053673BDB91F%40hotmail.com.
For more options, visit https://groups.google.com/d/optout.

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

Re: Django performance issue that's troubling

2018-08-23 Thread Vijay Khemlani
Maybe your update form has a field related to a model with thousands of
records? like rendering a select combo box with thousands of choices?

On Thu, Aug 23, 2018 at 5:30 PM Jim Illback  wrote:

> I have a Django app in development that performed perfectly with about 20
> client records. Each client could have one or more support records and
> there are 40 potential support records, connected to the client with a
> ForeignKey (client_id). Then, I loading about 37K client records. Search
> queries perform almost instantaneously. A paginated list of support records
> with 40 pages and 10 clients per page comes back in half a second. Great
> performance.
>
> However, when I click on any record in the list to go to update a specific
> support record for that specific client (it uses the PK in the URL so is a
> direct call to the UpdateView routine), I get about 10 second response
> times and these kind of statistics from Django-debug-toolbar:
> *SQL*: 5 queries, 20ms (so clearly not a DB related performance issue)
> *TIME*:  Resource usage:
> User CPU time 8827 msec
> System CPU time 137 msec
> Elapsed time 9003 msec
> Context switches 1 voluntary, 9639 involuntary
> Browser timing:
> domLoading 9026 (+52130) msec
>
> *CACHE*: 0 calls in 0.00ms (so clearly not a cache issue either)
>
> Here are some details: Django 2.1, python 3.6.3
> Hardware: iMac with 32GB, i7 quad core
> Installed apps: Bootstrap3 v9.1.0, crispy forms v1.7.0, easyPDF v0.1.1,
> registration-redux v2.2, Pillow v4.3.0
>
> Here’s one of the specific UpdateView routines being executed - there are
> only 5 fields in the AddictionForm plus the prime key (no image or file
> attachments).
>
> class AddictionUpdate(PermissionRequiredMixin, UpdateView):
> model = Addiction
> form_class = AddictionForm
> template_name = 'addiction_update.html'
> permission_required = 'clientapp.change_addiction'
>
> The slow response appears to be on UpdateView pages only, even though all
> updates are called with the prime key (ID) in the URL. Can anyone give me
> guidance where to look for improving the performance? Why all the
> involuntary context switches? Why the large domLoading time?
>
> Thanks in advance -
> Jim
>
> --
> 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/76F251D2-A429-4700-9F69-053673BDB91F%40hotmail.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/CALn3ei2korG5V3dDcCUQuKiAhG6tzAz%3DJZssNpGJpkAOyKAXpQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


TypeError: view must be a callable or a list/tuple in the case of include().

2018-08-23 Thread herve kabore
this is the urls.py


from django.conf.urls import url
from django.contrib import admin

urlpatterns = [
url(r'^admin/', include(admin.site.urls)),

 url(r'^$', 'blog.views.home', name='home'),
]


this is the views


from django.shortcuts import render

from django.http import HttpResponse

# Create your views here.

def home(request):
return HttpResponse("Bonjour monde!")



Unhandled exception in thread started by .wrapper at 0x7f8f4a8afe18>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/django/utils/autoreload.py", line 
228, in wrapper
fn(*args, **kwargs)
  File 
"/usr/lib/python3/dist-packages/django/core/management/commands/runserver.py", 
line 124, in inner_run
self.check(display_num_errors=True)
  File "/usr/lib/python3/dist-packages/django/core/management/base.py", 
line 359, in check
include_deployment_checks=include_deployment_checks,
  File "/usr/lib/python3/dist-packages/django/core/management/base.py", 
line 346, in _run_checks
return checks.run_checks(**kwargs)
  File "/usr/lib/python3/dist-packages/django/core/checks/registry.py", 
line 81, in run_checks
new_errors = check(app_configs=app_configs)
  File "/usr/lib/python3/dist-packages/django/core/checks/urls.py", line 
16, in check_url_config
return check_resolver(resolver)
  File "/usr/lib/python3/dist-packages/django/core/checks/urls.py", line 
26, in check_resolver
return check_method()
  File "/usr/lib/python3/dist-packages/django/urls/resolvers.py", line 256, 
in check
for pattern in self.url_patterns:
  File "/usr/lib/python3/dist-packages/django/utils/functional.py", line 
35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/lib/python3/dist-packages/django/urls/resolvers.py", line 407, 
in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", 
self.urlconf_module)
  File "/usr/lib/python3/dist-packages/django/utils/functional.py", line 
35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/lib/python3/dist-packages/django/urls/resolvers.py", line 400, 
in urlconf_module
return import_module(self.urlconf_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in 
import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 994, in _gcd_import
  File "", line 971, in _find_and_load
  File "", line 955, in _find_and_load_unlocked
  File "", line 665, in _load_unlocked
  File "", line 678, in exec_module
  File "", line 219, in 
_call_with_frames_removed
  File "/home/herve/Bureau/mes_projets/eboutique/eboutique/urls.py", line 
20, in 
url(r'^$', 'backoffice.views.home', name='home'),
  File "/usr/lib/python3/dist-packages/django/conf/urls/__init__.py", line 
85, in url
raise TypeError('view must be a callable or a list/tuple in the case of 
include().')
TypeError: view must be a callable or a list/tuple in the case of include().

-- 
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/c20e08d2-2578-4430-963e-bb14df3a0ece%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I patch django.core.mail.send_mail for testing?

2018-08-23 Thread scloutier
I solved the problem by wrapping the imports of the test-file inside a 
context manager, as follow:

with patch('django.core.mail.send_mail') as mocked_send_mail:
from ModuleToTest.File import functionToTest


That forced the patch to occur before the tested function was actualy 
imported.

-- 
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/f4212245-30cb-47e5-9505-5b66cff20064%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: HEELP!! CANT LOAD THE CSS OF MY DJANGO ADMIN PAGE WHY??

2018-08-23 Thread scloutier
If you are in development mode (as I assume you are since you run `python 
manage.py runserver`), you need to set `DEBUG=True` in your settings.py 
file. Otherwise Django assumes that another program is serving the static 
files (nginx, apache, etc) and does not need to serve them itself.

-- 
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/3e432b41-dbcd-4572-9875-d0aa0a23fb27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django performance issue that's troubling

2018-08-23 Thread Jim Illback
I have a Django app in development that performed perfectly with about 20 
client records. Each client could have one or more support records and there 
are 40 potential support records, connected to the client with a ForeignKey 
(client_id). Then, I loading about 37K client records. Search queries perform 
almost instantaneously. A paginated list of support records with 40 pages and 
10 clients per page comes back in half a second. Great performance.

However, when I click on any record in the list to go to update a specific 
support record for that specific client (it uses the PK in the URL so is a 
direct call to the UpdateView routine), I get about 10 second response times 
and these kind of statistics from Django-debug-toolbar:
SQL: 5 queries, 20ms (so clearly not a DB related performance issue)
TIME:  Resource usage:
User CPU time 8827 msec
System CPU time 137 msec
Elapsed time 9003 msec
Context switches 1 voluntary, 9639 involuntary
Browser timing:
domLoading 9026 (+52130) msec

CACHE: 0 calls in 0.00ms (so clearly not a cache issue either)

Here are some details: Django 2.1, python 3.6.3
Hardware: iMac with 32GB, i7 quad core
Installed apps: Bootstrap3 v9.1.0, crispy forms v1.7.0, easyPDF v0.1.1, 
registration-redux v2.2, Pillow v4.3.0

Here’s one of the specific UpdateView routines being executed - there are only 
5 fields in the AddictionForm plus the prime key (no image or file attachments).

class AddictionUpdate(PermissionRequiredMixin, UpdateView):
model = Addiction
form_class = AddictionForm
template_name = 'addiction_update.html'
permission_required = 'clientapp.change_addiction'

The slow response appears to be on UpdateView pages only, even though all 
updates are called with the prime key (ID) in the URL. Can anyone give me 
guidance where to look for improving the performance? Why all the involuntary 
context switches? Why the large domLoading time?

Thanks in advance -
Jim

-- 
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/76F251D2-A429-4700-9F69-053673BDB91F%40hotmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: HEELP!! CANT LOAD THE CSS OF MY DJANGO ADMIN PAGE WHY??

2018-08-23 Thread Tim Vogt (Tim Vogt)
try $python manage.py runserver 

> Op 23 aug. 2018, om 21:31 heeft Dario Coronel  het 
> volgende geschreven:
> 
> I follow step by step the instructions of the documentatión of django 
> especificly the tutorial part two when i create my superuser its all ok The 
> problem is whe i put $python runserver he work but not find the statics files 
> and not load the styles just the view without nothing
> what i have done wrong?
> 
> 
> this is my settings.py 
> 
> """
> Django settings for mysite project.
> 
> Generated by 'django-admin startproject' using Django 2.0.8.
> 
> For more information on this file, see
> https://docs.djangoproject.com/en/2.0/topics/settings/
> 
> For the full list of settings and their values, see
> https://docs.djangoproject.com/en/2.0/ref/settings/
> """
> 
> import os
> 
> # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
> BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
> 
> 
> # Quick-start development settings - unsuitable for production
> # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
> 
> # SECURITY WARNING: keep the secret key used in production secret!
> SECRET_KEY = '2)a0=!9utl%7lrjixn0s4w(_q1so-$=__iy%@$$yi+!22rqjh)'
> 
> # SECURITY WARNING: don't run with debug turned on in production!
> DEBUG = False
> 
> ALLOWED_HOSTS = ['localhost', '127.0.0.1',]
> 
> 
> # Application definition
> 
> INSTALLED_APPS = [
> 'polls.apps.PollsConfig',
> '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 = 'mysite.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 = 'mysite.wsgi.application'
> 
> 
> # Database
> # https://docs.djangoproject.com/en/2.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/2.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/2.0/topics/i18n/
> 
> LANGUAGE_CODE = 'en-us'
> 
> TIME_ZONE = 'Europe/Istanbul'
> 
> USE_I18N = True
> 
> USE_L10N = True
> 
> USE_TZ = True
> 
> 
> # Static files (CSS, JavaScript, Images)
> # https://docs.djangoproject.com/en/2.0/howto/static-files/
> 
> STATIC_URL = '/static/'
> STATIC_ROOT = os.path.join(BASE_DIR, "static")
> 
> 
> 
> 
> 
> what is the problem?
> 
> -- 
> 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/029a39f1-6538-44e7-ac92-4bd96f42866f%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 

HEELP!! CANT LOAD THE CSS OF MY DJANGO ADMIN PAGE WHY??

2018-08-23 Thread Dario Coronel
I follow step by step the instructions of the documentatión of django 
especificly the tutorial part two when i create my superuser its all ok The 
problem is whe i put $python runserver he work but not find the statics 
files and not load the styles just the view without nothing
what i have done wrong?


this is my settings.py 

"""
Django settings for mysite project.

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

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

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

import os

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


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '2)a0=!9utl%7lrjixn0s4w(_q1so-$=__iy%@$$yi+!22rqjh)'

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

ALLOWED_HOSTS = ['localhost', '127.0.0.1',]


# Application definition

INSTALLED_APPS = [
'polls.apps.PollsConfig',
'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 = 'mysite.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 = 'mysite.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.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/2.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/2.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Europe/Istanbul'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static")





what is the problem?

-- 
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/029a39f1-6538-44e7-ac92-4bd96f42866f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Insert values in python manage.py shell using custom sql

2018-08-23 Thread Aware Fun
Primary key is a unique kye that differentiate you values like in order
1,2,3 like this or u can say that your values are are stored in order.In
django when u create object and give  values first it by default assign the
primary key to 1.



rahul

On Thu, Aug 23, 2018, 11:20 PM Vishak Raj  wrote:

> Hello
>
> Thanks for replying..
>
> I have a confusion
>
> In normal python shell, we import sqlite3 and insert values without giving
> the  Id or primary key..
>
> Why we giving primary key in django..
> Is it possible to insert values without primary key like we give in python
> shell..
>
> Thanks in advance
>
> On Thursday, August 23, 2018, 'Vinod Kumar' via Django users <
> django-users@googlegroups.com> wrote:
>
>> By default model have id column , so you have to put value of id.
>>
>> On Thu, Aug 23, 2018, 5:00 PM Vishak Raj  wrote:
>>
>>> hello,
>>>
>>> i am inserting the values in the table using custome sql in django
>>> shell..
>>>
>>> p.execute('INSERT INTO webapp_information 
>>> VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)',i)
>>>
>>> i is the list of values
>>>
>>> it shows the error:OperationalError: table webapp_information has 32 
>>> columns but 31 values were supplied
>>>
>>> I created the only 31 columns in models.py
>>>
>>>
>>> What to do.. 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/10ad145e-5e0b-4d52-a8c9-54af6fa69fba%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> 
>>
>> *This e-mail and all attachments are intended solely for use by the
>> intended recipient and may contain confidential / proprietary information
>> of KiwiTech, LLC, subject to important disclaimers and conditions including
>> restrictions on the use, disclosure, transfer or export of such
>> information.* *If you have received this message in error or are not the
>> named recipient(s), please immediately notify the sender at the telephone
>> number stated above or by reply e-mail and delete this e-mail from your
>> computer*
>>
>> --
>> 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/CAJOHC1xufhygtCtBOjxZhUf26oonYYLxaZeqv05QRJS%3DK%2BPOJQ%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> vishakraj
>
> --
> 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/CAFL71Cz5ZrAwDc2EgrXfX-QOLt-nL4tcM3fyMHGGRZQEjyrJJw%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%2B8bEuR3CYoq2-47uC-2BrVgF5bSK9dURB5y6PVW7nWrAUbi3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Insert values in python manage.py shell using custom sql

2018-08-23 Thread Aware Fun
We dont need to give primary key it automatically define the key.

rahul

On Thu, Aug 23, 2018, 11:20 PM Vishak Raj  wrote:

> Hello
>
> Thanks for replying..
>
> I have a confusion
>
> In normal python shell, we import sqlite3 and insert values without giving
> the  Id or primary key..
>
> Why we giving primary key in django..
> Is it possible to insert values without primary key like we give in python
> shell..
>
> Thanks in advance
>
> On Thursday, August 23, 2018, 'Vinod Kumar' via Django users <
> django-users@googlegroups.com> wrote:
>
>> By default model have id column , so you have to put value of id.
>>
>> On Thu, Aug 23, 2018, 5:00 PM Vishak Raj  wrote:
>>
>>> hello,
>>>
>>> i am inserting the values in the table using custome sql in django
>>> shell..
>>>
>>> p.execute('INSERT INTO webapp_information 
>>> VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)',i)
>>>
>>> i is the list of values
>>>
>>> it shows the error:OperationalError: table webapp_information has 32 
>>> columns but 31 values were supplied
>>>
>>> I created the only 31 columns in models.py
>>>
>>>
>>> What to do.. 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/10ad145e-5e0b-4d52-a8c9-54af6fa69fba%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> 
>>
>> *This e-mail and all attachments are intended solely for use by the
>> intended recipient and may contain confidential / proprietary information
>> of KiwiTech, LLC, subject to important disclaimers and conditions including
>> restrictions on the use, disclosure, transfer or export of such
>> information.* *If you have received this message in error or are not the
>> named recipient(s), please immediately notify the sender at the telephone
>> number stated above or by reply e-mail and delete this e-mail from your
>> computer*
>>
>> --
>> 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/CAJOHC1xufhygtCtBOjxZhUf26oonYYLxaZeqv05QRJS%3DK%2BPOJQ%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> vishakraj
>
> --
> 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/CAFL71Cz5ZrAwDc2EgrXfX-QOLt-nL4tcM3fyMHGGRZQEjyrJJw%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%2B8bEuRd7uqkw2dHt3_3J7QqJvXFD4_Kt4bAVXS2ynQtf9B9_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Insert values in python manage.py shell using custom sql

2018-08-23 Thread Vishak Raj
Hello

Thanks for replying..

I have a confusion

In normal python shell, we import sqlite3 and insert values without giving
the  Id or primary key..

Why we giving primary key in django..
Is it possible to insert values without primary key like we give in python
shell..

Thanks in advance

On Thursday, August 23, 2018, 'Vinod Kumar' via Django users <
django-users@googlegroups.com> wrote:

> By default model have id column , so you have to put value of id.
>
> On Thu, Aug 23, 2018, 5:00 PM Vishak Raj  wrote:
>
>> hello,
>>
>> i am inserting the values in the table using custome sql in django shell..
>>
>> p.execute('INSERT INTO webapp_information 
>> VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)',i)
>>
>> i is the list of values
>>
>> it shows the error:OperationalError: table webapp_information has 32 columns 
>> but 31 values were supplied
>>
>> I created the only 31 columns in models.py
>>
>>
>> What to do.. 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/10ad145e-5e0b-4d52-a8c9-54af6fa69fba%
>> 40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> 
>
> *This e-mail and all attachments are intended solely for use by the
> intended recipient and may contain confidential / proprietary information
> of KiwiTech, LLC, subject to important disclaimers and conditions including
> restrictions on the use, disclosure, transfer or export of such
> information.* *If you have received this message in error or are not the
> named recipient(s), please immediately notify the sender at the telephone
> number stated above or by reply e-mail and delete this e-mail from your
> computer*
>
> --
> 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/CAJOHC1xufhygtCtBOjxZhUf26oonY
> YLxaZeqv05QRJS%3DK%2BPOJQ%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
vishakraj

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


Re: django sqlite3 error

2018-08-23 Thread Benjamin Goldberg
I think people need to see what your music_result table looks like before 
replying

On Thursday, August 23, 2018 at 2:35:04 AM UTC-4, ruban bharath wrote:
>
> Hi these are my tables
>
> music_name = char(username),userId(int)
>
> meaning = char(meaning),userid(int)
>
> i have used the join to merge this
>
> db = sqlite3.connect('db.sqlite3')
> cursor = db.cursor()
>
> cursor.execute('\n'
>
>'INSERT INTO  music_result SELECT username, meaning 
> ,NULL\n'
>
>'FROM music_name N JOIN music_sample1 T ON N.userid = 
> T.userid \n')
> db.commit()
>
> when i tried to do this i got an error like
>
> *sqlite3.IntegrityError: datatype mismatch*
>
> please do help me to solve this 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 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/10a3aec5-bf81-4524-9f3a-5d6534ada51e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: wagtailsettings' is not a registered namespace

2018-08-23 Thread TimT Vogt
In searched for wagtail settings and could not find
It. I have installed the Working demo and could not yet find the differeces
Tim

Verstuurd vanaf mijn iPhone

> Op 23 aug. 2018 om 07:36 heeft gilwell muhati  het 
> volgende geschreven:
> 
> Good morning @Tim did you solve this? 
> 
> wagtailsettings is a registed app perhaps and the app_name='wagtailsettings' 
> has not been initialised or the namespace on urls has not been called,kindly 
> check on using namespaces on paths and urls
> 
> Regards,
> 
> Gilwell Muhati | +254 710 739 116 |
> ~~“The mind is its own place and in itself can make a heaven of hell, a hell 
> of heaven…”~~John Milton
> 
> 
>> On Thu, Aug 23, 2018 at 1:29 AM Tim Vogt (Tim Vogt)  
>> wrote:
>> I am working on this demo
>> https://snipcart.com/blog/django-ecommerce-tutorial-wagtail-cms
>> 
>> 
>> and get the error below 
>> Any help? Because I could not find the error
>> 
>> Tim
>> 
>> NoReverseMatch at /admin/login/
>> 'wagtailsettings' is not a registered namespace
>> Request Method:  GET
>> Request URL: http://localhost:8000/admin/login/?next=/admin/
>> Django Version:  2.0.7
>> Exception Type:  NoReverseMatch
>> Exception Value: 
>> 'wagtailsettings' is not a registered namespace
>> Exception Location:  
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/urls/base.py
>>  in reverse, line 86
>> Python Executable:   
>> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
>> Python Version:  3.6.5
>> Python Path: 
>> ['/Users/timvogt/Software_learn_to_code_projects/snipcartwagtaildemo',
>>  '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip',
>>  '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6',
>>  
>> '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload',
>>  '/Users/timvogt/Library/Python/3.6/lib/python/site-packages',
>>  
>> '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages']
>> Server time: Wed, 22 Aug 2018 22:25:30 +
>> Error during template rendering
>> 
>> In template 
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/wagtail/admin/templates/wagtailadmin/skeleton.html,
>>  error at line 0
>> 'wagtailsettings' is not a registered namespace
>> 1
>> 2{% load staticfiles i18n %}
>> 3
>> 4
>> 5
>> 6Wagtail - {% block titletag %}{% endblock %}
>> 7
>> 8
>> 9
>> 10   
>> Traceback Switch to copy-and-paste view
>> 
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/urls/base.py
>>  in reverse
>> extra, resolver = resolver.namespace_dict[ns] ...
>> ▶ Local vars
>> During handling of the above exception ('wagtailsettings'), another 
>> exception occurred:
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/exception.py
>>  in inner
>> response = get_response(request) ...
>> ▶ Local vars
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/base.py
>>  in _get_response
>> response = self.process_exception_by_middleware(e, request) 
>> ...
>> ▶ Local vars
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/base.py
>>  in _get_response
>> response = response.render() ...
>> ▶ Local vars
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/response.py
>>  in render
>> self.content = self.rendered_content ...
>> ▶ Local vars
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/response.py
>>  in rendered_content
>> content = template.render(context, self._request) ...
>> ▶ Local vars
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/backends/django.py
>>  in render
>> return self.template.render(context) ...
>> ▶ Local vars
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/base.py
>>  in render
>> return self._render(context) ...
>> ▶ Local vars
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/base.py
>>  in _render
>> return self.nodelist.render(context) ...
>> ▶ Local vars
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/base.py
>>  in render
>> bit = node.render_annotated(context) ...
>> ▶ Local vars
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/base.py
>>  in render_annotated
>> return self.render(context) ...
>> ▶ Local vars
>> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/loader_tags.py
>>  in render
>> return 

Re: django sqlite3 error

2018-08-23 Thread Jason
What C. Kirby said.

I don't see any use of django in this question, and if you are interested 
in using it, I would look at the tutorial in the documentation for an 
introduction to the ORM.

-- 
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/b7919388-f17f-4d0d-8400-fcf5fb519592%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django sqlite3 error

2018-08-23 Thread C. Kirby
You are not using django anywhere in this question. I would send this to a 
python or sqlite group

On Thursday, August 23, 2018 at 2:35:04 AM UTC-4, ruban bharath wrote:
>
> Hi these are my tables
>
> music_name = char(username),userId(int)
>
> meaning = char(meaning),userid(int)
>
> i have used the join to merge this
>
> db = sqlite3.connect('db.sqlite3')
> cursor = db.cursor()
>
> cursor.execute('\n'
>
>'INSERT INTO  music_result SELECT username, meaning 
> ,NULL\n'
>
>'FROM music_name N JOIN music_sample1 T ON N.userid = 
> T.userid \n')
> db.commit()
>
> when i tried to do this i got an error like
>
> *sqlite3.IntegrityError: datatype mismatch*
>
> please do help me to solve this 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 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/fc1fee9b-d625-4f30-b5ff-dc14022090fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: template tag help please?

2018-08-23 Thread Tosin Ayoola
this is the link https://github.com/olaneat/ask_the_schools will rili b
glad if u can help


On Thu, Aug 23, 2018 at 2:31 PM Tosin Ayoola  wrote:

> i have the code on git actually because i'm trying to get the add a file
> at the admin page but i'm getting the error
>
>
> On Thu, Aug 23, 2018 at 2:17 PM ireoluwa fakeye  wrote:
>
>> Sorry didn't look at it well ,can I see a screen shot of your code
>>
>> On Thu, 23 Aug 2018, 14:10 Tosin Ayoola,  wrote:
>>
>>> not properly routing my urls as in, i don't understand
>>>
>>> On Thu, Aug 23, 2018 at 2:06 PM ireoluwa fakeye 
>>> wrote:
>>>
 You Are not properly routing your  urls

 On Thu, 23 Aug 2018, 14:03 Tosin Ayoola, 
 wrote:

> good day please i'm having issues, attached below is one of the error
> i'm getting also ive been trying to add bootstrap glyphicon to my project
> but it just display the text without the glyphicon,
>
> On Fri, Aug 17, 2018 at 12:54 PM MikeKJ 
> wrote:
>
>> I want to pass 2 variables to a templatetag from within a template, a
>> name and a date (eg, John 29/09/2018) to output the result of the
>> templatetag def.
>>
>> The reason I want to do this is:
>>
>> From a list of all names:
>>
>> The name comes from a model that has a foreign key to another model
>> that has actions performed by that name by date and I want to output the
>> action taken on that date so something like:
>>
>> from django import template
>> from django.conf import settings
>> from django.utils.html import escape
>> from user.models import person
>> from action.models import data
>>
>> def (get_action):
>> action = Data.objects.get.filter(person=name).filter(date=date)
>> return action
>>
>> but how do I pass the variables in the 1st place 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 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/8d7b9f60-9f88-41c6-8fec-cf858d7e6574%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/CAHLKn714iMAzyE%3DaXn_tyJQos-xLWPrWS6BEfFq013%3DS-rmShA%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/CAO87g13Nmssbp_VPv6ktJmpRrSOasusm%2BvPnDhKGZe_o9yBZ%2BQ%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/CAHLKn70NnEcJLNH5-8nnc%2B90TaTx3iqCiXuiVAdd6xop_teX7g%40mail.gmail.com
>>> 

Re: template tag help please?

2018-08-23 Thread Tosin Ayoola
i have the code on git actually because i'm trying to get the add a file at
the admin page but i'm getting the error


On Thu, Aug 23, 2018 at 2:17 PM ireoluwa fakeye  wrote:

> Sorry didn't look at it well ,can I see a screen shot of your code
>
> On Thu, 23 Aug 2018, 14:10 Tosin Ayoola,  wrote:
>
>> not properly routing my urls as in, i don't understand
>>
>> On Thu, Aug 23, 2018 at 2:06 PM ireoluwa fakeye 
>> wrote:
>>
>>> You Are not properly routing your  urls
>>>
>>> On Thu, 23 Aug 2018, 14:03 Tosin Ayoola,  wrote:
>>>
 good day please i'm having issues, attached below is one of the error
 i'm getting also ive been trying to add bootstrap glyphicon to my project
 but it just display the text without the glyphicon,

 On Fri, Aug 17, 2018 at 12:54 PM MikeKJ 
 wrote:

> I want to pass 2 variables to a templatetag from within a template, a
> name and a date (eg, John 29/09/2018) to output the result of the
> templatetag def.
>
> The reason I want to do this is:
>
> From a list of all names:
>
> The name comes from a model that has a foreign key to another model
> that has actions performed by that name by date and I want to output the
> action taken on that date so something like:
>
> from django import template
> from django.conf import settings
> from django.utils.html import escape
> from user.models import person
> from action.models import data
>
> def (get_action):
> action = Data.objects.get.filter(person=name).filter(date=date)
> return action
>
> but how do I pass the variables in the 1st place 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 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/8d7b9f60-9f88-41c6-8fec-cf858d7e6574%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/CAHLKn714iMAzyE%3DaXn_tyJQos-xLWPrWS6BEfFq013%3DS-rmShA%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/CAO87g13Nmssbp_VPv6ktJmpRrSOasusm%2BvPnDhKGZe_o9yBZ%2BQ%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/CAHLKn70NnEcJLNH5-8nnc%2B90TaTx3iqCiXuiVAdd6xop_teX7g%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
> 

Re: template tag help please?

2018-08-23 Thread ireoluwa fakeye
Sorry didn't look at it well ,can I see a screen shot of your code

On Thu, 23 Aug 2018, 14:10 Tosin Ayoola,  wrote:

> not properly routing my urls as in, i don't understand
>
> On Thu, Aug 23, 2018 at 2:06 PM ireoluwa fakeye  wrote:
>
>> You Are not properly routing your  urls
>>
>> On Thu, 23 Aug 2018, 14:03 Tosin Ayoola,  wrote:
>>
>>> good day please i'm having issues, attached below is one of the error
>>> i'm getting also ive been trying to add bootstrap glyphicon to my project
>>> but it just display the text without the glyphicon,
>>>
>>> On Fri, Aug 17, 2018 at 12:54 PM MikeKJ  wrote:
>>>
 I want to pass 2 variables to a templatetag from within a template, a
 name and a date (eg, John 29/09/2018) to output the result of the
 templatetag def.

 The reason I want to do this is:

 From a list of all names:

 The name comes from a model that has a foreign key to another model
 that has actions performed by that name by date and I want to output the
 action taken on that date so something like:

 from django import template
 from django.conf import settings
 from django.utils.html import escape
 from user.models import person
 from action.models import data

 def (get_action):
 action = Data.objects.get.filter(person=name).filter(date=date)
 return action

 but how do I pass the variables in the 1st place 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 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/8d7b9f60-9f88-41c6-8fec-cf858d7e6574%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/CAHLKn714iMAzyE%3DaXn_tyJQos-xLWPrWS6BEfFq013%3DS-rmShA%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/CAO87g13Nmssbp_VPv6ktJmpRrSOasusm%2BvPnDhKGZe_o9yBZ%2BQ%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/CAHLKn70NnEcJLNH5-8nnc%2B90TaTx3iqCiXuiVAdd6xop_teX7g%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 

Re: Upgrading app with settings-dependent migrations

2018-08-23 Thread Tim Graham
I think that https://code.djangoproject.com/ticket/24648 describes your 
issue.

On Thursday, August 23, 2018 at 7:30:33 AM UTC-4, Jan Musílek wrote:
>
> Hi! 
>
> I have a problem with migrations workflow for which I couldn't find an 
> answer anywhere else. 
>
> Suppose, that I have an application MYAPP, that uses some third-party 
> apps. These third-party apps require running `makemigrations` command 
> after adding them to INSTALLED_APPS, because their migrations depend on 
> settings and therefore can't be distributed right away. 
>
> I.e. take `django-modeltranslation` whose migrations depends on 
> `LANGUAGES` setting or `django-money` whose migrations depends on 
> `CURRENCIES` setting. 
>
> If I was the only user of MYAPP, I would just generate these migrations 
> depending on my settings and that would be it. What's important that 
> these migrations belong to application MYAPP, not to third-party apps. 
>
> But, I also want to distribute my application MYAPP to other users. I 
> don't know what they settings will look like, so they'll also need to 
> generate their own migrations. 
>
> Now, I release new version of MYAPP. This version may contain some MYAPP 
> models related migrations. How should the other users proceed to upgrade 
> MYAPP to new version and still retain their settings-dependent migrations? 
>
> Is there any straightforward elegant solution? Or at least some 
> nasty/ugly agreed upon "standard" solution? I can't believe that I'm the 
> only one who has this problem. 
>
> Regards, 
> JM 
>

-- 
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/357cbbd1-e0c0-492c-9f03-c7d2aaad5d58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: template tag help please?

2018-08-23 Thread Tosin Ayoola
not properly routing my urls as in, i don't understand

On Thu, Aug 23, 2018 at 2:06 PM ireoluwa fakeye  wrote:

> You Are not properly routing your  urls
>
> On Thu, 23 Aug 2018, 14:03 Tosin Ayoola,  wrote:
>
>> good day please i'm having issues, attached below is one of the error i'm
>> getting also ive been trying to add bootstrap glyphicon to my project but
>> it just display the text without the glyphicon,
>>
>> On Fri, Aug 17, 2018 at 12:54 PM MikeKJ  wrote:
>>
>>> I want to pass 2 variables to a templatetag from within a template, a
>>> name and a date (eg, John 29/09/2018) to output the result of the
>>> templatetag def.
>>>
>>> The reason I want to do this is:
>>>
>>> From a list of all names:
>>>
>>> The name comes from a model that has a foreign key to another model that
>>> has actions performed by that name by date and I want to output the action
>>> taken on that date so something like:
>>>
>>> from django import template
>>> from django.conf import settings
>>> from django.utils.html import escape
>>> from user.models import person
>>> from action.models import data
>>>
>>> def (get_action):
>>> action = Data.objects.get.filter(person=name).filter(date=date)
>>> return action
>>>
>>> but how do I pass the variables in the 1st place 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 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/8d7b9f60-9f88-41c6-8fec-cf858d7e6574%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/CAHLKn714iMAzyE%3DaXn_tyJQos-xLWPrWS6BEfFq013%3DS-rmShA%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/CAO87g13Nmssbp_VPv6ktJmpRrSOasusm%2BvPnDhKGZe_o9yBZ%2BQ%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/CAHLKn70NnEcJLNH5-8nnc%2B90TaTx3iqCiXuiVAdd6xop_teX7g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: template tag help please?

2018-08-23 Thread ireoluwa fakeye
You Are not properly routing your  urls

On Thu, 23 Aug 2018, 14:03 Tosin Ayoola,  wrote:

> good day please i'm having issues, attached below is one of the error i'm
> getting also ive been trying to add bootstrap glyphicon to my project but
> it just display the text without the glyphicon,
>
> On Fri, Aug 17, 2018 at 12:54 PM MikeKJ  wrote:
>
>> I want to pass 2 variables to a templatetag from within a template, a
>> name and a date (eg, John 29/09/2018) to output the result of the
>> templatetag def.
>>
>> The reason I want to do this is:
>>
>> From a list of all names:
>>
>> The name comes from a model that has a foreign key to another model that
>> has actions performed by that name by date and I want to output the action
>> taken on that date so something like:
>>
>> from django import template
>> from django.conf import settings
>> from django.utils.html import escape
>> from user.models import person
>> from action.models import data
>>
>> def (get_action):
>> action = Data.objects.get.filter(person=name).filter(date=date)
>> return action
>>
>> but how do I pass the variables in the 1st place 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 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/8d7b9f60-9f88-41c6-8fec-cf858d7e6574%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/CAHLKn714iMAzyE%3DaXn_tyJQos-xLWPrWS6BEfFq013%3DS-rmShA%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/CAO87g13Nmssbp_VPv6ktJmpRrSOasusm%2BvPnDhKGZe_o9yBZ%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Concerning CVE-2018-14574: is there a open redirect possibility in CommonMiddleware of version 1.9.5

2018-08-23 Thread Tim Graham
I didn't confirm it but according to the comments at the bottom of 
https://github.com/django/django/commit/a656a681272f8f3734b6eb38e9a88aa0d91806f1,
 
Django 1.9 and later are affected.

On Thursday, August 23, 2018 at 7:30:51 AM UTC-4, Christophe Dupouy wrote:
>
> I understand that per your supported versions policy, Django 1.10 and 
> older are no longer supported.
> But can you indicated me if there is an open redirect possibility in 
> CommonMiddleware of version 1.9.5.
> If not affected, I want to avoid to have to find ressources (money and 
> people) to perform a specific non-regression tests of my solution to 
> upgrade to django security releases 1.11.15.
>

-- 
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/9c1bed60-e995-4b93-aade-afef87577fbf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Foreign key issue

2018-08-23 Thread Akshay Jain
Thanks Jason, fair point.

On Tue, Aug 21, 2018 at 5:37 PM Jason  wrote:

> If you think about it, you might see why you could do this, but you'd lose
> everything related to referential integrity.  Nothing stopping you from
> making a router that behind the scenes uses multiple dbs seamlessly, but
> how would you handle changes from the other db in your own if you can't get
> notified of updates or deletes?  THat way, your own data can get very out
> of sync with the other db.
>
>
> --
> 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/d9623fee-54bd-42d9-adf0-49ae184c3619%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Regards,
Akshay Jain

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


Re: Insert values in python manage.py shell using custom sql

2018-08-23 Thread 'Vinod Kumar' via Django users
By default model have id column , so you have to put value of id.

On Thu, Aug 23, 2018, 5:00 PM Vishak Raj  wrote:

> hello,
>
> i am inserting the values in the table using custome sql in django shell..
>
> p.execute('INSERT INTO webapp_information 
> VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)',i)
>
> i is the list of values
>
> it shows the error:OperationalError: table webapp_information has 32 columns 
> but 31 values were supplied
>
> I created the only 31 columns in models.py
>
>
> What to do.. 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/10ad145e-5e0b-4d52-a8c9-54af6fa69fba%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 









This e-mail and all attachments are intended solely for use by
the intended 
recipient and may contain confidential / proprietary information
of 
KiwiTech, LLC, subject to important disclaimers and conditions including

restrictions on the use, disclosure, transfer or export of such 
information. If you have received this
message in error or are not the 
named recipient(s), please immediately notify
the sender at the telephone 
number stated above or by reply e-mail and delete
this e-mail from your 
computer





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


Concerning CVE-2018-14574: is there a open redirect possibility in CommonMiddleware of version 1.9.5

2018-08-23 Thread Christophe Dupouy
I understand that per your supported versions policy, Django 1.10 and older 
are no longer supported.
But can you indicated me if there is an open redirect possibility in 
CommonMiddleware of version 1.9.5.
If not affected, I want to avoid to have to find ressources (money and 
people) to perform a specific non-regression tests of my solution to 
upgrade to django security releases 1.11.15.

-- 
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/983bdb1b-171d-4024-9178-7034f8fd2464%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Insert values in python manage.py shell using custom sql

2018-08-23 Thread Vishak Raj
hello,

i am inserting the values in the table using custome sql in django shell..

p.execute('INSERT INTO webapp_information 
VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)',i)

i is the list of values

it shows the error:OperationalError: table webapp_information has 32 columns 
but 31 values were supplied

I created the only 31 columns in models.py


What to do.. 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/10ad145e-5e0b-4d52-a8c9-54af6fa69fba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: wagtailsettings' is not a registered namespace

2018-08-23 Thread gilwell muhati
Good morning @Tim did you solve this?

wagtailsettings is a registed app perhaps and the
app_name='wagtailsettings' has not been initialised or the namespace
on urls has not been called,kindly check on using namespaces on paths
and urls





*Regards,Gilwell Muhati | +254 710 739 116 | *
*~~“The mind is its own place and in itself can make a heaven of hell, a
hell of heaven…”~~John Milton *


On Thu, Aug 23, 2018 at 1:29 AM Tim Vogt (Tim Vogt) 
wrote:

> I am working on this demo
> https://snipcart.com/blog/django-ecommerce-tutorial-wagtail-cms
>
>
> and get the error below
> Any help? Because I could not find the error
>
> Tim
>
> NoReverseMatch at /admin/login/
>
> 'wagtailsettings' is not a registered namespace
>
> Request Method: GET
> Request URL: http://localhost:8000/admin/login/?next=/admin/
> Django Version: 2.0.7
> Exception Type: NoReverseMatch
> Exception Value:
>
> 'wagtailsettings' is not a registered namespace
>
> Exception Location: 
> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/urls/base.py
> in reverse, line 86
> Python Executable:
> /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
> Python Version: 3.6.5
> Python Path:
>
> ['/Users/timvogt/Software_learn_to_code_projects/snipcartwagtaildemo',
>  '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip',
>  '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6',
>  
> '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload',
>  '/Users/timvogt/Library/Python/3.6/lib/python/site-packages',
>  
> '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages']
>
> Server time: Wed, 22 Aug 2018 22:25:30 +
> Error during template rendering
> In template
> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/wagtail/admin/templates/wagtailadmin/skeleton.html,
> error at line *0*
> 'wagtailsettings' is not a registered namespace
> 1 
> 2 {% load staticfiles i18n %}
> 3 
> 4 
> 5 
> 6 Wagtail - {% block titletag %}{% endblock %}
> 7 
> 8  />
> 9
> 10 
> Traceback Switch to copy-and-paste view
> 
>
>-
>
> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/urls/base.py
> in reverse
>1.
>
>   extra, resolver = resolver.namespace_dict[ns]
>
>   ...
>▶ Local vars 
>- During handling of the above exception ('wagtailsettings'), another
>exception occurred:
>-
>
> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/exception.py
> in inner
>1.
>
>   response = get_response(request)
>
>   ...
>▶ Local vars 
>-
>
> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/base.py
> in _get_response
>1.
>
>   response = self.process_exception_by_middleware(e, 
> request)
>
>   ...
>▶ Local vars 
>-
>
> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/base.py
> in _get_response
>1.
>
>   response = response.render()
>
>   ...
>▶ Local vars 
>-
>
> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/response.py
> in render
>1.
>
>   self.content = self.rendered_content
>
>   ...
>▶ Local vars 
>-
>
> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/response.py
> in rendered_content
>1.
>
>   content = template.render(context, self._request)
>
>   ...
>▶ Local vars 
>-
>
> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/backends/django.py
> in render
>1.
>
>   return self.template.render(context)
>
>   ...
>▶ Local vars 
>-
>
> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/base.py
> in render
>1.
>
>   return self._render(context)
>
>   ...
>▶ Local vars 
>-
>
> /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/template/base.py
> in _render
>1.
>
>   return self.nodelist.render(context)
>
>   ...
>▶ Local vars 
>-
>
> 

Upgrading app with settings-dependent migrations

2018-08-23 Thread Jan Musílek
Hi!

I have a problem with migrations workflow for which I couldn't find an
answer anywhere else.

Suppose, that I have an application MYAPP, that uses some third-party
apps. These third-party apps require running `makemigrations` command
after adding them to INSTALLED_APPS, because their migrations depend on
settings and therefore can't be distributed right away.

I.e. take `django-modeltranslation` whose migrations depends on
`LANGUAGES` setting or `django-money` whose migrations depends on
`CURRENCIES` setting.

If I was the only user of MYAPP, I would just generate these migrations
depending on my settings and that would be it. What's important that
these migrations belong to application MYAPP, not to third-party apps.

But, I also want to distribute my application MYAPP to other users. I
don't know what they settings will look like, so they'll also need to
generate their own migrations.

Now, I release new version of MYAPP. This version may contain some MYAPP
models related migrations. How should the other users proceed to upgrade
MYAPP to new version and still retain their settings-dependent migrations?

Is there any straightforward elegant solution? Or at least some
nasty/ugly agreed upon "standard" solution? I can't believe that I'm the
only one who has this problem.

Regards,
JM

-- 
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/9666391b-093d-2ae9-2cae-3a3b58db87e7%40nic.cz.
For more options, visit https://groups.google.com/d/optout.


RE: template tag help please?

2018-08-23 Thread Mike Jones
Andreas,  

Thank you for your help and patience I have got the damned thing working!!  

It helped that I remembered that one of the filter arguments was actually a 
foreign key in the model and had to be an integer id not a string,  that was 
being obfuscated by being a templatetag call.

 

Thank you

 

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Andréas Kühne
Sent: 23 August 2018 08:15
To: django-users@googlegroups.com
Subject: Re: template tag help please?

 

Yes - but you still are doing it strange - you shouldn't use kwargs if you are 
sending the parameters and have the parameters in the function - use the 
parameters.

 

In other words: 

avn = kwargs['avn']

avd = kwargs['avd']

name = kwargs['name']

 

That is unnecessary




Regards,

 

Andréas

 

 

Den ons 22 aug. 2018 kl 16:55 skrev Mike Jones :

Ah I was just doing that to prove it was working

 

This is the actual tag

 

from django import template

from django.conf import settings

from django.utils.html import escape

from band.models import Data

 

register = template.Library()

 

@register.simple_tag

def do_cost( name, avn, avd, *args, **kwargs ):

avn = kwargs['avn']

avd = kwargs['avd']

name = kwargs['name']

val_set = Data.objects.filter(prop = name).filter(date_period=avd)

avn = 7  #this line is just for testing

if avn >= 7:

for x in val_set:

val = x.full

else:

for x in val_set:

val = x.short

return val

 

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Andréas Kühne
Sent: 22 August 2018 15:20
To: django-users@googlegroups.com
Subject: Re: template tag help please?

 

Wait a secound, you are doing some very strange things

 

I didn't see this before.

 

You have defined the following:

@register.simple_tag
def do_cost( name, avn, avd, *args, **kwargs ):
avn = kwargs['avn']
avd = kwargs['avd']
name = kwargs['name']
return name

 

The method has 3 parameters that you are sending to it - name, avn and avd. 
They correspond to the values sent to the method in order. So you don't need to 
use the kwargs dictionary - it's unnecessary...

You could just write:

@register.simple_tag
def do_cost( name, avn, avd, *args, **kwargs ):
return name




Beacause you have sent the name to the method?

 

Regards,

 

Andréas

 

 

Den ons 22 aug. 2018 kl 16:09 skrev MikeKJ :

Thank you Andreas Kuhne, progress

 

So this {% load get_cost %}{% do_cost b.name avn avd %} was working quite 
happily but for some reason is now complaining 

 


Exception Type:

TemplateSyntaxError


 Exception Value:

Caught KeyError while rendering: 'avn'

 

Exception Location claims to beget_cost.py in do_cost, line 10  which is 
avn = kwargs['avn']

 

but the exception is in the template line {% load get_cost %}{% do_cost b.name 
avn avd %}

 

 

 

-- 
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/8d9d18dd-c8cb-494c-a2b8-8b06b64c40d3%40googlegroups.com
 

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

-- 
You received this message because you are subscribed to a topic in the Google 
Groups "Django users" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/django-users/zG3S_9BQKMY/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/CAK4qSCcnJzyrWXGjTyF9NZAc0SE6zxQ1gbrd1ZM2Oc%2B3ZL_tyQ%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 

Re: Geographical location filter app in Django

2018-08-23 Thread Christian Ledermann
Go with geo django, postgis will accelerate these kind of lookups with
indices.
https://stackoverflow.com/questions/19703975/django-sort-by-distance/35896358#35896358

On Thu, 23 Aug 2018 at 09:04, Benjamin Smith 
wrote:

> I would like to create a market place like app with Djano as the backend
> server, where users can buy/sell items. In the app I would like have to a
> feature related to geographic region of a user. Such as, to filter out
> items in a given specific miles of radius.
>
> Example use case:
>
>- User uploads an item, get the gps cordinates from their mobile and
>store in db.
>- User can search item, also filter to only get items in X miles
>radius.
>
>
> For this feature
>
>1. I have looked at GeoDjango. But it seems like I need to extend the
>postgresql database to use it, also by using the postgis engine.
>2. I have also looked at the Haversine formula for nearby queries.
>3. There is also an option for multiple database support.
>
>
> But I have some initial doubts before proceeding and your insights would
> really help me alot. Could you please help me with this queries:
>
>1. I will have to store user data and some other data including the
>geo location. Will there be any difference/side effects between
>postgresql_psycopg2 and postgis, to store all the data in one single db?
>2. For my simple use case would you rather prefer to go with the
>Haversine formula? Or integrating GeoDjango will help me lot in the future?
>3. Or having a multiple database support be better for me or it will
>be an over head?
>
> --
> 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/CAM4YLW%2B%2BOS%2B6JqJW5Bs211FHAHo3n6F9sHW0B%2BeN%3DPE4OEGR9g%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Best Regards,

Christian Ledermann

Newark-on-Trent - UK
Mobile : +44 7474997517

https://uk.linkedin.com/in/christianledermann
https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>

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


Geographical location filter app in Django

2018-08-23 Thread Benjamin Smith
I would like to create a market place like app with Djano as the backend
server, where users can buy/sell items. In the app I would like have to a
feature related to geographic region of a user. Such as, to filter out
items in a given specific miles of radius.

Example use case:

   - User uploads an item, get the gps cordinates from their mobile and
   store in db.
   - User can search item, also filter to only get items in X miles radius.


For this feature

   1. I have looked at GeoDjango. But it seems like I need to extend the
   postgresql database to use it, also by using the postgis engine.
   2. I have also looked at the Haversine formula for nearby queries.
   3. There is also an option for multiple database support.


But I have some initial doubts before proceeding and your insights would
really help me alot. Could you please help me with this queries:

   1. I will have to store user data and some other data including the geo
   location. Will there be any difference/side effects between
   postgresql_psycopg2 and postgis, to store all the data in one single db?
   2. For my simple use case would you rather prefer to go with the
   Haversine formula? Or integrating GeoDjango will help me lot in the future?
   3. Or having a multiple database support be better for me or it will be
   an over head?

-- 
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/CAM4YLW%2B%2BOS%2B6JqJW5Bs211FHAHo3n6F9sHW0B%2BeN%3DPE4OEGR9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: template tag help please?

2018-08-23 Thread Andréas Kühne
Yes - but you still are doing it strange - you shouldn't use kwargs if you
are sending the parameters and have the parameters in the function - use
the parameters.

In other words:

avn = kwargs['avn']

avd = kwargs['avd']

name = kwargs['name']


That is unnecessary

Regards,

Andréas


Den ons 22 aug. 2018 kl 16:55 skrev Mike Jones :

> Ah I was just doing that to prove it was working
>
>
>
> This is the actual tag
>
>
>
> from django import template
>
> from django.conf import settings
>
> from django.utils.html import escape
>
> from band.models import Data
>
>
>
> register = template.Library()
>
>
>
> @register.simple_tag
>
> def do_cost( name, avn, avd, *args, **kwargs ):
>
> avn = kwargs['avn']
>
> avd = kwargs['avd']
>
> name = kwargs['name']
>
> val_set = Data.objects.filter(prop = name).filter(date_period=avd)
>
> avn = 7  #this line is just for testing
>
> if avn >= 7:
>
> for x in val_set:
>
> val = x.full
>
> else:
>
> for x in val_set:
>
> val = x.short
>
> return val
>
>
>
> *From:* django-users@googlegroups.com [mailto:
> django-users@googlegroups.com] *On Behalf Of *Andréas Kühne
> *Sent:* 22 August 2018 15:20
> *To:* django-users@googlegroups.com
> *Subject:* Re: template tag help please?
>
>
>
> Wait a secound, you are doing some very strange things
>
>
>
> I didn't see this before.
>
>
>
> You have defined the following:
>
> @register.simple_tag
> def do_cost( name, avn, avd, *args, **kwargs ):
> avn = kwargs['avn']
> avd = kwargs['avd']
> name = kwargs['name']
> return name
>
>
>
> The method has 3 parameters that you are sending to it - name, avn and
> avd. They correspond to the values sent to the method in order. So you
> don't need to use the kwargs dictionary - it's unnecessary...
>
> You could just write:
>
> @register.simple_tag
> def do_cost( name, avn, avd, *args, **kwargs ):
> return name
>
>
> Beacause you have sent the name to the method?
>
>
>
> Regards,
>
>
>
> Andréas
>
>
>
>
>
> Den ons 22 aug. 2018 kl 16:09 skrev MikeKJ :
>
> Thank you Andreas Kuhne, progress
>
>
>
> So this {% load get_cost %}{% do_cost b.name avn avd %} was working quite
> happily but for some reason is now complaining
>
>
>
> *Exception Type:*
>
> TemplateSyntaxError
>
> * Exception Value:*
>
> Caught KeyError while rendering: 'avn'
>
>
>
> Exception Location claims to beget_cost.py in do_cost, line 10  which
> is avn = kwargs['avn']
>
>
>
> but the exception is in the template line {% load get_cost %}{% do_cost
> b.name avn avd %}
>
>
>
>
>
>
>
> --
> 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/8d9d18dd-c8cb-494c-a2b8-8b06b64c40d3%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/zG3S_9BQKMY/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/CAK4qSCcnJzyrWXGjTyF9NZAc0SE6zxQ1gbrd1ZM2Oc%2B3ZL_tyQ%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/5b7d7953.1c69fb81.85c08.097dSMTPIN_ADDED_BROKEN%40gmr-mx.google.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because 

Re: How to delete least recently used not expired django sessions?

2018-08-23 Thread Web Architect
Hi,

Thanks for the approach. On our site, customers have option to do guest 
checkout wherein users can make a purchase without getting 
registered/signing up. We are still using session information for such 
users. Hence, the session is kind of combined for logged in and not logged 
in users. The challenge is to figured out the sessions for logged in users 
(atleast I am not aware of how to do that in Django).  
Typically in businesses, users (specifically the masses and who aren't that 
tech savvy) prefer a flow that's smooth and hassle free though security 
definitely becomes an important aspect. Hence, the challenge is to combine 
the both.

I would certainly look into the approach you have suggested. 

Thanks. 

On Monday, August 20, 2018 at 2:08:30 PM UTC+5:30, Michal Petrucha wrote:
>
> -BEGIN PGP SIGNED MESSAGE- 
> Hash: SHA512 
>
> On Fri, Aug 17, 2018 at 05:44:22AM -0700, Web Architect wrote: 
> > Hi, 
> > 
> > We are using persistent django sessions for our website where in the 
> > session information is stored in MySQL. Over last couple of years, the 
> > session data has grown to a huge number and we were planning to clean it 
> up. 
> > I know that there is a django management command 'clearsessions' and we 
> are 
> > using the same as a daily cronjob. 
> > But our challenge is we have long expiry timelines of like 100 years so 
> > that our users are never logged out (unless they clear their cookies 
> etc). 
> > Hence, the clearsessions won't help. 
> > 
> > The solution we are looking for are removing the sessions which are 
> never 
> > used for a long period. Let's say a user never came to our site for 3 
> > months after last logging in. We would like to purge those sessions. 
> Would 
> > really appreciate if anyone could suggest any such solution - be it in 
> > Django or if we need to custom build it. 
> > 
> > Thanks. 
>
> There is another de-facto standard solution to this problem, which 
> does not involve setting the session expiry to years – it's usually 
> referred to as “persistent authentication cookie”. That way, sessions 
> would expire after the usual short period of time, and it also makes 
> the persistent login feature optional for your users. 
>
> I haven't found a maintained package that would implement this for 
> Django applications, but you can find a bunch of material on this 
> topic. For example, this article seems to consider a lot of potential 
> attack vectors: 
>
> https://paragonie.com/blog/2015/04/secure-authentication-php-with-long-term-persistence#title.2
>  
>
> Michal 
> -BEGIN PGP SIGNATURE- 
> Version: GnuPG v1 
>
> iQIcBAEBCgAGBQJben3lAAoJEHA7T/IPM/klRiMQAKnoqOWIrbQDiDcaARde9jl+ 
> SuPfHZP/H44t7z610+CC2D03C4hps+7acQWslH2S+WFL/+VUJPqytGTWsAJbs12A 
> /R+UaIlwDGFMeRBw2xdDusZtbE4t+atGS5PPgr8hEW89/op9/DruSed1cVxoUiBp 
> pwNwBst+cieNhtBYpXBUCe8mRxRegc8xCz/pKRw9ZycszYgB4rTpDVwOFMmxPWuS 
> rKDRgMsXhYQskiGWi5oSHQ8xEgxBeGXdv3HnlwCm9TenXs1gfVQwbRhG4btivCUD 
> nzhpUTtHx3PP5/uDK0GM87MqB6ufuf7H/7QXgFKTWBZxSeOXwaxICsxYaG54DMld 
> hYxFk36RtjufWgcffQooBfw3eavtzAnPdjlZzEI3ZYj5fPx9agGJf177JAVSCovS 
> bppF1QbipuIfQlLyv7gee8bR6a6uLEQZ4vp9NHrfqWjXYqmIDxubnVB5B1/d6yvG 
> S9liRlkoGAWC9tTS5ig03QV1b4nBlJIonKIRBecrfJXHw3G2WojY8HAiSyyz9A4P 
> S/XcvOzK7dWsw/NUmx84GkR3SGfFeQor3bVWUeBhG6BBOjZq6cj+MHa2gZswIIYa 
> d6dHRCa4hyDwBLZDaEbI4EDbIkrY82L87PD9KW+0xbBYojwysQz8pL/3WHc8F1NL 
> 0VXYCCnD/4/LdzywjR21 
> =njLP 
> -END PGP SIGNATURE- 
>

-- 
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/fbcb5b75-de8b-43fb-a47e-5232b1c95212%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to delete least recently used not expired django sessions?

2018-08-23 Thread Web Architect
Hi Avraham,

Thanks for the recommendation. Will take a look at the package. 

Thanks.

On Monday, August 20, 2018 at 1:00:03 PM UTC+5:30, Avraham Serour wrote:
>
> maybe something like this could be useful for your use case:
> https://pypi.org/project/django-session-timeout/
> it has an option for SESSION_EXPIRE_AFTER_LAST_ACTIVITY
>
>
> maybe this could also be useful for you: 
> https://django-session-security.readthedocs.io/en/latest/
>
>
>
> On Mon, Aug 20, 2018 at 8:34 AM Web Architect  > wrote:
>
>> Hi Jason,
>>
>> Thanks for your response.
>>
>> As mentioned in my earlier post...I have a long expiry date for the 
>> sessions (and hence, the cookies)  as we want our users to be always logged 
>> in or in session (till they clear their cookies). And that's what is 
>> causing the issue. 
>>
>> The goal is to keep the regular users logged in whereas flush out the non 
>> active users (even if their sessions haven't expired). Hence, was looking 
>> for a solution for the same. 
>>
>> Thanks.
>>
>> On Saturday, August 18, 2018 at 5:39:19 PM UTC+5:30, Jason wrote:
>>>
>>> With database sessions out of the box, no.
>>>
>>>
>>> https://github.com/django/django/blob/master/django/contrib/sessions/base_session.py
>>>
>>> You can see there are three attributes for a session model: key, data 
>>> and expire_date
>>>
>>> That said, since sessions are backed by browser cookies, django's 
>>> default is two weeks for session cookies as you can see at 
>>> https://docs.djangoproject.com/en/2.1/ref/settings/#std:setting-SESSION_COOKIE_AGE,
>>>  
>>> which are used here:  
>>> https://github.com/django/django/blob/master/django/contrib/sessions/backends/base.py#L225-L244
>>>
>>> So if you haven't altered that, all sessions expire in two weeks, and 
>>> you can just delete those expired sessions by using the clearsessions 
>>> management command 
>>> 
>>> .
>>>
>>> if you have changed that, then what Hemendra suggested above seems like 
>>> a reasonable approach, but one that is not backwards compatible if you 
>>> don't have a timestamp field for last access 
>>>
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/4794450f-ad83-4a00-96e3-f354745b322b%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/c8c48fbf-e381-4867-ba7b-94e62c7dce1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django sqlite3 error

2018-08-23 Thread ruban bharath


Hi these are my tables

music_name = char(username),userId(int)

meaning = char(meaning),userid(int)

i have used the join to merge this

db = sqlite3.connect('db.sqlite3')
cursor = db.cursor()

cursor.execute('\n'

   'INSERT INTO  music_result SELECT username, meaning 
,NULL\n'

   'FROM music_name N JOIN music_sample1 T ON N.userid = 
T.userid \n')
db.commit()

when i tried to do this i got an error like

*sqlite3.IntegrityError: datatype mismatch*

please do help me to solve this 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 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/fe247615-ee16-49ff-833f-590fc2f9d602%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.