Re: Using JavaScript to enumerate a dataset returned to a page.

2023-06-20 Thread Lee Stevens
So it is sounding more and more like I can't just send in a JSON object and 
then use JSON.parse to loop through the data.  Maybe I am missing something 
on the django side.  

Parsing on the JavaScript side is easy, but am I creating the variable 
{{dataset}} in the original message incorrectly?
On Monday, June 19, 2023 at 9:30:15 AM UTC-5 Lee Stevens wrote:

> Helo,
>
> I have a dataset returning to a page.  I need JavaScript to be able to 
> process this.
>
> Instead of using:
> {% for item in dataset %}
> {{ item.field1 }}
> {{ item.field2 }}
> {% endfor %}
>
> Is there a *JavaScript* way to read this dataset/variable instead?
>
> Thanks.
>

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


Using JavaScript to enumerate a dataset returned to a page.

2023-06-19 Thread Lee Stevens
Helo,

I have a dataset returning to a page.  I need JavaScript to be able to 
process this.

Instead of using:
{% for item in dataset %}
{{ item.field1 }}
{{ item.field2 }}
{% endfor %}

Is there a *JavaScript* way to read this dataset/variable instead?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/37febb44-36e2-47ca-9eff-7011c4e9b963n%40googlegroups.com.


Re: Can't use swagger in Django 4.0?

2022-03-06 Thread Emmanuel Lee
Self answer: After commenting out the urls in urls.py of the app in 
question, it worked normally.

2022년 3월 6일 일요일 오후 4시 41분 59초 UTC+9에 Emmanuel Lee님이 작성:

> Thanks for answering my question.  Below is my urls.py
> --
>
> from django.urls import path, include, re_path
>
> from drf_yasg.views import get_schema_view
>
> from drf_yasg import openapi
>
> from django.conf import settings
>
> from rest_framework.permissions import AllowAny
>
> from rest_framework import routers, permissions
>
>
>
> schema_view = get_schema_view(
>
> openapi.Info(
>
> title="project Title", 
>
> default_version='v1',
>
> description="",
>
> terms_of_service="https://www.google.com/policies/terms/;,
>
> contact=openapi.Contact(email="a...@a.com"),
>
> license=openapi.License(name=""),
>
> ),
>
> validators=['flex'],
>
> public=True,
>
> permission_classes=(AllowAny,)
>
> )
>
>
>
> urlpatterns = [
>
> path(r'swagger(?P\.json|\.yaml)', 
> schema_view.without_ui(cache_timeout=0), name='schema-json'),
>
> path(r'swagger', schema_view.with_ui('swagger', cache_timeout=0), 
> name='schema-swagger-ui'),
>
> path(r'redoc', schema_view.with_ui('redoc', cache_timeout=0), 
> name='schema-redoc-v1'),
>
> # django app
>
>
>
> ]
> 2022년 3월 5일 토요일 오후 3시 25분 50초 UTC+9에 adigun...@gmail.com님이 작성:
>
>> You may need to show your urls.py to see what you are doing.
>>
>>
>> On Friday, March 4, 2022 at 3:04:46 PM UTC+1 astro...@gmail.com wrote:
>>
>>>
>>> hi everyone,
>>>
>>> After installing Django 4.0 and configuring swagger, 'TypeError: 'set' 
>>> object is not reversible' occurs. Is it possible that Django 4.0 can't use 
>>> swagger?
>>>
>>> error image 
>>> [image: z7jfF.png]
>>>
>>>
>>>

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


Re: Can't use swagger in Django 4.0?

2022-03-05 Thread Emmanuel Lee
Thanks for answering my question.  Below is my urls.py
--

from django.urls import path, include, re_path

from drf_yasg.views import get_schema_view

from drf_yasg import openapi

from django.conf import settings

from rest_framework.permissions import AllowAny

from rest_framework import routers, permissions



schema_view = get_schema_view(

openapi.Info(

title="project Title", 

default_version='v1',

description="",

terms_of_service="https://www.google.com/policies/terms/;,

contact=openapi.Contact(email="a...@a.com"),

license=openapi.License(name=""),

),

validators=['flex'],

public=True,

permission_classes=(AllowAny,)

)



urlpatterns = [

path(r'swagger(?P\.json|\.yaml)', 
schema_view.without_ui(cache_timeout=0), name='schema-json'),

path(r'swagger', schema_view.with_ui('swagger', cache_timeout=0), 
name='schema-swagger-ui'),

path(r'redoc', schema_view.with_ui('redoc', cache_timeout=0), 
name='schema-redoc-v1'),

# django app

   

]
2022년 3월 5일 토요일 오후 3시 25분 50초 UTC+9에 adigun...@gmail.com님이 작성:

> You may need to show your urls.py to see what you are doing.
>
>
> On Friday, March 4, 2022 at 3:04:46 PM UTC+1 astro...@gmail.com wrote:
>
>>
>> hi everyone,
>>
>> After installing Django 4.0 and configuring swagger, 'TypeError: 'set' 
>> object is not reversible' occurs. Is it possible that Django 4.0 can't use 
>> swagger?
>>
>> error image 
>> [image: z7jfF.png]
>>
>>
>>

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


How does django-admin work?

2021-05-31 Thread J Lee
I'm new to Django, and I've just been dazzled by the magic of Django. My 
main question is how does Django add django-admin to my path automatically 
and how does django-admin startproject create my files?

It may be wy over my head, but I welcome any and all response. I would 
like to learn from this. 

Thank you.

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


Re: Django/python free Training

2020-12-19 Thread Rg Lee
I am interested

Oyedele Yusuff  于 2020年12月20日周日 07:53写道:

> I'm interested
>
> On Fri, 18 Dec 2020 3:26 pm Python Class, 
> wrote:
>
>> Hi guys,
>>
>> I am manucho from Kenya and am good developer with django and python and
>> i want to teach people what i know .I want to start a youtube channel for
>> Django and python based tutorials ..If intrested you can message me here on
>> concepts and projects you want covered and i will start immediately.
>>
>> Regards,
>> Manucho.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/5c715780-23c4-4d31-9219-a1e7b92c14f1n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAmMZ-%3DHykFpNYci9ZXC_CGfj0xdLeYzeqtL2DCdrj%3DAe7UV5w%40mail.gmail.com
> 
> .
>

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


Re: Update _id field before .save() for ForeignKey

2019-11-29 Thread Charles Lee
 I have an idea.

   1. `bulk_create` all companies.
   2. `Filter`(SELECT) all `Company` and make it dictionary for retrieving 
   company fast.
   3. 
  1. company_dict = {
’Name’: ‘pk’,
...
  }
  4. Create a list of `CompanyValue` with company name and company_dict.
   5. `bulk_create` the list.


I'm not sure if it will work because I haven't implemented it, but I hope 
it helps. 

2019년 11월 29일 금요일 오후 9시 42분 0초 UTC+9, Maxim Bulatov 님의 말:
>
> Hello,
>
> I have lot of lists like follow:
> (Name1): (V1, V2, V3, V4, ..)
>
> And I use many threads to create many db objects:
> company = Company(Name)
> for x in vector:
> v = CompanyValue(company=company, value=x)
> values.append(v)
>
> class CompanyValue(models.Model):
> company = models.ForeignKey('Company', on_delete=models.CASCADE)
> value = FloatField
>
> This pool of threads return all lists, what I combine, filter and want put 
> to database in one bulk_create call.
> Suddenly, I found, company.id is not ready to be linked in CompanyValue, 
> follow code does not works:
> Company.objects.bulk_create(companies)
> CompanyValue.objects.bulk_create(values)  # value.company_id is null 
> here
>
> No way to save objects in my threads, because I need to filter objects and 
> can do it only when all of them are collected. Also, it has performance 
> issues 100k+ of requests is slowly enough. I have two ways to resolve:
> 1. I can make intermediate class or tuple and create CompanyValue objects 
> only when companies is saved to db. Hard to support, hard to filter, not so 
> clean.
> 2. I can use dirty hack to update _id field:
> for v in values:
> v.company = v.company
>
> Can you advice more ways for me? It seems, I don't know something from 
> django features to make it elegant.
> I see 11 years old issue here (https://code.djangoproject.com/ticket/9553 
> ) and it marked as 
> intended behaviour.
>

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


Re: Update _id field before .save() for ForeignKey

2019-11-29 Thread Charles Lee
 I have an idea.

   1. `bulk_create` all companies.
   2. `Filter`(SELECT) all `Company` and make it dictionary for retrieving 
   company pk fast.
   3. 
  1. company_dict = {
’Name’: ‘pk’,
...
  }
  4. Create a list of `CompanyValue` with company name and company_dict.
   5. `bulk_create` the list.


I'm not sure if it will work because I haven't implemented it, but I hope 
it helps. 

2019년 11월 29일 금요일 오후 9시 42분 0초 UTC+9, Maxim Bulatov 님의 말:
>
> Hello,
>
> I have lot of lists like follow:
> (Name1): (V1, V2, V3, V4, ..)
>
> And I use many threads to create many db objects:
> company = Company(Name)
> for x in vector:
> v = CompanyValue(company=company, value=x)
> values.append(v)
>
> class CompanyValue(models.Model):
> company = models.ForeignKey('Company', on_delete=models.CASCADE)
> value = FloatField
>
> This pool of threads return all lists, what I combine, filter and want put 
> to database in one bulk_create call.
> Suddenly, I found, company.id is not ready to be linked in CompanyValue, 
> follow code does not works:
> Company.objects.bulk_create(companies)
> CompanyValue.objects.bulk_create(values)  # value.company_id is null 
> here
>
> No way to save objects in my threads, because I need to filter objects and 
> can do it only when all of them are collected. Also, it has performance 
> issues 100k+ of requests is slowly enough. I have two ways to resolve:
> 1. I can make intermediate class or tuple and create CompanyValue objects 
> only when companies is saved to db. Hard to support, hard to filter, not so 
> clean.
> 2. I can use dirty hack to update _id field:
> for v in values:
> v.company = v.company
>
> Can you advice more ways for me? It seems, I don't know something from 
> django features to make it elegant.
> I see 11 years old issue here (https://code.djangoproject.com/ticket/9553 
> ) and it marked as 
> intended behaviour.
>

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


Redirect Loops and 404 with Django Channels and runserver command

2018-06-08 Thread Justin Lee


I was just trying to integrate channels into an existing django/DRF project 
and I have been running into an issue where my original urls paths are 
breaking when I do runserver. My root index view leads to 301 infinite 
redirects loop and my other app views results in a 404. The Socket server 
is definitely up as I have tried to do the following in console. It is just 
the http views + routes that are somehow breaking



var chatSocket = new WebSocket('ws://' + window.location.host + '/');

chatSocket.onmessage = function(e) {

var data = JSON.parse(e.data);

var message = data['message'];

console.log(message)

}

chatSocket.send(JSON.stringify({'message': "Hello World"}));


OUTPUT:

VM862:4 Hello World



The app works when I remove "channels" from installed_apps

It also works if I try to run the asgi app through daphne directly

I just want the app to work in django dev runserver


I am using django auth backend with login_required for all my views.

I am fairly new to django and would love some help on this! 

my_app/urls.py

urlpatterns = [
path('users/', include('django.contrib.auth.urls')),
path('admin/', admin.site.urls),
path('api/', include('api.urls', namespace='api')),
url(r'^.*', index, name='index'),
]

my_app/routing.py

from channels.auth import AuthMiddlewareStackfrom channels.routing import 
ProtocolTypeRouter, URLRouterfrom django.urls import path
from api.consumer import EchoConsumer

application = ProtocolTypeRouter({
'websocket': AuthMiddlewareStack(
URLRouter([
path('', EchoConsumer)
])
)
})

Settings

# Application definitionINSTALLED_APPS = [
'channels',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.postgres',
'django_extensions',
'rest_framework',
'rfs.apps.RfsConfig',
'api.apps.ApiConfig',
'import_export',
]
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',
]

Versions

channels==2.1.1
daphne==2.1.2

-- 
You received this message because you are subscribed to the Google Groups 
"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/de5f781b-ecca-4c7c-a1f5-3b01fff26531%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problems with translating URL patterns.

2017-12-03 Thread chotak lee
Can you help me?

2017-12-04 3:48 GMT+08:00 Juan José Meneses :

> Hello, I'm having problems with translating URL patterns. If I set a URL
> patter to be, for example,
> url(_(r'^admin/'), admin.site.urls)
>
> where
> _()
>
> is ugettext_lazy and access a no defined URL, lets say /404/, Instead of
> getting a 404 error I'm getting a 500 internal error.
> It looks from the log that the ugettext_lazy is not printable? Any ideas?
> Thanks.
>
> Here is the log https://dpaste.de/RmWR 
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/a3493502-c39d-4f34-a82b-bcf38ae4271b%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/CABeMx3fAhGhY%2BbGnxsF8m-XOoRPeWv6uPLm%3DNkSUBrt84jPO%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Any django reusable app for outdoor & indoor location, GPS tracking?

2017-09-27 Thread Lee Hinde
Regarding developing over https….

https://ngrok.com/ 

is a great tool when you want to use https locally.


> On Sep 27, 2017, at 12:35 PM, Jani Tiainen  wrote:
> 
> Hi.
> 
> To my knowledge there isn't one since we implemented our own tracker.
> 
> If you're going to build one I do have few pointers that you should consider.
> 
> Recent browser changes requires that location data is transferred over https. 
> I think chrome was first one to require it. That makes developing it a bit 
> challenging.
> 
> Raw coordinate data isn't that good since there is constant deviation in 
> coordinates. You'll need to pick some smoothing algorithm. Don't remember top 
> if my head what we use but I can check that when I go to work.
> 
> And then you need to have a background map. And that's the tricky part...
> 
> 26.9.2017 13.14 "'Federico Capoano' via Django users" 
> > 
> kirjoitti:
> Hi everyone,
> 
> before building my own reusable app all over again, I wanted to ask here if 
> there is any reusable django app that does indoor location and or GPS 
> tracking.
> I'm not looking for something full featured, but rather a starting point to 
> which I can contribute to.
> 
> Best regards
> Federico Capoano
> 

-- 
You received this message because you are subscribed to the Google Groups 
"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/0667A36B-BA19-4302-A1EA-93AEB35E4F62%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there a way to use input text placeholder when using {{ form.as_p }}

2017-07-26 Thread Lee Hinde
in the init method of your form do something like this:

self.fields['verification_date'].widget.attrs["placeholder"] = 'date'

> On Jul 26, 2017, at 1:31 PM, Alexander Joseph  
> wrote:
> 
> I'm using {{ form.as_p }} in my template and would like to be able to use 
> placeholders in the individual input fields. Is there a way to do this? 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/24FEB5E0-92C9-4824-9BDD-82047D6D0AD9%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


add users to google group django

2017-06-30 Thread Brian Lee
I have a quick question about handling email updates using Django. My 
organization uses a Google Group to send mass emails to those added to the 
email list, and I was looking to add a 'sign up' widget to the footer of 
the website (It's a non-buisness Google Group). Is it possible to utilize 
Google Group's API and Django to create a system where Django automatically 
adds emails to the Google Group? If so, how do you all suggest I go about 
implementing the feature?

-- 
You received this message because you are subscribed to the Google Groups 
"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/730d41bf-4fed-4626-be42-8b007ca26ddf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problems with migrations cleaning up a date field

2017-06-12 Thread Lee Hinde
On Sat, Jun 10, 2017 at 5:03 AM, Melvyn Sopacua 
wrote:

> On Friday 09 June 2017 20:56:46 James Schneider wrote:
>
>
>
> > Quite honestly this sounds like a bug in the migration system if
>
> > that's the case. I'm pretty sure it should ask what value to use as a
>
> > filler value during the migration, although I haven't had a change
>
> > like that in a while.
>
>
>
> When you *remove* a default, there is no need to migrate existing rows, as
> they have a default.
>
>

I should have mentioned that I checked for empty date fields first and they
were all populated.

My work around was to skip the migration. Just redid the dependency on the
next migration and all was well.

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/CA%2BePoMyD3_5o6p%2BwfJO%3DVa2L%2B__9vEQx6E-jg2BmCyGrawFQew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problems with migrations cleaning up a date field

2017-06-09 Thread Lee Hinde
I should add, this project is in 1.8.x. I'm working around the problem by
skipping the migration.

-- 
You received this message because you are subscribed to the Google Groups 
"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%2BePoMxnZ_LHcKx-2R_fX7WUwo-qkhxTDZdBcO39zX%3DH2xBBBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Problems with migrations cleaning up a date field

2017-06-09 Thread Lee Hinde
I'm having problems with a migration after cleaning up an oddity with a
date field and I'm not sure how to fix it.  Any advice appreciated.

I made this change to a date field:

-start_date = models.DateField(db_index=True, default=False,
-  help_text="The date enrollment can begin
this Season.")
+start_date = models.DateField(db_index=True, help_text="The date
enrollment can begin this Season.")

I'm not sure how a default of False ever made it, but I ran across it and
fixed it.

This is the migration that was created:

class Migration(migrations.Migration):

dependencies = [
('district', '0012_auto_20160622_1741'),
]

operations = [
migrations.AlterField(
model_name='season',
name='start_date',
field=models.DateField(help_text=b'The date enrollment can
begin this Season.', db_index=True),
),
]

This is the error I get trying to run the migration:

  Applying district.0013_auto_20170204_1811...Traceback (most recent call
last):
  File "manage.py", line 9, in 
execute_from_command_line(sys.argv)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/core/management/__init__.py",
line 354, in execute_from_command_line
utility.execute()
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/core/management/__init__.py",
line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/core/management/base.py",
line 394, in run_from_argv
self.execute(*args, **cmd_options)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/core/management/base.py",
line 445, in execute
output = self.handle(*args, **options)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/core/management/commands/migrate.py",
line 222, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/db/migrations/executor.py",
line 110, in migrate
self.apply_migration(states[migration], migration, fake=fake,
fake_initial=fake_initial)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/db/migrations/executor.py",
line 148, in apply_migration
state = migration.apply(state, schema_editor)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/db/migrations/migration.py",
line 115, in apply
operation.database_forwards(self.app_label, schema_editor, old_state,
project_state)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/db/migrations/operations/fields.py",
line 201, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/db/backends/base/schema.py",
line 484, in alter_field
old_db_params, new_db_params, strict)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/db/backends/base/schema.py",
line 566, in _alter_field
old_default = self.effective_default(old_field)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/db/backends/base/schema.py",
line 211, in effective_default
default = field.get_db_prep_save(default, self.connection)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/db/models/fields/__init__.py",
line 710, in get_db_prep_save
prepared=False)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/db/models/fields/__init__.py",
line 1322, in get_db_prep_value
value = self.get_prep_value(value)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/db/models/fields/__init__.py",
line 1317, in get_prep_value
return self.to_python(value)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/db/models/fields/__init__.py",
line 1274, in to_python
parsed = parse_date(value)
  File
"/Users/leehinde/Documents/Clients/rnrvirtual/venv-python2.7-django/lib/python2.7/site-packages/django/utils/dateparse.py",
line 60, in parse_date
match = date_re.match(value)
TypeError: expected string or buffer

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails 

Re:using HTTPHandler cause Django server side shows http 400 and Invalid HTTP_HOST header message

2017-04-10 Thread Zhao Lee
No, that would cause the following exception 


--- Logging error ---
Traceback (most recent call last):
  File 
"C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 
798, in _get_hostport
port = int(host[i+1:])
ValueError: invalid literal for int() with base 10: '//ezvideo.0letter.com'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):
  File 
"C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\logging\handlers.py", 
line 1137, in emit
h = http.client.HTTPConnection(host)
  File 
"C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 
762, in __init__
(self.host, self.port) = self._get_hostport(host, port)
  File 
"C:\Users\i\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 
803, in _get_hostport
raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
http.client.InvalidURL: nonnumeric port: '//ezvideo.0letter.com'
Call stack:
  File "C:\Users\i\Documents\Tencent Files\2281570025\FileRecv\a.py", line 26, 
in 
logger.error('testing remote logging')
Message: 'testing remote logging'
Arguments: ()






在2017年04月11 02时25分, "Camilo Torres"写道:

Hi,
Try with this configuration instead:
_TARGET = 'http://192.168.8.100:8000'

Notice you missed http:// there.

--
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/m42PLb1N_yo/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/8a6fcb79-dbf6-44f1-9971-7da02af85f27%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/253674e7.d2.15b5ad2d9d6.Coremail.redstone-cold%40163.com.
For more options, visit https://groups.google.com/d/optout.


using HTTPHandler cause Django server side shows http 400 and Invalid HTTP_HOST header message

2017-04-10 Thread Philip Lee


I also posted The question here 
http://stackoverflow.com/questions/43185804/using-httphandler-cause-django-server-side-shows-http-400-and-invalid-http-host
 


I am using HTTPHandler 
 to 
send logging messages to a Django Web server with The following code,

import loggingimport logging.handlers

logger = logging.getLogger(__name__)

_TARGET = '192.168.8.100:8000'
_PATH = '/VideoParser/lYYDownloaderClientLog/'

sh = logging.handlers.HTTPHandler(_TARGET, _PATH)

logger.addHandler(sh)
logger.error('testing remote logging')

but The server side shows http 400 and Invalid HTTP_HOST header message 
like this

Invalid HTTP_HOST header: '192.168.8.100:8000,192.168.8.100'. The domain 
name pr ovided is not valid according to RFC 1034/1035. [05/Apr/2017 
10:43:14] "GET /VideoParser/lYYDownloaderClientLog/?relativeCreated 
=117.00654029846191=5468=ERROR_info=None_text=None
 
ess=8920=a.py=39.52503204345703_info=None=40
 
sName=MainProcess=testing+remote+logging=a=MainThread
 
no=26=1491360192.039525=%3Cmodule%3E=%28%29=
*main*& 
pathname=C%3A%5CUsers%5Ci%5CDocuments%5CTencent+Files%5C2281570025%5CFileRecv%5C
 
a.py HTTP/1.1" 400 68137

while request from browser with url

http://192.168.8.100:8000/VideoParser/lYYDownloaderClientLog/?filename=log55.p%20y=40=88.00482749938965=%3Cmodule%3E=7144%20_info=None=log55=%28%29_text=None=D%3A%5CBaiduYun%20Download%5C%E7%BC%96%E7%A8%8B%5CPython%5Clog55.py=ERROR=668.0548%20191070557=MainThread=6664=root=34=yahoo+Serve%20r+Exception_info=None=MainProcess=1491225161.6680548

could actually send a good request to The server , The server shows The 
following in this case

--- '], 'threadName': ['MainThread'], 'filename': ['log55.p y'], 'p
athname': ['D:\\BaiduYun Download\\编程\\Python\\log55.py'], 
'relativeCreated':['88.00482749938965']}>[05/Apr/2017 10:45:26] "GET 
/VideoParser/lYYDownloaderClientLog/?filename=log55.
p%20y=40=88.00482749938965=%3Cmodule%3E=
7144%20_info=None=log55=%28%29_text=None=D%3A%5CB
aiduYun%20Download%5C%E7%BC%96%E7%A8%8B%5CPython%5Clog55.py=ERROR
s=668.0548%20191070557=MainThread=6664=root=34
g=yahoo+Serve%20r+Exception_info=None=MainProcess=149122
5161.6680548 HTTP/1.1" 200 27

so what's wrong with my code using HTTPHandler 
 to 
send logging messages to a Django Web server ?

As I have tested: If I pass the IP address of my web server to the host 
parameter of HTTPHandler, the server side would show http 400 and Invalid 
HTTP_HOST header message, there are also exceptions , pasted here 
https://bpaste.net/show/f2d2e64e7a7e , while if I pass the domain name 
instead, then the view function works as expected . so would it be a bug 
within HTTPHandler?

related code For debug

django-test\LYYDownloaderServer\VideoParser\urls.py

from django.conf.urls import urlfrom . import views
app_name = 'VideoParser'
urlpatterns = [
url(r'lYYDownloaderClientLog.+',views.lYYDownloaderClientLog, 
name='lYYDownloaderClientLog')]

django-test\LYYDownloaderServer\VideoParser\views.py

def lYYDownloaderClientLog(request):
print('---', request.GET)
return HttpResponse("")  # The server *successfully* processed the request 
and is not returning any content.

-- 
You received this message because you are subscribed to the Google Groups 
"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/2e383515-3e78-4f6a-8681-0eb7858251f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


The Django server side shows http 400 and Invalid HTTP_HOST header message

2017-04-03 Thread Philip Lee


I am using HTTPHandler to send logging messages to a Django Web server with The 
following code, 

>
> import logging
> import logging.handlers
> logger = logging.getLogger('mylogger')
> http_handler = logging.handlers.HTTPHandler('localhost:8000', 
> '/VideoParser/lYYDownloaderClientLog')#, method='POST'
> logger.addHandler(http_handler)
> logger.error('testing remote logging')


but The server side shows http 400 and Invalid HTTP_HOST header message like 
this 

>
> Invalid HTTP_HOST header: 'localhost:8000,localhost'. The domain name 
> provided i
> s not valid according to RFC 1034/1035.
> [03/Apr/2017 19:15:41] "GET 
> /VideoParser/lYYDownloaderClientLog?filename=a.py
> readName=MainThread_info=None=MainProcess_text=None
> d=1491218139.538086=ERROR=a=3624_info=None
> reated=112.00642585754395=40=C%3A%5CUsers%5Ci%5CDocuments%5CTen
> cent+Files%5C2281570025%5CFileRecv%5Ca.py=538.0859375=testing+remote+l
> ogging=mylogger=%28%29=12=6700=%3Cmodule%3E 
> HT
> TP/1.1" 400 67823


so how to fix The issue ?

related code
django-test\LYYDownloaderServer\VideoParser\urls.py

>
> from django.conf.urls import url
> from . import views
> app_name = 'VideoParser'
> urlpatterns = [
> url(r'lYYDownloaderClientLog.+',views.lYYDownloaderClientLog, 
> name='lYYDownloaderClientLog')
> ]


django-test\LYYDownloaderServer\VideoParser\views.py

>
> def lYYDownloaderClientLog(request):
> print('---', request.GET)

-- 
You received this message because you are subscribed to the Google Groups 
"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/aa561085-f498-412e-9f2f-2e5af04df9a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial part 4 help: the raidio buttons to make a choice on the polls question won't show.

2017-02-09 Thread Brady Lee
 The "polls_choice" table in database file db.sqlite3 has no records, so no 
radio buttons show up.
I manually added 2 records to the "polls_choice" table, then I have the 
radio buttons showed up.


On Tuesday, February 7, 2017 at 6:17:58 PM UTC+8, ludovic coues wrote:
>
> Have you added some choices to the "What's up?" question ? 
>
> What you see is that question.choice_set.all is empty. 
> The following snippet will give you some output: 
>
> {% for choice in question.choice_set.all %} 
>  value="{{ choice.id }}" /> 
> {{ choice.choice_text 
> }} 
> {% empty %} 
> Sorry, no available choices. 
> {% endfor %} 
>
> 2017-02-07 10:12 GMT+01:00 Brady Lee <jack...@gmail.com >: 
> > Same issue here, no radio buttons show up. 
> > 
> > ubuntu 16.04.1 LTS 
> > python 3.5.2 
> > django 1.10.5 
> > 
> > I've tried  {{ question|pprint }} and {{ question.choice_set.all|pprint 
> }} 
> > for debugging, got: 
> > 
> >   
> > 
> > Now trying to figure out where the problem is. 
> > 
> > 
> > On Thursday, October 20, 2016 at 11:52:59 PM UTC+8, Othniel Ayinzat 
> wrote: 
> >> 
> >> Hi guys, 
> >>  I have been following the django tutorials up to part 4 on the polls 
> >> application. My details template only displays the vote submit button 
> but 
> >> the radio buttons for making choices won't show. I have been battling 
> with 
> >> this for some hours now and i need help or some pointers. Thanks. Below 
> are 
> >> the code snippets for the polls app. 
> >> 
> >> polls/templates/polls/detail.html 
> >> --- 
> >> {{ question.question_text }} 
> >> {% if error_message %}{{ error_message }}{% 
> endif 
> >> %} 
> >>  
> >> {% csrf_token %} 
> >> {% for choice in question.choice_set.all %} 
> >>  >> value="{{ choice.id }}" /> 
> >> {{ choice.choice_text 
> >> }} 
> >> {% endfor %} 
> >>  
> >>  
> >> 
> >> polls/templates/polls/index.html 
> >> --- 
> >> 
> >> {% if latest_question_list %} 
> >>  
> >> {% for question in latest_question_list %} 
> >> {{ 
> >> question.question_text }} 
> >> {% endfor %} 
> >>  
> >> {% else %} 
> >> No polls are available. 
> >> {% endif %} 
> > 
> > -- 
> > You received this message because you are subscribed 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/8a5fe550-62bf-42e5-8dfa-0b3fc8d5d4cf%40googlegroups.com.
>  
>
> > 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
>
> Cordialement, Coues Ludovic 
> +336 148 743 42 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/5ab09a09-69a6-41f5-85eb-791d514b6350%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial part 4 help: the raidio buttons to make a choice on the polls question won't show.

2017-02-07 Thread Brady Lee
Same issue here, no radio buttons show up.

ubuntu 16.04.1 LTS
python 3.5.2
django 1.10.5

I've tried  {{ question|pprint }} and {{ question.choice_set.all|pprint }} 
for debugging, got:

 

Now trying to figure out where the problem is. 

On Thursday, October 20, 2016 at 11:52:59 PM UTC+8, Othniel Ayinzat wrote:
>
> Hi guys,
>  I have been following the django tutorials up to part 4 on the polls 
> application. My details template only displays the vote submit button but 
> the radio buttons for making choices won't show. I have been battling with 
> this for some hours now and i need help or some pointers. Thanks. Below are 
> the code snippets for the polls app.
>
> polls/templates/polls/detail.html
> ---
> {{ question.question_text }}
> {% if error_message %}{{ error_message }}{% endif 
> %}
> 
> {% csrf_token %}
> {% for choice in question.choice_set.all %}
>  value="{{ choice.id }}" />
> {{ choice.choice_text 
> }}
> {% endfor %}
> 
> 
>
> polls/templates/polls/index.html
> ---
>
> {% if latest_question_list %}
> 
> {% for question in latest_question_list %}
> {{ 
> question.question_text }}
> {% endfor %}
> 
> {% else %}
> No polls are available.
> {% endif %}
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/8a5fe550-62bf-42e5-8dfa-0b3fc8d5d4cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2016-12-30 Thread Zhao Lee


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





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

try to change de django loggin

https://docs.djangoproject.com/en/1.10/topics/logging/#examples



2016-12-28 9:45 GMT-06:00 Philip Lee <redstone-c...@163.com>:

Please help! The question are also posted here
http://stackoverflow.com/questions/41363888/django-doesnt-email-reporting-an-internal-server-error-http-status-code-500




I could send mail using the following code

E:\Python\django-test\LYYDownloaderServer>python manage.py shell

Python3.5.2(v3.5.2:4def2a2901a5,Jun252016,22:01:18)[MSC v.190032 bit (In
tel)] on win32
Type"help","copyright","credits"or"license"for more 
information.(InteractiveConsole)>>>from django.core.mail import send_mail
>>>>>> send_mail(...'Subject here',...'Here is the 
>>>>>> message.',...'redstone-c...@163.com',...['2281570...@qq.com'],... 
>>>>>> fail_silently=False,...)1>>>

According to the doc:

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

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

what's the problem? please help fix the problem




settings.py

"""
Django settings for LYYDownloaderServer project.

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

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

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""import os
ADMINS =[('Philip','r234327...@163.com'),('Philip2','768799...@qq.com')]
EMAIL_HOST ='smtp.163.com'# 'localhost'#'smtp.139.com'# EMAIL_PORT = 25# 
EMAIL_USE_TLS = True

EMAIL_HOST_USER ='r234327...@163.com'# '13529123...@139.com'
EMAIL_HOST_PASSWORD ='**'# DEFAULT_FROM_EMAIL = 'r234327...@163.com'# Build 
paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))# 
Quick-start development settings - unsuitable for production# See 
https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/# SECURITY 
WARNING: keep the secret key used in production secret!
SECRET_KEY ='s4(z8qzt$=x(2t(ok5bb58_!u==+x97t0vpa=*8bb_68baekkh'# SECURITY 
WARNING: don't run with debug turned on in production!
DEBUG =False

ALLOWED_HOSTS =['127.0.0.1']#,'.0letter.com'# Application definition

INSTALLED_APPS 
=['VideoParser.apps.VideoparserConfig','FileHost.apps.FilehostConfig','django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles',]

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

ROOT_URLCONF ='LYYDownloaderServer.urls'

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

WSGI_APPLICATION ='LYYDownloaderServer.wsgi.application'# Database# 
https://docs.djangoproject.com/en/1.9/ref/settings/#databases

DATABASES ={'default':{'ENGINE':'django.db.backends.sqlite3','NAME': 
os.path.join(BASE_DIR,'db.sqlite3'),}}# Password validation# 
https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS 
=[{'NAME':'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',},{'NAME':'django.contrib.auth.password_validation.MinimumLengthValidator',},{'NAME':'django.contrib.auth.password_validation.CommonPasswordValidator',},{'NAME':'django.contrib.auth.password_validation.NumericPasswordValidator',},]#
 Internationalization# https://docs.djangoproject.com/en/1.9/topics/i18n/

LANGUAGE_CODE ='en-us'

TIME_ZONE ='UTC'

USE_I18N =True

USE_L10N =True

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

2016-12-28 Thread Philip Lee
Please help! The question are also posted here
http://stackoverflow.com/questions/41363888/django-doesnt-email-reporting-an-internal-server-error-http-status-code-500

I could send mail using the following code

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

According to the doc 

:

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

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


what's the problem? please help fix the problem


settings.py

"""
Django settings for LYYDownloaderServer project.

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

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

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
ADMINS = [('Philip', 'r234327...@163.com'), ('Philip2', '768799...@qq.com')]
EMAIL_HOST = 'smtp.163.com'  # 'localhost'#'smtp.139.com'# EMAIL_PORT = 25# 
EMAIL_USE_TLS = True

EMAIL_HOST_USER = 'r234327...@163.com'  # '13529123...@139.com'
EMAIL_HOST_PASSWORD = '**'# DEFAULT_FROM_EMAIL = 'r234327...@163.com'# 
Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production# See 
https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 's4(z8qzt$=x(2t(ok5bb58_!u==+x97t0vpa=*8bb_68baekkh'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

ALLOWED_HOSTS = ['127.0.0.1']#, '.0letter.com'

# Application definition

INSTALLED_APPS = [
'VideoParser.apps.VideoparserConfig',
'FileHost.apps.FilehostConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',]

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

ROOT_URLCONF = 'LYYDownloaderServer.urls'

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

WSGI_APPLICATION = 'LYYDownloaderServer.wsgi.application'

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

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

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

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

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

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, 

Shout out to Grove Collaborative for django-sql-explorer

2016-09-03 Thread Lee Hinde
Just did a quick report for a client with django-sql-explorer (
https://github.com/groveco/django-sql-explorer) and once again I'm grateful
for its existence.

Highly recommended for quick ad-hoc reporting.

(no relationship except that I'm a Grove Co customer so I can give back a
little bit.)

-- 
You received this message because you are subscribed to the Google Groups 
"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%2BePoMzqB6ace99Ut9fwzu%3DO7eu-pKa_RcsV%3DtjvO4-BYsBosg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clarifying Project vs Apps

2016-08-24 Thread Lee Hinde
On Wed, Aug 24, 2016 at 9:23 AM, Rich Shepard <rshep...@appl-ecosys.com>
wrote:

> On Wed, 24 Aug 2016, Lee Hinde wrote:
>
> My tuppence.
>>
>
> Lee,
>
>   Before or after Brexit? The value might change. :-)
>
> No, an app is a logical grouping of objects/tables. You might, for
>> instance,have an Invoice app that would include an Invoice table (model)
>> and a LineItems table. Products and related tables would be in a different
>> app.
>>
>
>   OK, that makes sense.
>
>   In my current project, then, all modules for company, contact, activity,
> case, etc. will be in a single app. And, perhaps, another app would be for
> reporting?
>
>   Translating from product-oriented applications to service-oriented ones
> is
> not always easy.
>
> Thanks very much,
>
> Rich
>
So, no one is going to grade it. You're making this for yourself, so I
wouldn't over think it. I'm working on a project now that only has two
apps, one with all the core models and one for utility models (like choice
lists).(I'm using several packages, so the database has more to it than
that.)

It sounds like something like that would work for you and still be 'right'.
Especially as a first time out of the gate project, keep it simple. IMHO.

While it will certainly evolve as you use it, you're not gong to suddenly
wake up and need 18 more apps to meet your needs. And if that does happen,
you can rearrange.

-- 
You received this message because you are subscribed to the Google Groups 
"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%2BePoMwf38zOGytfpoQc49pdSuxLyw-zqEdaRcqcjhJE3dV4VA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clarifying Project vs Apps

2016-08-24 Thread Lee Hinde

> On Aug 24, 2016, at 8:48 AM, Rich Shepard  wrote:
> 
>  While I think that I understand the differences between a project and its
> apps there remains one point of uncertainty. I've not found the answer,
> although it might be in the 1.10 docs or on the Web and I've missed it.
> 
>  If the project represents the entire database, do the apps represent
> individual tables? That is, should my project have a separate app for each
> table with its models, templates, and views with templates of joined tables
> in the main project subdirectory? Or are all tables in a single app?


My tuppence.. No, an app is a logical grouping of objects/tables. You might, 
for instance,have an Invoice app that would include an Invoice table (model) 
and a LineItems table. Products and related tables would be in a different app.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/A2166400-C5B5-4CCB-ABC2-0A5E1D92F6DF%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Best way to keep the current selection

2016-07-26 Thread Lee Hinde
I'm wondering if there's a better way to maintain a selection of records
across calls to the app.

In one of my projects users can do ad-hoc searches; i.e., Last Name =
Smith, Class Name = Yoga, etc.

They do the search, then get the query results presented in a table.

Then they can do things with the selection like run reports or make it the
basis for further queries.

To maintain state, after any ad-hoc query, I store the ids for the found
records:

self.request.session['query.classes.last_ids'] =
list(queryset.values_list('id', flat=True))

It works fine and I've not had any problems I can lay to this. But I'm
executing the query at least twice and I'm storing, potentially, thousands
of ids in the session cache.

The only other alternative I've thought of was to store the query criteria
and re-execute it, but a) that's complicated and b) the underlying results
could change while the user is deciding on the next step.

Is there a best practice for this sort of thing?

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/CA%2BePoMw6EOf%2B4%3DYPkutNeyqddYBGEPXjhg%2BeLr4eB2q7VBkihw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error uploading images

2016-07-02 Thread Lee Hinde
Aargh. Thanks.

On Saturday, July 2, 2016, Vijay Khemlani <vkhem...@gmail.com> wrote:

> The typical problem is forgetting to add the
>
> enctype='multipart/form-data'
>
> attribute to the form tag
>
>
>
> On Sat, Jul 2, 2016 at 9:40 PM, Lee Hinde <leehi...@gmail.com
> <javascript:_e(%7B%7D,'cvml','leehi...@gmail.com');>> wrote:
>
>> Using django-storages to put user uploaded files on s3.
>>
>> Uploading images in the shell works fine. So, I assume I've got
>> django-storages and boto installed fine and S3 configured correctly.
>>
>> Uploading in real-life, doesn't work. The error I get back is that the
>> image field is required.
>>
>> The model:
>>
>> class PropertyPhotos(models.Model):
>> property = models.ForeignKey(Property)
>> image = models.ImageField(upload_to="img")
>> title = models.CharField(max_length=200, blank=True)
>>
>> The form:
>>
>> class PhotoForm(forms.ModelForm):
>> property_key = forms.CharField(required=False,
>> widget=forms.HiddenInput())
>>
>> def __init__(self, property_key,  *args, **kwargs):
>> super(PhotoForm, self).__init__(*args, **kwargs)
>> self.initial['property_key'] = property_key
>>
>> class Meta:
>> model = PropertyPhotos
>> fields = [ 'image', 'title']
>> exclude = ['property', ]
>>
>>
>> The view:
>>
>> class AddPhotos(LoginRequiredMixin, CreateView):
>> form_class = PhotoForm
>> success_url = reverse_lazy('add_photos')
>> template_name = 'photo_entry.html'
>> model = PropertyPhotos
>>
>> def get_form_kwargs(self):
>> kwargs = super(AddPhotos, self).get_form_kwargs()
>> kwargs['property_key'] = self.kwargs.get('key')
>> return kwargs
>>
>> def form_valid(self, form):
>> photo = PhotoForm(self.request.POST, self.request.FILES)  #
>> form.save(commit=False)
>> url = form.cleaned_data['property_key']
>> photo.property = Property.objects.get(url_uuid=url)
>> photo.save()
>> return super(AddPhotos, self).form_valid(form)
>>
>> def get_context_data(self, **kwargs):
>> context = super(AddPhotos, self).get_context_data(**kwargs)
>> context['property_key'] = self.kwargs.get('key')
>> context['property_obj'] =
>> Property.objects.get(url_uuid=self.kwargs.get('key'))
>> return context
>>
>> The form part of the template (mostly to show that the image input is
>> within the form :
>>
>> 
>> {{ form.errors }}
>> {% csrf_token %}
>> {{ form.property_key }}
>> Add Photos for  - {{ property_obj.title }}
>> {{ form.as_p }}
>>
>> 
>> 
>> > value="Upload" id="submit" type="submit">
>> Upload
>> 
>> 
>>
>> 
>> 
>>
>> I'd appreciate a code review that will tell me which mis-placed
>> semi-colon is causing my errors.
>>
>> 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/CA%2BePoMyipqzzD-yvA3k4JOn0YG4sDD20VYS2Jm9E509WFWOMXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Error uploading images

2016-07-02 Thread Lee Hinde
Using django-storages to put user uploaded files on s3.

Uploading images in the shell works fine. So, I assume I've got
django-storages and boto installed fine and S3 configured correctly.

Uploading in real-life, doesn't work. The error I get back is that the
image field is required.

The model:

class PropertyPhotos(models.Model):
property = models.ForeignKey(Property)
image = models.ImageField(upload_to="img")
title = models.CharField(max_length=200, blank=True)

The form:

class PhotoForm(forms.ModelForm):
property_key = forms.CharField(required=False,
widget=forms.HiddenInput())

def __init__(self, property_key,  *args, **kwargs):
super(PhotoForm, self).__init__(*args, **kwargs)
self.initial['property_key'] = property_key

class Meta:
model = PropertyPhotos
fields = [ 'image', 'title']
exclude = ['property', ]


The view:

class AddPhotos(LoginRequiredMixin, CreateView):
form_class = PhotoForm
success_url = reverse_lazy('add_photos')
template_name = 'photo_entry.html'
model = PropertyPhotos

def get_form_kwargs(self):
kwargs = super(AddPhotos, self).get_form_kwargs()
kwargs['property_key'] = self.kwargs.get('key')
return kwargs

def form_valid(self, form):
photo = PhotoForm(self.request.POST, self.request.FILES)  #
form.save(commit=False)
url = form.cleaned_data['property_key']
photo.property = Property.objects.get(url_uuid=url)
photo.save()
return super(AddPhotos, self).form_valid(form)

def get_context_data(self, **kwargs):
context = super(AddPhotos, self).get_context_data(**kwargs)
context['property_key'] = self.kwargs.get('key')
context['property_obj'] =
Property.objects.get(url_uuid=self.kwargs.get('key'))
return context

The form part of the template (mostly to show that the image input is
within the form :


{{ form.errors }}
{% csrf_token %}
{{ form.property_key }}
Add Photos for  - {{ property_obj.title }}
{{ form.as_p }}




Upload






I'd appreciate a code review that will tell me which mis-placed semi-colon
is causing my errors.

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


Re: LoginRequiredMixin ignored

2016-06-16 Thread Lee Hinde
I always assume it's me. That was some errant copy and paste.

Thanks!

On Wed, Jun 15, 2016 at 11:51 PM, Babatunde Akinyanmi <tundeba...@gmail.com>
wrote:

> Actually it's you. Please see inline:
>
> On Jun 15, 2016 11:56 PM, "Lee Hinde" <leehi...@gmail.com> wrote:
> >
> > Using Django 1.9.7.
> >
> > I have the following class:
> >
> > class AddView(LoginRequiredMixin, CreateView):
> > template_name = "entry.html"
> > model = Property
> > form_class = AddPropertyForm
> > success_url = "/buy/"
> > login_url = '/account/login/'
> >
>
> Consider your code for `dispatch`
> > def dispatch(self, request, *args, **kwargs):
> > print request.user
> > print request.user.is_authenticated()
> > return super(AddView, self).post(request, *args, **kwargs)
> >
> You have bypassed `LoginRequiredMixin` implementation of `dispatch` and
> there's where the login logic is done. You should be returning a super call
> to `dispatch` not `post`. If you are actually trying to force all requests
> into POSTs (which I doubt), you are better off doing it in the `get`
> method.
>
> > def form_valid(self, form):
> > ls_property = form.save(commit=False)
> > ls_property.user = get_user(self.request)
> > ls_property.latitude = form.cleaned_data['latitude']
> > ls_property.longitude = form.cleaned_data['longitude']
> > submit =  form.cleaned_data['submit']
> > ls_property.visible = (submit != 'draft')
> > ls_property.save()
> > return super(AddView, self).form_valid(form)
> >
> >
> > The LoginRequiredMixin is ignored, i.e, I can get to the page without
> being logged in.
> >
> > request.user reports: AnonymousUser
> > request.user.is_authenticated() reports: False
> >
> > If I wrap the url:
> >
> > url(r'^sell', user_passes_test(user_is_active)(AddView.as_view()),
> name="add"),
> >
> > the page is protected, so I have a work around.
> >
> > This seems basic and I don't find other reports of LoginRequiredMixin
> not working, so I assume it's me.
> >
> > What am I missing?
> >
>

-- 
You received this message because you are subscribed to the Google Groups 
"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%2BePoMwMHRW6cEbzPypBhTnGCRJ7W0nGE%2BvaQ_ytmA_D2WhiSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


LoginRequiredMixin ignored

2016-06-15 Thread Lee Hinde
Using Django 1.9.7.

I have the following class:

class AddView(LoginRequiredMixin, CreateView):
template_name = "entry.html"
model = Property
form_class = AddPropertyForm
success_url = "/buy/"
login_url = '/account/login/'

def dispatch(self, request, *args, **kwargs):
print request.user
print request.user.is_authenticated()
return super(AddView, self).post(request, *args, **kwargs)

def form_valid(self, form):
ls_property = form.save(commit=False)
ls_property.user = get_user(self.request)
ls_property.latitude = form.cleaned_data['latitude']
ls_property.longitude = form.cleaned_data['longitude']
submit =  form.cleaned_data['submit']
ls_property.visible = (submit != 'draft')
ls_property.save()
return super(AddView, self).form_valid(form)


The LoginRequiredMixin is ignored, i.e, I can get to the page without
being logged in.

request.user reports: AnonymousUserrequest.user.is_authenticated()
reports: False

If I wrap the url:

url(r'^sell', user_passes_test(user_is_active)(AddView.as_view()), name="add"),

the page is protected, so I have a work around.

This seems basic and I don't find other reports of LoginRequiredMixin
not working, so I assume it's me.

What am I missing?

-- 
You received this message because you are subscribed to the Google Groups 
"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%2BePoMzApQGdzZ9AW47CjF3yhT0Smnc1AZw%2BOQ8uTcH1G3%3Dasg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Absolute beginner step by step

2016-06-11 Thread Lee Hinde
https://leanpub.com/tangowithdjango19/ 


> On Jun 11, 2016, at 2:07 PM, Gary Roach  wrote:
> 
> If you don't mind working with Python2.7 and Django 1.7 you might try "Tango 
> With Django" . It is out of date but still is a good place to start. Too bad 
> that the author hasn't updated it. I

-- 
You received this message because you are subscribed to the Google Groups 
"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/0FDE615E-8BF0-459C-9D3D-A45E3CD28CBF%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Design an encrypted time-limited API on Client/Server side

2016-06-09 Thread Philip Lee


I am planning design an encrypted time-limited API on both Client and 
Server sides, the server side is written in Django, the client side is a 
GUI program which call the API by

import requests
c = requests.post("http://127.0.0.1:8000/VideoParser/;, data={'videoUrl': 
videoUrl })

The way it call the API is desperately exposed to those who can use network 
traffic capturing tools like wireshark and fiddler, while I don't want 
anyone else could call the API with their customized videoUrl, and if 
people made the post call with the same parameters 2 minutes later after 
the client initially made the call, the call should be valid or expired, so 
how to design the encrypted time-limited API on both Client and Server side 
in this case ?
--

P.S. I think add an identifier to the post data could prevent them using 
the API

import requests
c = requests.post("http://127.0.0.1:8000/VideoParser/;, data={'videoUrl': 
videoUrl, 'identifier':value_of_identifier })

provided there is something encrypted in the value_of_identifier and it 
changes with each call, but I don't know how to get started, any idea ?

It would be better to show some code , I really don't know how to start to 
write code.

-- 
You received this message because you are subscribed to the Google Groups 
"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/c90bd293-f44a-4916-bffa-1fae0663ed0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django css: general query on CDNs and crispy forms

2016-02-23 Thread Lee Hinde
On Feb 23, 2016, at 5:27 PM, clarksonchri...@gmail.com wrote:
> 
> Should i download bootstrap properly or do the CDNs suffice?
Your call; but if you want to have a plan B, here’s an example:  
http://www.hanselman.com/blog/CDNsFailButYourScriptsDontHaveToFallbackFromCDNToLocalJQuery.aspx
 


It’s about jQuery, but the same principal would apply for bootstrap.

> Where do I store the bootstrap code and how will it affect my own CSS code?
You put it the same place you’d have your other js/css files. Loading order 
matters. I usually load libraries first and then my files.

> How do register the module crispy_forms? and where do I store the crispy 
> forms folder there is little documentation on this?
Crispy Forms has documentation. 
http://django-crispy-forms.readthedocs.org/en/latest/ 


-- 
You received this message because you are subscribed to the Google Groups 
"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/0AE63F7B-91B3-4A10-8C03-74DF56DB08D9%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Could not parse the remainder template inheritance

2016-01-02 Thread Lee Hinde
If you’re just getting your feet wet and don’t want to invest in an editor/IDE 
just yet, try TextWrangler: http://www.barebones.com/products/textwrangler/ 
  It’s free and won’t get in 
your way.

> On Jan 2, 2016, at 8:11 AM, Matthew  wrote:
> 
> Actually it turned out this works!! My TextEdit app was being finnicky and 
> made me re-write the entire code instead of just the quotation marks. Thanks 
> for the help!
> 
> On Saturday, January 2, 2016 at 10:52:22 AM UTC-5, Matthew wrote:
> Hi James,
> 
> I turned smart quotes off and am still having the error.  I wasn't aware that 
> could cause future errors though, so thanks for the heads up!
> 
> On Saturday, January 2, 2016 at 12:44:22 AM UTC-5, James Schneider wrote:
> 
> On Jan 1, 2016 8:08 PM, "Matthew" > wrote:
> >
> > Hi all,
> >
> > I'm working through the masteringdjango book, and am struggling in the 
> > Templates area.
> >
> > I created a base.html base template, and am attempting to include a child 
> > template.
> >
> > This is the child template:
> >
> > {% extends “base.html” %}
> >
> > {% block title %}The current time{% endblock %}
> >
> > {% block content %}
> > It is now {{ current_date }}.
> > {% endblock %}
> >
> > When I run the site, I get the following error message: 
> > Could not parse the remainder: '“base.html”' from '“base.html”'
> >
> > And it points to the first line of the child template.
> >
> > I don't understand what I am doing wrong, please help.
> 
> Was this template code primarily copied/pasted from an example?
> 
> Can you try deleting and manually typing new quotes around the base.html 
> reference in your {% extends %} tag?
> 
> Not sure if it's my email client or not, but those appear to be "smart 
> quotes", which lean left/right, usually automatically inserted by editor 
> applications like MS Word or possible from a translation from text to PDF to 
> make things "pretty".
> 
> To a computer parser like the Django template system, those are interpreted 
> differently as regular characters rather than quotes, which would explain the 
> parser error you are receiving. Hard to spot, but I've been bit by that type 
> of subtle bug before.
> 
> -James
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CE45DD84-98D8-406D-A829-CF0C2B7AB86D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Ask for help

2015-11-19 Thread Cision Lee
*When I migrate the database, I meet some errors, and errors are following:*

> Operations to perform:
>   Synchronize unmigrated apps: staticfiles, messages
>   Apply all migrations: admin, contenttypes, api, auth, sessions
> Synchronizing apps without migrations:
>   Creating tables...
> Running deferred SQL...
>   Installing custom SQL...
> Running migrations:
>   Rendering model states... DONE
>   Applying api.0004_auto_20151119_1545...Traceback (most recent call last
> ):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File 
> "/Library/Python/2.7/site-packages/django/core/management/__init__.py", 
> line 354, in execute_from_command_line
> utility.execute()
>   File 
> "/Library/Python/2.7/site-packages/django/core/management/__init__.py", 
> line 346, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
> line 394, in run_from_argv
> self.execute(*args, **cmd_options)
>   File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
> line 445, in execute
> output = self.handle(*args, **options)
>   File 
> "/Library/Python/2.7/site-packages/django/core/management/commands/migrate.py"
> , line 222, in handle
> executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
>   File 
> "/Library/Python/2.7/site-packages/django/db/migrations/executor.py", 
> line 110, in migrate
> self.apply_migration(states[migration], migration, fake=fake, 
> fake_initial=fake_initial)
>   File 
> "/Library/Python/2.7/site-packages/django/db/migrations/executor.py", 
> line 148, in apply_migration
> state = migration.apply(state, schema_editor)
>   File 
> "/Library/Python/2.7/site-packages/django/db/migrations/migration.py", 
> line 115, in apply
> operation.database_forwards(self.app_label, schema_editor, old_state, 
> project_state)
>   File 
> "/Library/Python/2.7/site-packages/django/db/migrations/operations/fields.py"
> , line 62, in database_forwards
> field,
>   File 
> "/Library/Python/2.7/site-packages/django/db/backends/sqlite3/schema.py", 
> line 179, in add_field
> self._remake_table(model, create_fields=[field])
>   File 
> "/Library/Python/2.7/site-packages/django/db/backends/sqlite3/schema.py", 
> line 77, in _remake_table
> self.effective_default(field)
>   File 
> "/Library/Python/2.7/site-packages/django/db/backends/base/schema.py", 
> line 211, in effective_default
> default = field.get_db_prep_save(default, self.connection)
>   File 
> "/Library/Python/2.7/site-packages/django/db/models/fields/__init__.py", 
> line 710, in get_db_prep_save
> prepared=False)
>   File 
> "/Library/Python/2.7/site-packages/django/db/models/fields/__init__.py", 
> line 1322, in get_db_prep_value
> value = self.get_prep_value(value)
>   File 
> "/Library/Python/2.7/site-packages/django/db/models/fields/__init__.py", 
> line 1317, in get_prep_value
> return self.to_python(value)
>   File 
> "/Library/Python/2.7/site-packages/django/db/models/fields/__init__.py", 
> line 1274, in to_python
> parsed = parse_date(value)
>   File "/Library/Python/2.7/site-packages/django/utils/dateparse.py", 
> line 60, in parse_date
> match = date_re.match(value)
> TypeError: expected string or buffer
>
> *and the source code of models.py is following:*
>
> from django.db import models
from django.core.exceptions import ValidationError
from django.utils.dateformat import format
from django.contrib.auth.models import AbstractUser
from datetime import date
import datetime
from django.conf import settings
from django.db.models import Sum
from django.utils import timezone
from django.utils.dateformat import format
# Create your models here.
#Users, Contacts, Events

class User(models.Model):
phonenum = models.CharField(max_length=20)
username = models.CharField(max_length=20)
def get_usr_info(self):
data = {}  # dictionary
data['phonenum'] = self.phonenum
data['name'] = self.username
return data

class Contacts(models.Model):
user = models.ForeignKey(User)

class UpdateEvents(models.Model):
user = models.ForeignKey(User)
events = models.CharField(max_length=50)
latitude = models.CharField(max_length=10)
longitude = models.CharField(max_length=10)
city = models.CharField(max_length=10)
arriveDate = models.DateTimeField(blank=True, null=True)
leaveDate = models.DateTimeField(blank=True, null=True)
#arriveDate = models.CharField(max_length=15, default="")
#leaveDate = models.CharField(max_length=15, default="")
def get_events_info(self):
data = {}
data['phonenum'] = self.user.phonenum
data['name'] = self.user.username
data['events'] = self.events
data['latitude'] = self.latitude
data['longitude'] = self.longitude
data['city'] = self.city
data['arriveDate'] = format(self.arriveDate, 

Re: Errors in tests when working through contribution tutorial

2015-10-12 Thread Lee Cartwright
Hi Tim,

I hadn't considered that. I'll try with a different version of Python 3.

Thanks,
Lee

On Monday, 12 October 2015 18:54:51 UTC-7, Tim Graham wrote:
>
> Hi Lee, I think the issue is that the tests don't pass on Python 3.5 at 
> the commit where the contributing was tutorial was authored. I suppose 
> we'll have to update it to use a more recent patch or at least mention this 
> caveat for now.
>
> On Monday, October 12, 2015 at 5:12:20 PM UTC-7, Lee Cartwright wrote:
>>
>> Hi,
>>
>> I'm not sure if this is the right group for this question, but I figured 
>> it was the best place to start. I'm interested in contributing to the 
>> Django project and have spent some time today working through the 
>> contribution tutorial. I've got to the initial 'running tests' stage and 
>> have a few test errors that I cannot figure out. The output is:
>>
>> ==
>>
>> FAIL: test_old_style_storage (file_storage.tests.FileFieldStorageTests)
>>
>> --
>>
>> Traceback (most recent call last):
>>
>>   File 
>> "/Users/leec/Development/django/contrib_tutorial/django/tests/file_storage/tests.py",
>>  
>> line 566, in test_old_style_storage
>>
>> self.assertEqual(len(warns), 2)
>>
>> AssertionError: 4 != 2
>>
>>
>> ==
>>
>> FAIL: test_migrate_legacy_router (multiple_database.tests.RouterTestCase)
>>
>> --
>>
>> Traceback (most recent call last):
>>
>>   File 
>> "/Users/leec/Development/django/contrib_tutorial/django/tests/multiple_database/tests.py",
>>  
>> line 954, in test_migrate_legacy_router
>>
>> self.assertEqual(recorded, [])
>>
>> AssertionError: Lists differ: [> 0x10e915828>] != []
>>
>>
>> First list contains 1 additional elements.
>>
>> First extra element 0:
>>
>> {message : DeprecationWarning('inspect.getargspec() is deprecated, use 
>> inspect.signature() instead',), category : 'DeprecationWarning', filename : 
>> '/Users/leec/Development/django/contrib_tutorial/django/django/db/utils.py', 
>> lineno : 293, line : None}
>>
>>
>> - []
>>
>> + []
>>
>>
>> ==
>>
>> FAIL: test_if_tag_eq_deprecated 
>> (template_tests.syntax_tests.test_if.IfTagTests)
>>
>> --
>>
>> Traceback (most recent call last):
>>
>>   File 
>> "/Users/leec/Development/django/contrib_tutorial/django/django/test/utils.py",
>>  
>> line 182, in inner
>>
>> return test_func(*args, **kwargs)
>>
>>   File 
>> "/Users/leec/Development/django/contrib_tutorial/django/tests/template_tests/utils.py",
>>  
>> line 62, in inner
>>
>> func(self)
>>
>>   File 
>> "/Users/leec/Development/django/contrib_tutorial/django/tests/template_tests/syntax_tests/test_if.py",
>>  
>> line 537, in test_if_tag_eq_deprecated
>>
>> self.assertEqual(len(warns), 1)
>>
>> AssertionError: 3 != 1
>>
>>
>> ==
>>
>> FAIL: test_only_new_files 
>> (utils_tests.test_autoreload.TestFilenameGenerator)
>>
>> --
>>
>> Traceback (most recent call last):
>>
>>   File 
>> "/Users/leec/Development/django/contrib_tutorial/django/tests/utils_tests/test_autoreload.py",
>>  
>> line 87, in test_only_new_files
>>
>> self.assertEqual(len(filenames2), 1)
>>
>> AssertionError: 0 != 1
>>
>>
>> --
>>
>>
>> I'm guessing this is because something isn't quite right in my 
>> development set up but I haven't been able to figure out exactly what. If 
>> anyone can give me some pointers as to what I should check I'd really 
>> appreciate it.
>>
>>
>> OS: Mac OS X Yosemite (10.10.5)
>>
>> Python: 3.5.0
>>
>>
>> Thanks,
>>
>> Lee
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8c58224b-17eb-49fb-a43f-386312a687e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Errors in tests when working through contribution tutorial

2015-10-12 Thread Lee Cartwright
Hi,

I'm not sure if this is the right group for this question, but I figured it 
was the best place to start. I'm interested in contributing to the Django 
project and have spent some time today working through the contribution 
tutorial. I've got to the initial 'running tests' stage and have a few test 
errors that I cannot figure out. The output is:

==

FAIL: test_old_style_storage (file_storage.tests.FileFieldStorageTests)

--

Traceback (most recent call last):

  File 
"/Users/leec/Development/django/contrib_tutorial/django/tests/file_storage/tests.py",
 
line 566, in test_old_style_storage

self.assertEqual(len(warns), 2)

AssertionError: 4 != 2


==

FAIL: test_migrate_legacy_router (multiple_database.tests.RouterTestCase)

--

Traceback (most recent call last):

  File 
"/Users/leec/Development/django/contrib_tutorial/django/tests/multiple_database/tests.py",
 
line 954, in test_migrate_legacy_router

self.assertEqual(recorded, [])

AssertionError: Lists differ: [] != []


First list contains 1 additional elements.

First extra element 0:

{message : DeprecationWarning('inspect.getargspec() is deprecated, use 
inspect.signature() instead',), category : 'DeprecationWarning', filename : 
'/Users/leec/Development/django/contrib_tutorial/django/django/db/utils.py', 
lineno : 293, line : None}


- []

+ []


==

FAIL: test_if_tag_eq_deprecated 
(template_tests.syntax_tests.test_if.IfTagTests)

--

Traceback (most recent call last):

  File 
"/Users/leec/Development/django/contrib_tutorial/django/django/test/utils.py", 
line 182, in inner

return test_func(*args, **kwargs)

  File 
"/Users/leec/Development/django/contrib_tutorial/django/tests/template_tests/utils.py",
 
line 62, in inner

func(self)

  File 
"/Users/leec/Development/django/contrib_tutorial/django/tests/template_tests/syntax_tests/test_if.py",
 
line 537, in test_if_tag_eq_deprecated

self.assertEqual(len(warns), 1)

AssertionError: 3 != 1


==

FAIL: test_only_new_files 
(utils_tests.test_autoreload.TestFilenameGenerator)

--

Traceback (most recent call last):

  File 
"/Users/leec/Development/django/contrib_tutorial/django/tests/utils_tests/test_autoreload.py",
 
line 87, in test_only_new_files

self.assertEqual(len(filenames2), 1)

AssertionError: 0 != 1


--


I'm guessing this is because something isn't quite right in my development 
set up but I haven't been able to figure out exactly what. If anyone can 
give me some pointers as to what I should check I'd really appreciate it.


OS: Mac OS X Yosemite (10.10.5)

Python: 3.5.0


Thanks,

Lee

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/04857cd2-6698-4102-8cf6-d142c76360c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Query question

2015-08-17 Thread Lee Hinde
Given this model, I want to find all ProductSale objects that have expired
and where the Person doesn't have a later (unexpired) purchase of the same
product.

class ProductSale(models.Model):
product = models.ForeignKey(Product)
person = models.ForeignKey(Person)
...
date_expires = models.DateField(blank=True, db_index=True)


The closest I've gotten is in the shell where I get a values_list of person
and product for expired and unexpired and then compare the two lists. That
leaves me with a list of tuples, that (due to the size of the list, I
think) I can't use in a query.extra.

Any suggestions would be appreciated.

(and sorry for the lame subject. I couldn't think of a way to be both
succinct and informative.)

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMw3z0TwbHUOLwVKg26N5Bc1q6BQ014hsNVCiws1r083nA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Limit initial admin queryset

2015-07-23 Thread Lee Hinde
I have a model - Registrations. 97% of the time a user wants to see
'todays' registrations when viewing this model in admin. Is there a way to
set the initial display of records, but allow full access thereafter?

The example in admin.get_queryset assumes I want to manage each query. In
my case, I only want to manage those the user doesn't initiate.

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMwrwAyprMorYOxBd8Lhb%2BA9vt3_XaygFD0MhkEFN4XwhA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Easy to use graphical reporting tools for SQL

2015-07-21 Thread Lee Hinde
https://github.com/epantry/django-sql-explorer

You can build the queries and they're available to whomever you want to
give access. This assumes they have access to the django app.



On Mon, Jul 20, 2015 at 2:09 PM, Kevin  wrote:

> In our office we have a Django application that uses a MySQL database.
> Often I am asked to produce various reports that can range from being basic
> dumps of query results or aggregate computations on query results. To do
> this I must connect to the Django shell to use the ORM or write the SQL
> directly. The problem is that it is impossible for the non-developers to
> access reports unless they ask a developer to create the queries, run them,
> and send the result back. This adds to lots of communication overhead and
> delays.
>
> Is there a basic free or open-source application that can connect to MySQL
> and allow non-developers to graphically build their own queries?
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMzwo_KD_5NHPd7gtN1b9rrCi0F6b%3Do%3DqPYT%3D%3D2W%3DamwSw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there a plan to modernize Django-admin?

2015-07-21 Thread Lee Hinde
On Sat, Jul 18, 2015 at 12:25 AM, Stuart Longland <
stua...@longlandclan.yi.org> wrote:

> On 18/07/15 11:00, Ezequiel Bertti wrote:
> > Do you already see this project?
> >
> > https://github.com/sshwsfc/django-xadmin
>
> Unfortunately their homepage just swears at me in Chinese.


http://demo.xadmin.io/

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMwk4Jq5%2Bs%2BdVcHGiAR%3DLnXepCZ0jSL0vs0XkJZ6p1gz7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


preserve data when migrating ForeignKey to ManyToManyField

2015-07-14 Thread A Lee
I'd like to change a ForeignKey field into a ManyToManyField, preserving 
existing data by creating entries in the many-to-many through table. 
Running makemigrations after changing the model class creates a migration 
that executes a RemoveField on the existing ForeignKey field and then an 
AddField on the new ManyToManyField, which destroys any existing ForeignKey 
data.

I ended up implementing this by creating three migrations:

1. schema migration: create the new ManyToManyField
2. data migration: copy existing ForeignKey data into the ManyToManyField
3. schema migration: remove the ForeignKey field and rename the 
ManyToManyField

Is there a simpler way to do this type of schema change?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7981c18a-217f-4668-b8af-ea234bcad408%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Custom Users and ios django questions

2015-07-06 Thread Lee Kazushi
Hi everyone,

I am newbie in django so i'm a bit confused on some  features. I have to do 
a project for university. It consists in a desktop-web app where employees 
can do some staff like handle files, recording files, uploading files on a 
mysql database, and an ios native app (written in objective c) where a user 
can register himself, log in and ask for the data that the employees have 
saved early. 
First of all:  It's possible to do a server app that communicates with an 
ios app (sending-recieve data, notifications) using django-frameworks (and 
i suppose also django-rest-framework)? If yes, do you have some 
tutorials/guide/book to suggest to understand better how this communication 
work and how i can really do this thing?

My second question is related to Custumizing Users on Django.
For my project i need two classes of user:
- Employee (with registration_id as primary key): this user can only log in 
on desktop-app
- Driver : this user can only log in  on ios-app

can i have multiple custom users, for instance :
class Employees(AbstractBaseUser):
registration_id = models.IntegerField(max_length=10,unique=True, null=True, 
blank=True)
first_name = models.CharField(max_length=30, null=True, blank=True)
last_name = models.CharField(max_length=60, null=True, blank=True)
#etc etc etc

class Driver(AbstractBaseUser):
   license_plate =
   first_name = 
   #etc etc etc


is that reasonable?

Sorry for my bad English.
I will appeciate any kind of help
Thank you
Cheers


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2aa960dd-1b95-427e-bb41-c497fcb6333c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Possible bug in django 1.8 when following tutorial part 5

2015-05-20 Thread Mohd Lee
I just found out that it's actually caused by django-suit. They've had the 
fix checked in.

On Wednesday, May 20, 2015 at 5:46:34 PM UTC+8, Mohd Lee wrote:
>
> Hi guys, I notice this warning in the console when following tutorial 4 & 
> 5 in django 8 with Python 3.4:
> ...django/venv/lib/python3.4/site-packages/django/templatetags/future.py:25: 
> RemovedInDjango19Warning: Loading the `url` tag from the `future` library 
> is deprecated and will be removed in Django 1.9. Use the default `url` tag 
> instead.
>   RemovedInDjango19Warning)
>
> although "future" tag was never used, it's not even covered in the 
> tutorial. The above warning came after I've reach the last part of part 5 
> where I'm creating the test for "test_detail_view_with_a_future_question". 
> I later tested it manually by creating a future question in admin, and it 
> appear whenever I click on the future question from 
> http://127.0.0.1:8000/admin/polls/question/ . Refreshing the question 
> page itself will not produce this warning. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8a4fd30f-2feb-4e04-bd59-c54ea93162c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Possible bug in django 1.8 when following tutorial part 5

2015-05-20 Thread Mohd Lee
Hi guys, I notice this warning in the console when following tutorial 4 & 5 
in django 8 with Python 3.4:
...django/venv/lib/python3.4/site-packages/django/templatetags/future.py:25: 
RemovedInDjango19Warning: Loading the `url` tag from the `future` library 
is deprecated and will be removed in Django 1.9. Use the default `url` tag 
instead.
  RemovedInDjango19Warning)

although "future" tag was never used, it's not even covered in the 
tutorial. The above warning came after I've reach the last part of part 5 
where I'm creating the test for "test_detail_view_with_a_future_question". 
I later tested it manually by creating a future question in admin, and it 
appear whenever I click on the future question 
from http://127.0.0.1:8000/admin/polls/question/ . Refreshing the question 
page itself will not produce this warning. 

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e6a793f4-180f-4e10-a84f-66af2b6de457%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.8 data migrations not able to locate related collections

2015-04-17 Thread A Lee
Hi Markus, thanks for the fast response! Yup, that did the trick. I had to
do some manual copypasta into the stable/1.8.x branch to get it to run but
it appears that was the issue.

On Fri, Apr 17, 2015 at 9:45 AM, Markus Holtermann <i...@markusholtermann.eu
> wrote:

> Hi A Lee,
>
> I think I've seen that one before. Can you check if the fix for
> https://code.djangoproject.com/ticket/24573 resolves the issue?
>
> /Markus
>
>
> On Friday, April 17, 2015 at 2:52:26 AM UTC+2, A Lee wrote:
>>
>> Hello,
>>
>> After upgrading to 1.8 from 1.7.7 our tests are now unable to create test
>> data via data migrations and complain about related collections not
>> existing as attributes for some but not all models (exception stack trace
>> at https://travis-ci.org/virtualcommons/vcweb). It appears to succeed at
>> creating a model object for the first related collection but then dies when
>> attempting to create objects in the second related collection (
>> https://github.com/virtualcommons/vcweb/blob/develop/vcweb/experiment/forestry/migrations/0001_initial_forestry.py#L62
>> ).
>>
>> Any ideas on what might be causing this? Access to related collections
>> through the django shell and via the web interface still seem to be working
>> fine on 1.8, it's just the data migrations that are failing.
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bbb334b8-6d77-4954-9bb9-800fef266a10%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/bbb334b8-6d77-4954-9bb9-800fef266a10%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Django 1.8 data migrations not able to locate related collections

2015-04-16 Thread A Lee
Hello,

After upgrading to 1.8 from 1.7.7 our tests are now unable to create test 
data via data migrations and complain about related collections not 
existing as attributes for some but not all models (exception stack trace 
at https://travis-ci.org/virtualcommons/vcweb). It appears to succeed at 
creating a model object for the first related collection but then dies when 
attempting to create objects in the second related collection 
(https://github.com/virtualcommons/vcweb/blob/develop/vcweb/experiment/forestry/migrations/0001_initial_forestry.py#L62).
 

Any ideas on what might be causing this? Access to related collections 
through the django shell and via the web interface still seem to be working 
fine on 1.8, it's just the data migrations that are failing.

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/953aa2e6-9a41-4b56-b551-76babd94488c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Testing posts to S3

2015-02-11 Thread Lee Hinde
I'm using django storages/boto to push json files to s3 where they are to
be read by a different app.

I'd like to test the file push by using the Test Client to see if the file
is present on S3.

client = Client()
r = client.get(url, content_type="application/json")

In every case, r comes back as:



I can take the  'url' and paste it into my browser and get the file.

So, there's something about the process I'm not understanding. Is this not
what Client is intended for?

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMw-gi%2BMMKXRAVA6XbpSXGmCP38rc2c-c2%3DJQ%3D6bOcPc3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Change keys in values dictionary.

2015-01-05 Thread Lee Hinde
That example was just showing the part of the values 'grab' that was a
problem; in real life I'm getting data from Recipient as well.

On Sun, Jan 4, 2015 at 11:50 AM, Collin Anderson <cmawebs...@gmail.com>
wrote:

> Hi,
>
> Why not query it directly from Message?
>
> Message.objects.filter(recipient__user__system_id=user_id).values('id',
> 'subject')
>
> Collin
>
> On Friday, January 2, 2015 8:35:42 PM UTC-5, Lee Hinde wrote:
>>
>> If I do a query:
>>
>> messages = Recipient.objects.filter(user__system_id=user_id).values("
>> message__id","message__subject")
>>
>> and then
>>
>> {"data":list(messages)}
>>
>> jsonify it, I end up with:
>>
>>   "data" : [
>> {
>>   "message__id" : "2f24d132-4321-4d63-868a-21de6fbc0d44",
>>   "message__subject" : "And look, a new subject."
>> }
>>   ],
>>
>> Let's assume there are lots of messages.
>>
>> What's the best way rename the keys? I.e, I'd like "message__id" to be
>> "id".
>>
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMxqo9gd_6HiUM8wuZmGs2FSOdyJn3qRUUfuvmTgTDuYmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Change keys in values dictionary.

2015-01-02 Thread Lee Hinde
If I do a query:

messages =
Recipient.objects.filter(user__system_id=user_id).values("message__id","message__subject")

and then

{"data":list(messages)}

jsonify it, I end up with:

  "data" : [
{
  "message__id" : "2f24d132-4321-4d63-868a-21de6fbc0d44",
  "message__subject" : "And look, a new subject."
}
  ],

Let's assume there are lots of messages.

What's the best way rename the keys? I.e, I'd like "message__id" to be "id".

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMwXBvBC2tLTY1mCWyNcJgYe6v1ybpRd16qhRYwJ8Ta%2Bcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django REST Framework: How to add prefix in URL for versioning

2014-11-05 Thread Lee Hinde
Swap the urls:

 url(r'^v1/', include(v1_urls, namespace="v1"))

url(r'^', include(default_urls, namespace="default")),


On Wed, Nov 5, 2014 at 5:01 AM, Shoaib Ijaz  wrote:

> I am trying to create version for REST application. Here is my URL Examle
>
> www.myapi.com/foo [default version]
> www.myapi.com/v1/foo [version one]
>
> This is the project structure
>
> ├── __init__.py├── settings.py├── urls.py├── default_app│ ├── __init__.py│ 
> ├── serializer.py│ ├── models.py│ ├── views.py│ ├── urls.py│ └── v1_app├── 
> __init__.py├── serializer.py├── models.py├── views.py├── urls.py
>
> *default_app urls.py*
>
> from django.conf.urls import *from default_app import views as df_viewsfrom 
> rest_framework import routers
>
> router = routers.DefaultRouter()
> router.register(r'foo', df_views.viewname, "foo")
> urlpatterns = router.urls
>
> *v1_app urls.py*
>
> from django.conf.urls import *from v1_app import views as ver_viewsfrom 
> rest_framework import routers
>
> router = routers.DefaultRouter()
> router.register(r'foo', ver_views.viewname, "foo")
> urlpatterns = router.urls
>
> *main file for urls.py*
>
> from django.conf.urls import patterns, include, urlfrom defualt_app import 
> urls as default_urlsfrom v1_app import urls as v1_urlsfrom 
> django.contrib.staticfiles.urls import staticfiles_urlpatterns
>
>
>
> urlpatterns += patterns('',
> url(r'^', include(default_urls, namespace="default")),
> url(r'^v1/', include(v1_urls, namespace="v1")))
>
> urlpatterns += staticfiles_urlpatterns()
>
> My issue is, when i using simple url without any prefix then it is working
>
> www.myapi.com/foo
>
> and when i used version prefix v1 or v2 then it throws error [Page not
> found (404)]
>
> www.myapi.com/v1/foo
>
> I got this idea from this link http://stackoverflow.com/a/21839842/1558544
>
> If I don't use middleware class then is this possible to get same result?
>
> Thank you
>
>
>

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


Re: djangoproject.com tutorial part 3

2014-10-21 Thread Lee
Im not sure I understand so maybe I am stating the obvious here... but 
"python manage.py runserver" shouldnt call the page. It should start your 
dev server. Then you call http://localhost:8000/polls as Daniel mentioned 
when the server is started. 

On Tuesday, 21 October 2014 18:14:34 UTC+1, Tri Vo wrote:
>
> Ok, I forgot say this. I'm using a different server to run Django. It 
> works on the server that I am using. 
>
> On Tue, Oct 21, 2014 at 3:42 AM, Daniel Roseman  > wrote:
>
>> On Tuesday, 21 October 2014 00:01:56 UTC+1, Tri Vo wrote:
>>>
>>> I am calling the page with "python manage.py runserver 0.0.0.0:8000" 
>>> When I load up the page before adding the views and urls files, I see the 
>>> polls and everything that I have set up with the codes from the previous 
>>> pages of the tutorial. After adding the  views and urls files, the page 
>>> looks the same like, even though the direction tells me that I should see 
>>> the "Hello world" message that I put in the views file. I ran another 
>>> directory with different way to put up the views like in this tutorial (
>>> http://www.djangobook.com/en/2.0/chapter03.html) and I got the views 
>>> working by itself, but using the djangoproject tutorial, I do not see the 
>>> message.
>>>
>>
>> You didn't read closely enough:
>>
>> "You have now wired an index view into the URLconf. Go to **
>> http://localhost:8000/polls/** in your browser, and you should see the 
>> text “Hello, world. You’re at the polls index.”, which you defined in the 
>> index view."
>>
>> Note the address.
>> --
>> DR.
>>
>> -- 
>> 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/OuG_9XUozlQ/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/ee6f6ec9-f8e6-4101-8aa4-3e388a9d8ffa%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3e77b7bd-a8e0-4ef0-addb-d0fcd3afd06c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: djangoproject.com tutorial part 3

2014-10-20 Thread Lee
When you say nothing changes, how are you calling the page? And what do you 
see in your browser - any error message or stack trace or is it just a 
blank page?

Also I assume the below were copied from the tutorial. Can you post the 
contents of the three files as you typed them in your code?

On Monday, 20 October 2014 04:31:57 UTC+1, Tri Vo wrote:
>
> So I am following the tutorial in this site, and copy and the first three 
> codes into my project (polls/views.py, polls/urls.py, and mysite/urls/py)
> https://docs.djangoproject.com/en/1.7/intro/tutorial03/
>
> polls/views.py
>
> from django.http import HttpResponse
>
> def index(request):
> return HttpResponse("Hello, world. You're at the polls index.")
>
>
> polls/urls.py
>
> from django.conf.urls import patterns, url
> from polls import views
> urlpatterns = patterns('',
> url(r'^$', views.index, name='index'),)
>
> The next step is to point the root URLconf at the polls.urls module. In 
> mysite/urls.pyinsert an include() 
> , 
> leaving you with:
> mysite/urls.py
>
> from django.conf.urls import patterns, include, urlfrom django.contrib import 
> admin
> urlpatterns = patterns('',
> url(r'^polls/', include('polls.urls')),
> url(r'^admin/', include(admin.site.urls)),)
>
>
> When I launch my site, nothing changes. I do not see the "hello, world..." 
> message at all. What did I do wrong?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/33a5f0c4-2dba-4c3b-b1aa-d2f024f27c38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Config: DB or git?

2014-10-02 Thread Lee
Isnt convenience vs flexibility the difference between choosing to use a 
full CMS and choosing to use a web development framework? Id look for that 
in the former, but not the latter - though Im sure .net "programmers" would 
disagree ;-)

On Thursday, 2 October 2014 12:23:15 UTC+1, guettli wrote:
>
> Am 01.10.2014 um 14:56 schrieb Collin Anderson: 
> > If you're a programmer or sysadmin, configuration should be done in 
> files. If you're not a programmer or sysadmin, it 
> > should be done in the database. 
>
> Why do you look the person for a decision like this? 
>
> Wouldn't it be better to look at the data which gets configured here? 
>
> I love git like most programmers love their version control system. 
>
> But for most stuff config in DB is much better. 
>
> example: INSTALLED_APPS 
>
> Wouldn't it be really cool if you could add an app by pressing a button? 
>
>Thomas 
>
>
>
> -- 
> Thomas Güttler 
> http://thomas-guettler.de/ 
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/304ef621-5eed-4ed5-ad23-e684f23cb03b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help me: Django 1.6.4 + mod_wsgi Error

2014-09-18 Thread Yj Lee
I have same issue on my local computer. please help me, 

2014년 7월 10일 목요일 오전 8시 18분 4초 UTC+9, Russell Keith-Magee 님의 말:
>
> Hi LongYuan,
>
> It's difficult to say for certain, but it looks to me like your Django 
> install is corrupted. The error you're seeing indicates that an import is 
> failing; if you've got a clean install of Django 1.6.4 like you say, that 
> import should work without any problems.
>
> Two things to try:
>
>  * Start up a Python shell manually, using the same version of Python as 
> Apache is using. See if the import fails there as well.
>
>  * Re-install Django. Make sure that you *completely* uninstall it first, 
> so there's no chance that stale files are lingering, and then reinstall.
>
> Yours,
> Russ Magee %-)
>
>
> On Wed, Jul 9, 2014 at 3:01 PM, LongYuan  
> wrote:
>
>> [Wed Jul 09 14:51:19 2014] [error]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\utils\\encoding.py", line 14, in 
>> 
>> [Wed Jul 09 14:51:19 2014] [error] from 
>> django.utils.six.moves.urllib.parse import quote
>> [Wed Jul 09 14:51:19 2014] [error] ImportError: cannot import name quote
>>
>>
>> The Apache2.2 service is restarting.
>> The Apache2.2 service has restarted.
>> arent: Received restart signal -- Restarting the server.
>> [Wed Jul 09 09:51:47 2014] [notice] Child 12544: Exit event signaled. 
>> Child process is ending.
>> [Wed Jul 09 09:51:47 2014] [warn] mod_wsgi: Compiled for Python/2.7.6.
>> [Wed Jul 09 09:51:47 2014] [warn] mod_wsgi: Runtime using Python/2.7.3.
>> [Wed Jul 09 09:51:47 2014] [notice] Apache/2.2.25 (Win32) mod_wsgi/3.5 
>> Python/2.7.3 configured -- resuming normal operations
>> [Wed Jul 09 09:51:47 2014] [notice] Server built: Jul 10 2013 01:52:12
>> [Wed Jul 09 09:51:47 2014] [notice] Parent: Created child process 7956
>> [Wed Jul 09 09:51:47 2014] [warn] mod_wsgi: Compiled for Python/2.7.6.
>> [Wed Jul 09 09:51:47 2014] [warn] mod_wsgi: Runtime using Python/2.7.3.
>> [Wed Jul 09 09:51:47 2014] [notice] Child 7956: Child process is running
>> [Wed Jul 09 09:51:48 2014] [notice] Child 12544: Released the start mutex
>> [Wed Jul 09 09:51:48 2014] [notice] Child 7956: Acquired the start mutex.
>> [Wed Jul 09 09:51:48 2014] [notice] Child 7956: Starting 64 worker 
>> threads.
>> [Wed Jul 09 09:51:48 2014] [notice] Child 7956: Starting thread to listen 
>> on port 80.
>> [Wed Jul 09 09:51:49 2014] [notice] Child 12544: All worker threads have 
>> exited.
>> [Wed Jul 09 09:51:49 2014] [notice] Child 12544: Child process is exiting
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] mod_wsgi 
>> (pid=7956): Target WSGI script 'F:/dj_spiders/dj_spiders/wsgi.py' cannot be 
>> loaded as Python module.
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] mod_wsgi 
>> (pid=7956): Exception occurred processing WSGI script 
>> 'F:/dj_spiders/dj_spiders/wsgi.py'.
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] Traceback (most 
>> recent call last):
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1]   File 
>> "F:/dj_spiders/dj_spiders/wsgi.py", line 13, in 
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] from 
>> django.core.wsgi import get_wsgi_application
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\core\\wsgi.py", line 1, in 
>> 
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] from 
>> django.core.handlers.wsgi import WSGIHandler
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line 
>> 9, in 
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] from django 
>> import http
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\http\\__init__.py", line 1, in 
>> 
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] from 
>> django.http.cookie import SimpleCookie, parse_cookie
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\http\\cookie.py", line 3, in 
>> 
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] from 
>> django.utils.encoding import force_str
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\utils\\encoding.py", line 11, in 
>> 
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] from 
>> django.utils.six.moves.urllib.parse import quote
>> [Wed Jul 09 09:51:49 2014] [error] [client 127.0.0.1] ImportError: cannot 
>> import name quote
>>
>> -- 
>> You received this message because you are subscribed 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 http://groups.google.com/group/django-users.
>> To view this discussion 

develeopment servers stops at syntax error.

2014-09-12 Thread Lee
Providing the actual error and traceback would be the only way we can really 
help you. Could you paste that here?

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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/47a70eff-f2f2-4396-b34f-618ce00cdd6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: tracking intent during password reset process

2014-09-06 Thread Lee Hinde
Both interesting ideas and the intercepting view seems obvious (now that
you've pointed it out.)

Thanks.


On Sat, Sep 6, 2014 at 1:11 AM, James Schneider <jrschneide...@gmail.com>
wrote:

> Curious, hen you say 'touch contrib.auth.views.py', you don't mean
> modifying the Django core, do you?
>
>
> Assuming that you are using contrib.auth.views.password_reset (you may
> need to adjust this strategy for a custom view, etc.):
>
> A quick custom view that simply sets a parameter when it calls the generic
> view and a tweak to the URLconf could solve this:
>
> Only need a single URLconf line for something like 'password/reset/' that
> calls the custom view. All password resets will run through this URL
> regardless of 'authorization level', as you put it.
>
> url(r'^password/reset/$', myviews.pass_reset_set_redirect,
> name='password_reset')
>
> In your templates, for each area, such as /instructor/*, the link to the
> password reset would look something like  %}?next=instructor'. This will create a link to a URL path like
> 'password/reset?next=instructor'. How you generate that link (either based
> on context vars or directly in the template) is up to you and your design.
>
> Custom view:
>
> def pass_reset_set_redirect(request):
>
> DEFAULT_LOCATION = 'public'
>
> locations = { 'public': 'public_home', 'instructor':
> 'instructor_home', 'staff': 'staff_home' } # *_home are the names of the
> URL's that will be used for the redirect and should be resolvable by
> reverse(), etc.
>
> # set a default in the event that the ?next=* parameter is something
> that is not a key in locations
> redirect_url = locations[DEFAULT_LOCATION]
>
> # DEFAULT_LOCATION gets used if ?next=blah is not given at all
> if request.GET.get('next', DEFAULT_LOCATION) in locations:
> redirect_url = locations[request.GET.get('next')]
>
> # call the generic view with post_reset_redirect set to our URL name
> with all the benefits of Django doing the hard part of handling the rest of
> the request
> #
> https://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.views.password_reset
>
> return contrib.auth.views.password_reset(request, 
> post_reset_redirect=redirect_url)
>
>
> I haven't tested this so YMMV, and it probably needs a couple of imports,
> etc., but I'm hoping you get the idea. This approach is somewhat extensible
> as the locations can be easily expanded to adapt to new 'authorization'
> levels if you decide you need them, or can be pulled from the database, etc.
>
> Someone let me know if I'm way off here, haven't written a FBV for a few
> years.
>
>
>
> On Fri, Sep 5, 2014 at 3:13 PM, Koed00 <koe...@gmail.com> wrote:
>
>> I've been adding #tags to my auth urls to redirect traffic after signups
>> and resets. This keeps most of the routing intact, but gives you a hook to
>> redirect on in a later stage.
>> However, I'm not using django-registration so I can't give you any
>> examples.
>>
>>
>> On Friday, September 5, 2014 11:23:54 PM UTC+2, Lee Hinde wrote:
>>>
>>> I have three primary levels of access in my project.
>>>
>>> The public at /
>>> Instructors at /instructor/
>>> Staff at /staff/
>>>
>>> The issue is with the password reset process.
>>>
>>> If someone comes to /instructor/ and then goes through the password
>>> reset process I want them to end up at /instructor/ when they're done.
>>> Currently I've got everyone going to
>>> / because I'd rather confuse staff and instructors than the public.
>>>
>>> I'm not sure how to carry their original intended url / level through to
>>> the end of the reset process. I am loath to touch contrib.auth.views.py
>>> for fear of introducing some obscure, or not so obscure, bug.  Users can be
>>> authorized to all three levels so monitoring their user level doesn't work.
>>>
>>> I'm using django registration, hence registration/auth_urls.py and it
>>> occurred to me to just duplicate (or triplicate) the pertinent urls so that
>>> password/reset/complete/ becomes instructor/password/reset/complete/
>>> and I could pass the appropriate next url to extra_context. But that
>>> doesn't seem very DRY so I thought I'd check in here to see if there was a
>>> better way.
>>>
>>> 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

tracking intent during password reset process

2014-09-05 Thread Lee Hinde
I have three primary levels of access in my project.

The public at /
Instructors at /instructor/
Staff at /staff/

The issue is with the password reset process.

If someone comes to /instructor/ and then goes through the password reset
process I want them to end up at /instructor/ when they're done. Currently
I've got everyone going to
/ because I'd rather confuse staff and instructors than the public.

I'm not sure how to carry their original intended url / level through to
the end of the reset process. I am loath to touch contrib.auth.views.py for
fear of introducing some obscure, or not so obscure, bug.  Users can be
authorized to all three levels so monitoring their user level doesn't work.

I'm using django registration, hence registration/auth_urls.py and it
occurred to me to just duplicate (or triplicate) the pertinent urls so that
password/reset/complete/ becomes instructor/password/reset/complete/ and I
could pass the appropriate next url to extra_context. But that doesn't seem
very DRY so I thought I'd check in here to see if there was a better way.

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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMy8NfRxYyQHLbzvuZLO42MQSgcGCYLHuyFCD3CrSdY3mA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: cms web buyilding

2014-08-18 Thread Lee
Did you even read the replies you already received? I can't help but think you 
are trolling this board and on that basis, this'll be the last time I respond 
to any of your questions.

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ac990362-5127-4f2a-9a33-572f3548f8ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: cms web buyilding

2014-08-16 Thread Lee
Most cms' of that ilk fits a very specific set of needs. Once you need to move 
outside the mould they give you and need to customise it for a specific 
business requirement, without some level of understanding of coding and the 
chosen cms' underpinnings he'll find it very difficult to proceed any further. 
This is one of the reasons than you see many cms sites based on those platforms 
that look exactly the same, there are a lot of poor quality web debs out there. 

But you don't need to reason with him on his abilities. You do what is right 
for you and if you put the effort in, you'll end up a far more useful resource 
than he ever will with that mindset

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ae57447f-7773-43aa-aecc-f505a58d3f29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Flatpages

2014-08-15 Thread Lee Hinde
I just logged into the backend to make sure the django_flatpage_sites table
was populated and it is.


On Fri, Aug 15, 2014 at 2:21 PM, Lee Hinde <leehi...@gmail.com> wrote:

> Yes.
>
>
> On Fri, Aug 15, 2014 at 2:10 PM, Collin Anderson <cmawebs...@gmail.com>
> wrote:
>
>> SITE_ID is set, but is the correct site selected on the flatpage?
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMzbRnrmOu6bFM3OHcvkkXdbS78C1T8dzvnnDw9__KDHCA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Flatpages

2014-08-15 Thread Lee Hinde
Yes.


On Fri, Aug 15, 2014 at 2:10 PM, Collin Anderson 
wrote:

> SITE_ID is set, but is the correct site selected on the flatpage?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMyQ8qR1Cx4M8cdLmN-A%3DKkz4WY4xYg1Lv9eWGb4%2B391QQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Flatpages

2014-08-15 Thread Lee Hinde
I don't have APPEND_SLASH in my settings and the default is True, so I
don't think that's it.

Also, I used the django extension show_urls and the flatpages url showed up
in the output, so I think it's in the chain.


On Fri, Aug 15, 2014 at 12:19 PM, C. Kirby <mist...@gmail.com> wrote:

> There is a warning about APPEND_SLASH = False in the flatpages
> documentation:
>
> Warning
>
> If you set APPEND_SLASH
> <https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-APPEND_SLASH>
> to False, you must remove the slash in the catchall pattern or flatpages
> without a trailing slash will not be matched.
> Could it be that?
>
>
> On Friday, August 15, 2014 1:58:49 PM UTC-5, Lee Hinde wrote:
>
>> Yes, it's a record in the flatpages table on the production side.
>>
>>
>> On Fri, Aug 15, 2014 at 11:43 AM, Collin Anderson <cmawe...@gmail.com>
>> wrote:
>>
>>> I also assume you added the page to the production database and not just
>>> your dev database (if they're different)?
>>>
>>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMyFy8cMin5PU6oBjMj7jxfTgiyMbYS1_FqTNPprPYZgjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Flatpages

2014-08-15 Thread Lee Hinde
Yes, it's a record in the flatpages table on the production side.


On Fri, Aug 15, 2014 at 11:43 AM, Collin Anderson 
wrote:

> I also assume you added the page to the production database and not just
> your dev database (if they're different)?
>
> --
> You received this message because you are subscribed to the Google Groups
> "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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b3aecbf7-9dca-44b7-88e9-49ef80f2fb94%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMxz0OQcPFw4tt7Z4NUO-pcfKbmo4V78Lx76CVsVYCSf9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Flatpages

2014-08-15 Thread Lee Hinde
Yes, ALLOWED_HOSTS is set. This site has been in production since late
March, so it's otherwise a going concern. (1.6.x, which I didn't mention
earlier).


On Fri, Aug 15, 2014 at 11:37 AM, Lee Hinde <leehi...@gmail.com> wrote:

> It's the only page; I'll double-check allowed hosts...
>
> Thanks.
>
>
> On Fri, Aug 15, 2014 at 11:30 AM, C. Kirby <mist...@gmail.com> wrote:
>
>> Is it only occurring on the flatpages test page or all your pages (or is
>> that the only page)? Remember you need ALLOWED_HOSTS set in production[1]
>>
>> [1]https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
>>
>>
>> On Friday, August 15, 2014 12:40:43 PM UTC-5, Lee Hinde wrote:
>>>
>>> I added flatpages to a project and got it working fine locally, using
>>> dev server, but I get a 404 accessing my test page when I push to
>>> production.
>>>
>>> Googling the issue,  most common complaints fixed by making sure SITE_ID
>>> was set, and that's in place in my site.
>>>
>>> I'm not using middleware, I'm using the url:
>>>
>>> urlpatterns += patterns('django.contrib.flatpages.views',
>>>
>>> (r'^(?P.*/)$', 'flatpage'),
>>>
>>> )
>>>
>>> I'm not sure how to debug this...
>>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMwyZMxmKuAwtOtkZ%3DHjB_s5MsMhaHFEYChiGKg6xFxU1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Flatpages

2014-08-15 Thread Lee Hinde
It's the only page; I'll double-check allowed hosts...

Thanks.


On Fri, Aug 15, 2014 at 11:30 AM, C. Kirby <mist...@gmail.com> wrote:

> Is it only occurring on the flatpages test page or all your pages (or is
> that the only page)? Remember you need ALLOWED_HOSTS set in production[1]
>
> [1]https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
>
>
> On Friday, August 15, 2014 12:40:43 PM UTC-5, Lee Hinde wrote:
>>
>> I added flatpages to a project and got it working fine locally, using dev
>> server, but I get a 404 accessing my test page when I push to production.
>>
>> Googling the issue,  most common complaints fixed by making sure SITE_ID
>> was set, and that's in place in my site.
>>
>> I'm not using middleware, I'm using the url:
>>
>> urlpatterns += patterns('django.contrib.flatpages.views',
>>
>> (r'^(?P.*/)$', 'flatpage'),
>>
>> )
>>
>> I'm not sure how to debug this...
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMz%3DaXn5wWkQYnzqGH1YTSowNSJj%3Dwco57VTc5txOitiZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Flatpages

2014-08-15 Thread Lee Hinde
It's /test/. The flatpages admin form won't accept a url that doesn't begin
and end in a slash.


On Fri, Aug 15, 2014 at 10:55 AM, Collin Anderson 
wrote:

> What is your page's url? Does it end with a slash?
>
> --
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMxqM5WCMf_o%2Bv4Ev4T23zcT9eiRnO68hKH8%2BTALRJP0CQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Flatpages

2014-08-15 Thread Lee Hinde
I added flatpages to a project and got it working fine locally, using dev
server, but I get a 404 accessing my test page when I push to production.

Googling the issue,  most common complaints fixed by making sure SITE_ID
was set, and that's in place in my site.

I'm not using middleware, I'm using the url:

urlpatterns += patterns('django.contrib.flatpages.views',

(r'^(?P.*/)$', 'flatpage'),

)

I'm not sure how to debug this...

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMx4k-rcotED1wjaXUaeMaahkvuOeVg6VFMpjV7zhC%3DPpQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: mixing python , php and django

2014-08-14 Thread Lee
If its just the two of you creating small web site projects then I doubt 
its worth the cost in time, effort and money for the added complexity that 
would be present with using two different server side languages. I'd 
suggest working out some common ground personally, rather than going that 
route. 

On Thursday, 14 August 2014 14:35:46 UTC+1, Derek wrote:
>
> It can work any way you need it to.  It really depends on what aspects he 
> needs to handle and which are yours.
>
> If, for example, you create the back-end with the DB and models, then he 
> can communicate from the front-end, using JSON data via GET/PUT requests. 
>  One way for you to handle this on the back-end is via Tastypie - see 
> http://tastypieapi.org/ .  I don't write PHP, but I can see at least one 
> web link showing how this could be done: 
> http://www.littlehart.net/atthekeyboard/2010/12/15/fun-with-apis-frapi-and-django-tastypie/
>
>
> On Thursday, 14 August 2014 11:09:14 UTC+2, ngangsia akumbo wrote:
>>
>> can i have a link on how that works?
>>
>> On Thursday, August 14, 2014 9:38:15 AM UTC+1, Erik Cederstrand wrote:
>>>
>>> Den 14/08/2014 kl. 10.24 skrev ngangsia akumbo : 
>>>
>>> > I am working with a php guy in my office . 
>>> > He is asking me how can we mix php and django? 
>>> > Cos he want that when we have a project to do he should be able to 
>>> paticipate using php in building the project 
>>> > 
>>> > can someone give me some tips 
>>>
>>> The most smooth approach I can think of is that you let PHP and Python 
>>> communicate via JSON APIs that you agree on. That, or tell him to 
>>> capitulate to the REAL Benevolent Dictator For Life. 
>>>
>>> Erik
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/88cb581c-d705-42d1-a191-67b34eb04197%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: school website

2014-08-13 Thread Lee Hinde
You might check out: https://github.com/burke-software




On Tue, Aug 12, 2014 at 7:24 AM, ngangsia akumbo  wrote:

> i have a website to build
>
> it will consist of 4 groups
> students, staff, parents and courses
>
> students will have the following
> profile
> update
> delete
> access courses
> student will only access the course they registered in
>
> staffs will be able to just update information
>
> parents
> will have profile, update, delete,  profile access information
>
> course \
> out line of all courses
> only courses registered can be access bu that student
>
> student should also be able to send messages to each other
>
> i have never done this kid of project, i some guideline on how to go about
> with this
>
> thanks for sincere response
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMx0LYObGA%2BrLqMJaaY6%3Dv0vTJbs_vRtzwr0c5ke9xDi3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: admin site not available after modifying base_site.html

2014-08-07 Thread Lee
You shouldn't need to run runserver.py directly. You should change into 
your project directory (where manage.py lives) and use:

python manage.py runserver


On Thursday, 7 August 2014 03:10:44 UTC+1, Eric G wrote:
>
> Yeah, I tried running the runserver.py script from the django-trunk file, 
> and the error message was:
>
> ImportError: Could not import settings 'myproject.settings.admin' (Is it 
> on sys.path? Is there an import error in the settings file?): No module 
> named myproject.settings.admin
>
> On Wednesday, August 6, 2014 5:41:55 PM UTC-7, Collin Anderson wrote:
>>
>> Is there an error message on the runserver console? Or is it possible to 
>> start a new one?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d896def0-9228-4dd8-80c1-e2804a26889f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Community blog posts

2014-08-01 Thread Lee
Am I the only one who gets irritated by the periodic mass re-posting of strings 
of old blog articles to the community feed on djangoproject? I want to see 
fresh stuff I've not seen before, not the same rubbish I ignored the first 
three times it was posted. Seems like a pretty cheap shot to keep driving 
traffic to your sites to me...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6194e2b3-281c-4e6d-ab04-9e9e785b6c48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Screenshot pdf from AWS hosted django app

2014-07-25 Thread Lee Hinde
On Fri, Jul 25, 2014 at 4:00 PM, Ralph Lewis 
wrote:

> I am hosting a django webapp in AWS and that is running fine, no errors. I
> now want to be able to take a screenshot of the first page of any pdf that
> is uploaded to the webapp. I have not had any luck trying to screenshot a
> pdf with python. I have heard this can be done with PythonMagick, however,
> I have not been able to get ImageMagick to work on my local dev instance.
> Any guidance would be excellent.
>
>
> Do you have a budget?

https://transloadit.com/docs/conversion-robots#document-thumbs

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMwfT_S69Qd6KWa%2BCq%2BO7PVD1F%2BGyzFs%3DH-wZ_5r%3D7iGzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


creating parent record as part of creating the child record

2014-07-16 Thread Lee Hinde
I need help understanding the flow of saving an object when using Model
Forms and Create Views.

I am using a CreateView class and a Model Form to create the line item of
an invoice and the parent invoice as part of the same user process. - It's
one step as far as the user is concerned.

The parent invoice data can be mostly inferred, i.e, current date, current
user, etc. There is some data that I collect on the line item form, that
is, it's posted, but not part of the Form design itself, I'm manually
adding the fields to the template.  Specifically, the "payer" information
is posted, but isn't part of the line-item form (it's a foreign key in the
invoice table)

I need to create the Invoice before I can save the line item object.

I'm not clear on where in the event chain I should add the Invoice record
creation.  I don't think I can access the request in the form methods,
otherwise I might do it in the form save method, or maybe the
clean_invoice() method.

Without the invoice data I don't get to form_valid in my view.

I'm also gathering payment information, which lives in another 'many'
table. I think I'll be able to process that in the form_valid method of the
view, but I'm not there yet.

I've cobbled all of this using function views in other parts of the
project, manually grabbing post values, etc. but I'm circling back here
because I know I have more to learn about how I think django wants to work.

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMzHhnwL-h%2BcDvvwBg_gOsoUkEPX9nq%2Bxa_1Ufk2zqFRbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django admin

2014-07-10 Thread Lee
I don't want to come across as unhelpful but people will really appreciate it 
if you at least try the following:

1) Properly and clearly describe your problem
2) At least show what you've done so far to try to resolve it
3) Accept and action guidance those here have been kind enough to provide it
4) Learn how to use the documentation and google. These should really be your 
first port of call, not the last

I'd recommend once again that you work through and complete the Django tutorial 
and build the application yourself as already suggested by others. There is a 
whole section on customising the admin and you'll learn all the basics you need 
to work with Django

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/92fc3455-f9f6-4bc5-aadb-be28cbe4b865%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Beginning with a feature flag system

2014-07-09 Thread Lee
Godjango has a short video on waffle. Might be enough to give you an idea on 
how to use it

https://godjango.com/31-django-waffle/

I've not watched it myself yet though

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/158c6b8b-1f75-4789-9b1d-09b365fbb31a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to install Django on Windows - pip, command prompt.

2014-07-05 Thread Setiaman Lee
You can get and install python from activestate.com where pip is included.
So you can run pip from command prompt.

Rgrds
Setiaman
On 6 Jul 2014 11:44, "Sen"  wrote:

> I was going through
> https://docs.djangoproject.com/en/1.6/howto/windows/#how-to-install-django-on-windows
> I could follow until "In the command prompt, execute the following
> command: pip install django. This will download and install Django."
> I'm not sure which command prompt and "pip install django" doesn't work on
> either powershell or python shell.
> "pip" is not a proper comlet and "install" is not a proper syntax in
> python shell.
> I'm not sure what I'm missing. Is there any other way to install django?
>
> --
> You received this message because you are subscribed to the Google Groups
> "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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/72edd907-1b13-428c-aa8e-8f3853d0534b%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADPvYxhwAi55Jxtkbq55G9hqmhmDumJqt6EN_nNjn0sRY2FOPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: page not found errors for most urls but main landing page displaying okay

2014-07-01 Thread Lee
Thank you everyone. I solved the problem. It was a relative vs absolute url 
issue. There was a line in the static/js/applications.js file that had to 
be changed:
RELATIVE_URL = '/myproject';  //for development leave this blank. For 
production it should be '/myproject'

This was hard to debug because I'm doing this on a shared host and don't 
have access to the Apache logs - it was hard to figure out where the URLs 
were going. Also this is a project developed by someone else so I did not 
know about this setting in the js.

L

On Thursday, June 26, 2014 10:35:03 AM UTC-4, Vijay Khemlani wrote:
>
> Is it possible that the app is getting confused because it is not running 
> at the root of the domain (/) but instead on a subdirectory (/project/)?
>
>
> On Wed, Jun 25, 2014 at 11:51 PM, Kelvin Wong <wong...@gmail.com 
> > wrote:
>
>> If you have access to your logs, check your logs to figure out where 
>> those requests are going.
>>
>> You can also SSH into the server and temporarily turn on the DEBUG=True, 
>> TEMPLATE_DEBUG=True and let Django tell you what is going on.
>>
>> Without seeing your fcgi script, my guess is that it is Apache not 
>> mapping the request to your WSGI file/fcgi script. Double check your 
>> htaccess file mod_rewrite directives.
>>
>> K
>>
>>
>>
>> On Wednesday, June 25, 2014 2:53:21 PM UTC-7, Lee wrote:
>>>
>>> Thanks - it must be a problem with the site accessing templates but I 
>>> can't figure it out. This django project works on another server but I have 
>>> copied it to a shared host webserver  (Bluehost) and am running it with 
>>> fcgi so maybe the problem is in the setup.
>>>
>>> I am focusing on one url and template, but all have the same problem 
>>> except the main landing page, which does work.
>>>
>>> The url http://mysite/project/map/nav/ shows the right text without any 
>>> styling
>>> This is the url pattern for this page in urls.py.
>>> url(r'^map/nav/$', 'citi_digits.views.mapNavigation', name='mav_nav'),
>>>
>>> The view for this url references the template:
>>> def mapNavigation(request):
>>> """
>>> Loads the map navigation elements
>>> """
>>> #get all classes
>>> #get classes
>>> classes = Teacher.objects.values_list('className', flat=True)
>>> return render_to_response('map_navigation.html',{'classes':
>>> classes},context_instance=RequestContext(request))
>>>
>>> In the settings.py the setting for templates is:
>>> TEMPLATE_DIRS = (
>>> os.path.join(PROJECT_ROOT, '..', 'citi_digits','templates'),
>>>
>>> I also tried an absolute path and put the templates in www but this did 
>>> not work.
>>>
>>> My static settings are:
>>>
>>> STATIC_ROOT = '/home5/user/public_html/project/static/'
>>> STATIC_URL = 'http://mysite.org/project/static/'
>>>
>>> Lee
>>>
>>>
>>>
>>> On Wednesday, June 25, 2014 3:36:52 PM UTC-4, Michael Lind Hjulskov 
>>> wrote:
>>>>
>>>> Hi
>>>>
>>>> I had the exact same problem a few days ago. It was one of my templates 
>>>> that suddenntly was emty. very spooky
>>>> Or maybe you have an "extends" somewhere that is not correct
>>>> I would debug by looking in the relevant view and see which template is 
>>>> called, and the simplify that template to test if bug is in templates or 
>>>> elsewhere
>>>>
>>>> Michael
>>>>
>>>> Den onsdag den 25. juni 2014 21.08.35 UTC+2 skrev Lee:
>>>>>
>>>>> I have copied a Django project to my web server from a repo and am 
>>>>> getting the correct initial landing page for the website with the right 
>>>>> styling when I go to the main URL. Most other urls give "page not found" 
>>>>> errors. This includes the divs that are called on to make menus on the 
>>>>> main 
>>>>> page so the "Page not found" error is printing over the main landing 
>>>>> page. 
>>>>>
>>>>> I'm not sure where to start with diagnosis - any thoughts would be 
>>>>> appreciated.
>>>>>
>>>>> I have checked the urls.py file and have tried to go directly to the 
>>>>> URLs listed starting with http://mysite.org/project/ ...
>>>>>
>>>>> urlpatterns = patt

Re: page not found errors for most urls but main landing page displaying okay

2014-06-25 Thread Lee
Thanks - it must be a problem with the site accessing templates but I can't 
figure it out. This django project works on another server but I have 
copied it to a shared host webserver  (Bluehost) and am running it with 
fcgi so maybe the problem is in the setup.

I am focusing on one url and template, but all have the same problem except 
the main landing page, which does work.

The url http://mysite/project/map/nav/ shows the right text without any 
styling
This is the url pattern for this page in urls.py.
url(r'^map/nav/$', 'citi_digits.views.mapNavigation', name='mav_nav'),

The view for this url references the template:
def mapNavigation(request):
"""
Loads the map navigation elements
"""
#get all classes
#get classes
classes = Teacher.objects.values_list('className', flat=True)
return 
render_to_response('map_navigation.html',{'classes':classes},context_instance=RequestContext(request))

In the settings.py the setting for templates is:
TEMPLATE_DIRS = (
os.path.join(PROJECT_ROOT, '..', 'citi_digits','templates'),

I also tried an absolute path and put the templates in www but this did not 
work.

My static settings are:

STATIC_ROOT = '/home5/user/public_html/project/static/'
STATIC_URL = 'http://mysite.org/project/static/'

Lee



On Wednesday, June 25, 2014 3:36:52 PM UTC-4, Michael Lind Hjulskov wrote:
>
> Hi
>
> I had the exact same problem a few days ago. It was one of my templates 
> that suddenntly was emty. very spooky
> Or maybe you have an "extends" somewhere that is not correct
> I would debug by looking in the relevant view and see which template is 
> called, and the simplify that template to test if bug is in templates or 
> elsewhere
>
> Michael
>
> Den onsdag den 25. juni 2014 21.08.35 UTC+2 skrev Lee:
>>
>> I have copied a Django project to my web server from a repo and am 
>> getting the correct initial landing page for the website with the right 
>> styling when I go to the main URL. Most other urls give "page not found" 
>> errors. This includes the divs that are called on to make menus on the main 
>> page so the "Page not found" error is printing over the main landing page. 
>>
>> I'm not sure where to start with diagnosis - any thoughts would be 
>> appreciated.
>>
>> I have checked the urls.py file and have tried to go directly to the URLs 
>> listed starting with http://mysite.org/project/ ...
>>
>> urlpatterns = patterns('',
>> # index.html gives a page not found error
>>  url(r'^$', 'project.views.index', name='index'),
>>
>>
>> # These go to an unstyled page with correct text
>> url(r'^signup/$', 'project.views.signUp', name='signup'),
>> url(r'^login/$', 'project.views.login', name='login'),
>> url(r'^logout/$', 'project.views.logout', name='logout'),
>>
>>
>> # These also give a page not found error
>>
>> url(r'^$', 'project.views.index', name='index'),
>> url(r'^map/nav/$', 'project.views.mapNavigation', name='mav_nav'),
>> url(r'^interview/new/$', 'project.views.interviewSelect', 
>> name='interview_select'),
>> url(r'^interview/player/$', 'project.views.interviewPlayer', 
>> name='interview_player'),
>> url(r'^interview/retailer/$', 'project.views.interviewRetailer', 
>> name='interview_retailer'),
>>
>> url(r'^popup/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/$','project.views.popup',name='popup'),
>>
>>
>> Lee
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1988fa57-8738-4495-909a-65ebecbeedb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


page not found errors for most urls but main landing page displaying okay

2014-06-25 Thread Lee
I have copied a Django project to my web server from a repo and am getting 
the correct initial landing page for the website with the right styling 
when I go to the main URL. Most other urls give "page not found" errors. 
This includes the divs that are called on to make menus on the main page so 
the "Page not found" error is printing over the main landing page. 

I'm not sure where to start with diagnosis - any thoughts would be 
appreciated.

I have checked the urls.py file and have tried to go directly to the URLs 
listed starting with http://mysite.org/project/ ...

urlpatterns = patterns('',
# index.html gives a page not found error
 url(r'^$', 'project.views.index', name='index'),


# These go to an unstyled page with correct text
url(r'^signup/$', 'project.views.signUp', name='signup'),
url(r'^login/$', 'project.views.login', name='login'),
url(r'^logout/$', 'project.views.logout', name='logout'),


# These also give a page not found error

url(r'^$', 'project.views.index', name='index'),
url(r'^map/nav/$', 'project.views.mapNavigation', name='mav_nav'),
url(r'^interview/new/$', 'project.views.interviewSelect', 
name='interview_select'),
url(r'^interview/player/$', 'project.views.interviewPlayer', 
name='interview_player'),
url(r'^interview/retailer/$', 'project.views.interviewRetailer', 
name='interview_retailer'),
url(r'^popup/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/(?P.+)/$','project.views.popup',name='popup'),


Lee

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/168719a0-8a10-4bb0-aa9a-ecd490dbf977%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


testing equality in template tag

2014-06-25 Thread Lee Hinde
with view code like so:

import calendar
months_choices = []
for i in range(1,13):
months_choices.append((i, calendar.month_name[i]))
context['months'] = months_choices


and

context['default_month'] = today.month

I have this snippet in a template (my first use of lists like this):


{% for month in months %}

{{ month.1 }}
{% endfor %}



The issue is the  {% if default_month == month.0 %} always returns false...
The rest of the select is properly built - I get a number for the value and
the month name as the label.

Why?

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BePoMzx%2B4774Ne21djP-EdSAHDL_64DWhZVQYrUYdND%3DBk2%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Copied django project to shared host from repo - can't import settings

2014-06-25 Thread Lee
This worked, thank you! I don't understand why it worked, but pleased that 
it did.

Lee

On Wednesday, June 25, 2014 11:14:46 AM UTC-4, sacrac wrote:
>
> ok i make different configuration
>
> #!/home5/myorg/.virtualenvs/mydjango/bin/python
> import sys, os
>
> # Add a custom Python path.
> sys.path.insert(0, "/home//projects/")
> sys.path.insert(0, "/home//projects/yourproyect")
>
> from flup.server.fcgi import WSGIServer
> os.environ['DJANGO_SETTINGS_MODULE'] = '.settings'
> from django.core.handlers.wsgi import WSGIHandler
> WSGIServer(WSGIHandler()).run()
>
> Cheers
>
>
> On Tue, Jun 24, 2014 at 9:51 PM, Lee <lcps...@gmail.com > 
> wrote:
>
>> For mysite.fcgi I have: 
>>
>> #!/home5/myorg/.virtualenvs/mydjango/bin/python
>> import sys, os
>>
>> # Add a custom Python path.
>> sys.path.insert(0, "/home5/myorg/.virtualenvs/mydjango")
>> sys.path.insert(13, "/home5/myorg/django_projects/mysite")
>> os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
>> from django.core.servers.fastcgi import runfastcgi
>> runfastcgi(method="threaded", daemonize="false")
>>
>>
>> and for .htaccess I have - 
>>
>> AddHandler fcgid-script .fcgi
>> RewriteEngine On
>> RewriteCond %{REQUEST_FILENAME} !-f
>> RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
>>
>>
>> Thanks,
>> Lee
>>
>> On Tuesday, June 24, 2014 9:23:17 PM UTC-4, sacrac wrote:
>>
>>> Hi, maybe show the content mysite.fcgi and .htaccess, the error say not 
>>> exist your project mysite
>>> maybe the path is not good in mysite.fcgi!
>>>
>>> Cheers
>>>  
>>>
>>> On Tue, Jun 24, 2014 at 3:39 PM, Lee <lcps...@gmail.com> wrote:
>>>
>>>>  Hello,
>>>>
>>>> I setup Django successfully on my shared Bluehost account following the 
>>>> tutorial below: http://www.nyayapati.com/srao/
>>>> 2012/08/setup-python-2-7-and-django-1-4-on-bluehost/
>>>>
>>>> I am now having problems with a Django project I have copied from a 
>>>> GitHub repo to my Bluehost directory. I am getting this error when I run 
>>>> python mysite.fcgi in my virtualenv
>>>>
>>>> go-1.5.1-py2.7.egg/django/conf/__init__.py", line 134, in __init__
>>>> raise ImportError("Could not import settings '%s' (Is it on 
>>>> sys.path?): %s" % (self.SETTINGS_MODULE, e))
>>>> ImportError: Could not import settings 'mysite.settings' (Is it on 
>>>> sys.path?): No module named settings
>>>>
>>>> Any thoughts on where to look for errors? I have checked .htaccess and 
>>>> the mysite.fcgi file in my www directory, the pointer to settings in my 
>>>> manage.py and these seem as they should be. Running python manage.py 
>>>> runserver on the project says there are no errors.
>>>>
>>>> Lee
>>>>
>>>> -- 
>>>> You received this message because you are subscribed 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 http://groups.google.com/group/django-users.
>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>> msgid/django-users/595e7cff-5af9-4c63-a052-41d3ce472e30%
>>>> 40googlegroups.com 
>>>> <https://groups.google.com/d/msgid/django-users/595e7cff-5af9-4c63-a052-41d3ce472e30%40googlegroups.com?utm_medium=email_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d31f24ec-601b-4b4a-8d83-05d7048c442c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/d31f24ec-601b-4b4a-8d83-05d7048c442c%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/09b99829-bbd6-458b-8f78-54c0760ec176%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Copied django project to shared host from repo - can't import settings

2014-06-24 Thread Lee
For mysite.fcgi I have: 

#!/home5/myorg/.virtualenvs/mydjango/bin/python
import sys, os

# Add a custom Python path.
sys.path.insert(0, "/home5/myorg/.virtualenvs/mydjango")
sys.path.insert(13, "/home5/myorg/django_projects/mysite")
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")


and for .htaccess I have - 

AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]


Thanks,
Lee

On Tuesday, June 24, 2014 9:23:17 PM UTC-4, sacrac wrote:
>
> Hi, maybe show the content mysite.fcgi and .htaccess, the error say not 
> exist your project mysite
> maybe the path is not good in mysite.fcgi!
>
> Cheers
>
>
> On Tue, Jun 24, 2014 at 3:39 PM, Lee <lcps...@gmail.com > 
> wrote:
>
>> Hello,
>>
>> I setup Django successfully on my shared Bluehost account following the 
>> tutorial below: http://www.nyayapati.com/srao/
>> 2012/08/setup-python-2-7-and-django-1-4-on-bluehost/
>>
>> I am now having problems with a Django project I have copied from a 
>> GitHub repo to my Bluehost directory. I am getting this error when I run 
>> python mysite.fcgi in my virtualenv
>>
>> go-1.5.1-py2.7.egg/django/conf/__init__.py", line 134, in __init__
>> raise ImportError("Could not import settings '%s' (Is it on sys.path?): 
>> %s" % (self.SETTINGS_MODULE, e))
>> ImportError: Could not import settings 'mysite.settings' (Is it on 
>> sys.path?): No module named settings
>>
>> Any thoughts on where to look for errors? I have checked .htaccess and 
>> the mysite.fcgi file in my www directory, the pointer to settings in my 
>> manage.py and these seem as they should be. Running python manage.py 
>> runserver on the project says there are no errors.
>>
>> Lee
>>
>> -- 
>> You received this message because you are subscribed 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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/595e7cff-5af9-4c63-a052-41d3ce472e30%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/595e7cff-5af9-4c63-a052-41d3ce472e30%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d31f24ec-601b-4b4a-8d83-05d7048c442c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Copied django project to shared host from repo - can't import settings

2014-06-24 Thread Lee
Hello,

I setup Django successfully on my shared Bluehost account following the 
tutorial below: 
http://www.nyayapati.com/srao/2012/08/setup-python-2-7-and-django-1-4-on-bluehost/

I am now having problems with a Django project I have copied from a GitHub 
repo to my Bluehost directory. I am getting this error when I run python 
mysite.fcgi in my virtualenv

go-1.5.1-py2.7.egg/django/conf/__init__.py", line 134, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" 
% (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'mysite.settings' (Is it on sys.path?): 
No module named settings

Any thoughts on where to look for errors? I have checked .htaccess and the 
mysite.fcgi file in my www directory, the pointer to settings in my 
manage.py and these seem as they should be. Running python manage.py 
runserver on the project says there are no errors.

Lee

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/595e7cff-5af9-4c63-a052-41d3ce472e30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Registration in 1.8

2014-05-11 Thread Lee
What's the value in starting with 1.4?

I'd start with the current release - 1.6.4

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2ad2a303-d6b6-49ff-b194-7e8aa0296d57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can't run django server nor activate the virtualenv

2014-05-03 Thread Lee
You are welcome, glad it helped :)

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6a25dd58-95b2-4f3a-99e5-4c15b9c84f34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can't run django server nor activate the virtualenv

2014-05-03 Thread Lee
Actually, its probably the same problem as from the start as I see your 
install from the requirements file only installed Django itself and nothing 
else. THerefore I presume it does not have a list of all the dependencies 
you need. Assuming the last error was again "ImportError : No module named 
bootstrapform", it looks like your project might be using 
django-bootstrap-form from a quick google. So try the following with your 
virtualenv active:

pip install django-bootstrap-form

BTW, what is this project you are trying to run. GIven it seems to have 
external dependencies that you are not aware of, I assume its not your 
code? If so, I would expect wherever you got it from to have a list of the 
dependencies that the project needs to run (though usually they would be in 
the requirements file too)

Thanks


On Saturday, 3 May 2014 16:59:01 UTC+1, Lee wrote:
>
> Can you copy the complete error across? The end of it is all important and 
> its chopped off in the screenshot. 
>
> Thanks
>
> On Saturday, 3 May 2014 16:25:57 UTC+1, Fred DJar wrote:
>>
>> Thanks
>> the second solution worked fine and the requirements were installed
>>
>> but again when i tried to run the server this is what i got
>>
>>
>> <https://lh3.googleusercontent.com/-Ag5MDmj_FBU/U2UKfxDCVGI/BGk/7w3r6Bzk36I/s1600/aaa.png>
>>
>>
>> On Monday, 28 April 2014 11:03:40 UTC+1, Fred DJar wrote:
>>>
>>>
>>>
>>>
>>> *Hello guys, i'm a newbie so bear with me :)I have installed python 2.7 
>>> and django 1.6 on my desktop (ubuntu 14)but i can't run the application or 
>>> activate the virtualenv*
>>>
>>> *this is the message i got:*
>>> ubuntu@ubuntu:~/Downloads/saf$ python manage.py runserver
>>> Traceback (most recent call last):
>>>   File "manage.py", line 10, in 
>>> execute_from_command_line(sys.argv)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
>>>  
>>> line 399, in execute_from_command_line
>>> utility.execute()
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
>>>  
>>> line 392, in execute
>>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
>>> line 242, in run_from_argv
>>> self.execute(*args, **options.__dict__)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
>>> line 280, in execute
>>> translation.activate('en-us')
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py",
>>>  
>>> line 130, in activate
>>> return _trans.activate(language)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>>>  
>>> line 188, in activate
>>> _active.value = translation(language)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>>>  
>>> line 177, in translation
>>> default_translation = _fetch(settings.LANGUAGE_CODE)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>>>  
>>> line 159, in _fetch
>>> app = import_module(appname)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 
>>> 40, in import_module
>>> __import__(name)
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/938000b8-109e-4c2f-8fab-adf2de08f1ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can't run django server nor activate the virtualenv

2014-05-03 Thread Lee
Can you copy the complete error across? The end of it is all important and 
its chopped off in the screenshot. 

Thanks

On Saturday, 3 May 2014 16:25:57 UTC+1, Fred DJar wrote:
>
> Thanks
> the second solution worked fine and the requirements were installed
>
> but again when i tried to run the server this is what i got
>
>
> 
>
>
> On Monday, 28 April 2014 11:03:40 UTC+1, Fred DJar wrote:
>>
>>
>>
>>
>> *Hello guys, i'm a newbie so bear with me :)I have installed python 2.7 
>> and django 1.6 on my desktop (ubuntu 14)but i can't run the application or 
>> activate the virtualenv*
>>
>> *this is the message i got:*
>> ubuntu@ubuntu:~/Downloads/saf$ python manage.py runserver
>> Traceback (most recent call last):
>>   File "manage.py", line 10, in 
>> execute_from_command_line(sys.argv)
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
>> line 399, in execute_from_command_line
>> utility.execute()
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
>> line 392, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
>> line 242, in run_from_argv
>> self.execute(*args, **options.__dict__)
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
>> line 280, in execute
>> translation.activate('en-us')
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py",
>>  
>> line 130, in activate
>> return _trans.activate(language)
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>>  
>> line 188, in activate
>> _active.value = translation(language)
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>>  
>> line 177, in translation
>> default_translation = _fetch(settings.LANGUAGE_CODE)
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>>  
>> line 159, in _fetch
>> app = import_module(appname)
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 
>> 40, in import_module
>> __import__(name)
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1a60463a-459f-4af9-8357-87e9bf51424b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can't run django server nor activate the virtualenv

2014-05-02 Thread Lee
Whoops sorry, should have thought, rmvirtualenv and mkvirtualenv come with 
virtualenvwrapper, not the default virtualenv...

Regarding the first error, was that the whole error or was there some more 
after where the screenshot cut off? Looks like it tried to install django 
that time so I guess the uninstall of the global version helped to some 
extent. 

Regarding the second option, ignore deleting the existing virtualenv 
(though you can just delete the original directories it created for it if 
you like) for now and just create a new one with a different name with the 
following:

*virtualenv --no-site-packages newenvname*

activate it as before then try running *pip install -r requirements *again  

On Saturday, 3 May 2014 00:23:03 UTC+1, Fred DJar wrote:
>
> Trying your first solution gave me this error messages !
>
>
>
> <https://lh6.googleusercontent.com/-gdNSTYtOKlk/U2QolN3l6BI/BCc/Y3zkcISx5Nk/s1600/1.png>
>
> And trying the second solution gave me the message that rmvirtualenv : 
> command not found !
>
>
> On Friday, 2 May 2014 23:26:43 UTC+1, Lee wrote:
>>
>> So it looks like its uninstalling the Django you already have 
>> installed in the global packages, in order to install the version specified 
>> in the requirements file, but is hitting a permissions error in doing 
>> so because you are not logged in as root (or elevating with sudo). I 
>> presume your virtualenv was set up using global site packages if its 
>> picking that up. So you have 2 options.
>>
>> 1) Elevate your permissions to delete the existing django in the site 
>> root with the following command (im not sure if you need to deactivate your 
>> virtualenv or not to do that since I never install anything globally):
>>
>> *sudo pip uninstall django*
>> Enter your password when prompted
>>
>> Then with your virtualenv activated try the previous command again:
>>
>> *pip install -r requirements*
>>
>> 2) delete your virtualenv, and create a new one, specifying no site 
>> packages so you have an isolated virtualenv rather than the one you have 
>> now:
>>
>> *rmvirtualenv env*
>>
>> Then the following to create the new one, activate it and then install 
>> your requirements:
>>
>> *mkvirtualenv --no-site-packages env*
>> *source activate* (from the bin folder as usual)
>> *pip install -r requirements*
>>
>> Thanks
>>
>> On Monday, 28 April 2014 11:03:40 UTC+1, Fred DJar wrote:
>>>
>>>
>>>
>>>
>>> *Hello guys, i'm a newbie so bear with me :)I have installed python 2.7 
>>> and django 1.6 on my desktop (ubuntu 14)but i can't run the application or 
>>> activate the virtualenv*
>>>
>>> *this is the message i got:*
>>> ubuntu@ubuntu:~/Downloads/saf$ python manage.py runserver
>>> Traceback (most recent call last):
>>>   File "manage.py", line 10, in 
>>> execute_from_command_line(sys.argv)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
>>>  
>>> line 399, in execute_from_command_line
>>> utility.execute()
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
>>>  
>>> line 392, in execute
>>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
>>> line 242, in run_from_argv
>>> self.execute(*args, **options.__dict__)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
>>> line 280, in execute
>>> translation.activate('en-us')
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py",
>>>  
>>> line 130, in activate
>>> return _trans.activate(language)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>>>  
>>> line 188, in activate
>>> _active.value = translation(language)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>>>  
>>> line 177, in translation
>>> default_translation = _fetch(settings.LANGUAGE_CODE)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>>>  
>>> line 159, in _fetch
>>> app = import_module(appname)
>>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 
>>> 40, in import_module
>>> __import__(name)
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/86872e59-5849-415b-b490-f37f6e09935b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can't run django server nor activate the virtualenv

2014-05-02 Thread Lee
So it looks like its uninstalling the Django you already have installed in 
the global packages, in order to install the version specified in the 
requirements file, but is hitting a permissions error in doing so because 
you are not logged in as root (or elevating with sudo). I presume your 
virtualenv was set up using global site packages if its picking that up. So 
you have 2 options.

1) Elevate your permissions to delete the existing django in the site root 
with the following command (im not sure if you need to deactivate your 
virtualenv or not to do that since I never install anything globally):

*sudo pip uninstall django*
Enter your password when prompted

Then with your virtualenv activated try the previous command again:

*pip install -r requirements*

2) delete your virtualenv, and create a new one, specifying no site 
packages so you have an isolated virtualenv rather than the one you have 
now:

*rmvirtualenv env*

Then the following to create the new one, activate it and then install your 
requirements:

*mkvirtualenv --no-site-packages env*
*source activate* (from the bin folder as usual)
*pip install -r requirements*

Thanks

On Monday, 28 April 2014 11:03:40 UTC+1, Fred DJar wrote:
>
>
>
>
> *Hello guys, i'm a newbie so bear with me :)I have installed python 2.7 
> and django 1.6 on my desktop (ubuntu 14)but i can't run the application or 
> activate the virtualenv*
>
> *this is the message i got:*
> ubuntu@ubuntu:~/Downloads/saf$ python manage.py runserver
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
> line 399, in execute_from_command_line
> utility.execute()
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
> line 392, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
> line 242, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
> line 280, in execute
> translation.activate('en-us')
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py",
>  
> line 130, in activate
> return _trans.activate(language)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>  
> line 188, in activate
> _active.value = translation(language)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>  
> line 177, in translation
> default_translation = _fetch(settings.LANGUAGE_CODE)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>  
> line 159, in _fetch
> app = import_module(appname)
>   File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", 
> line 40, in import_module
> __import__(name)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/039d9148-b2a8-4a54-bf4d-c1b505e72ad0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can't run django server nor activate the virtualenv

2014-05-02 Thread Lee
No, you were in the right locatin before. Look at your last screenshot. There 
was a file called requirements and you do it from there. If it does not work, 
please confirm what is in that requirements file

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/edb91771-a911-4140-8b75-f8403471b13c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can't run django server nor activate the virtualenv

2014-05-01 Thread Lee
Also be aware that from the stack trace, it looks like you have django 
installed into the global site packages rather than your virtualenv. The main 
point of virtualenv is to avoid that and have isolated environments. But it's 
not really a problem as long as you are aware of the fact that you are using 
the global site packages 

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d5406ccd-2091-4575-9d35-0a4709848681%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can't run django server nor activate the virtualenv

2014-05-01 Thread Lee
Next command: pip install -r requirements 

>From the directory where the requirements file is of course... And assuming 
>the requirements file has all the requirements of whatever you are trying to 
>run in it

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c1c351fd-7234-43f6-886c-90e1a8b1cb64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can't run django server nor activate the virtualenv

2014-05-01 Thread Lee
Enter the following command from the bin folder:

*source activate*

Thanks

On Monday, 28 April 2014 11:03:40 UTC+1, Fred DJar wrote:
>
>
>
>
> *Hello guys, i'm a newbie so bear with me :)I have installed python 2.7 
> and django 1.6 on my desktop (ubuntu 14)but i can't run the application or 
> activate the virtualenv*
>
> *this is the message i got:*
> ubuntu@ubuntu:~/Downloads/saf$ python manage.py runserver
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
> line 399, in execute_from_command_line
> utility.execute()
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
> line 392, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
> line 242, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
> line 280, in execute
> translation.activate('en-us')
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py",
>  
> line 130, in activate
> return _trans.activate(language)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>  
> line 188, in activate
> _active.value = translation(language)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>  
> line 177, in translation
> default_translation = _fetch(settings.LANGUAGE_CODE)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
>  
> line 159, in _fetch
> app = import_module(appname)
>   File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", 
> line 40, in import_module
> __import__(name)
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ff2e079f-725b-465f-85c2-eb5f34c3e733%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I can't run django server nor activate the virtualenv

2014-05-01 Thread Lee
Please be more specific about your problem as its difficult to help when we 
don't know exactly what you are seeing. Have you managed to activate your 
virtualenv on ubuntu? If not, what specific error are you getting?

I see two problems here so far, regarding the import error, that means you 
are missing a dependency of the project you are trying to run. But that may 
just be that you've not activated your virtualenv - though you need to 
install the dependencies there once you get virtualenv running anyway most 
likely. The 'activate is not recognized as an internal or external command, 
operable program or batch file' error just means the activate script  was 
not found. You have to either be in the location where the activate script 
is, or else you need to specify the path to it, which will be in the bin 
folder of wherever you created the virtualenv. 

BTW, not wanting to confuse matters, but virtualenvwrapper is a useful 
addition on Linux, but its worth understanding virtualenv first.

On Thursday, 1 May 2014 21:25:42 UTC+1, Fred DJar wrote:
>
> Iv'e run it on ubuntu terminal but still not working
>
> On Tuesday, 29 April 2014 14:35:39 UTC+1, Rene Zelaya wrote:
>>
>> Hi Fred,
>>
>> Yes, definitely, I think you should run it on a Ubuntu terminal - I'm not 
>> that familiar with the Windows terminal
>>
>>
>> On Monday, April 28, 2014 10:10:29 AM UTC-4, Fred DJar wrote:
>>>
>>> Thanks Rene
>>> The virtualenv was created in Ubuntu but now i'm running windows, should 
>>> i run it in Ubuntu because i've noticed that virtualenv folder structure 
>>> differentiate from Ubuntu to windows
>>> this is the message i got from the prompt command: activate is not 
>>> recognized as an internal or external command, operable program or batch 
>>> file
>>>
>>> On Monday, 28 April 2014 11:03:40 UTC+1, Fred DJar wrote:




 *Hello guys, i'm a newbie so bear with me :)I have installed python 2.7 
 and django 1.6 on my desktop (ubuntu 14)but i can't run the application or 
 activate the virtualenv*

 *this is the message i got:*
 ubuntu@ubuntu:~/Downloads/saf$ python manage.py runserver
 Traceback (most recent call last):
   File "manage.py", line 10, in 
 execute_from_command_line(sys.argv)
   File 
 "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
  
 line 399, in execute_from_command_line
 utility.execute()
   File 
 "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",
  
 line 392, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File 
 "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
 line 242, in run_from_argv
 self.execute(*args, **options.__dict__)
   File 
 "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
 line 280, in execute
 translation.activate('en-us')
   File 
 "/usr/local/lib/python2.7/dist-packages/django/utils/translation/__init__.py",
  
 line 130, in activate
 return _trans.activate(language)
   File 
 "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
  
 line 188, in activate
 _active.value = translation(language)
   File 
 "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
  
 line 177, in translation
 default_translation = _fetch(settings.LANGUAGE_CODE)
   File 
 "/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py",
  
 line 159, in _fetch
 app = import_module(appname)
   File 
 "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 
 40, in import_module
 __import__(name)



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/53af6ee5-ff00-41dd-93bd-da00f1c54fcb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django

2014-04-25 Thread Lee
In case you dont see my email, I copy my reply here too:

Hi, 

Your problem is in the results view function. I'm not sure what version of 
the tutorial you are following, but assuming you are using Django 1.6, the 
following:

def results(request, poll_id):
poll = get_object_or_404(Poll, poll_id)
return render(request, 'poll/results.html', {'poll':poll})

Should be:

def results(request, poll_id):
poll = get_object_or_404(Poll, pk=poll_id)
return render(request, 'poll/results.html', {'poll':poll})

Hope it helps. 

On Saturday, 19 April 2014 07:07:38 UTC+1, Srinivasulu Reddy wrote:
>
>
> Hello folks,
>  I am new to python/django . i am earning myself i want to 
> know effective way of learning python / django . i am following django book 
> for django .  Light bird apps also.
>
> So please anyone can help me to find the good way learn the python / 
> django . I love to learn the python / django .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c642a22d-e1be-4397-a154-4323e378bd2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django

2014-04-24 Thread Lee
Can you share your views.py, result.html and urls.py?

On Thursday, 24 April 2014 12:10:33 UTC+1, Srinivasulu Reddy wrote:
>
>
>
> On Wednesday, April 23, 2014 2:57:45 PM UTC+5:30, Srinivasulu Reddy wrote:
>>
>> Hi Folksl , 
>>
>>
>>   In dealing with poll app tutorial 4 i am getting an error, posting 
>> it down. Help me to find a way to solve the problem in dealing with 
>> results.html and results view . It's throwing IndexError.
>>
>>Before changing results view it's working good. After changing result 
>> view and after creating in results.html . I am getting this problem after 
>> clicking "Vote" button on my browser.  Is anyone there to help me
>>
>>
>>   python manage.py runserver
>>
>> Validating models...
>>
>> 0 errors found
>> April 23, 2014 - 09:20:10
>> Django version 1.6.2, using settings 'dj_tutorial.settings'
>> Starting development server at http://127.0.0.1:8000/
>> Quit the server with CONTROL-C.
>> [23/Apr/2014 09:20:15] "GET /poll/ HTTP/1.1" 200 408
>> [23/Apr/2014 09:20:18] "GET /poll/specifics/7/ HTTP/1.1" 200 599
>> [23/Apr/2014 09:20:23] "POST /poll/7/votes/ HTTP/1.1" 302 0
>> Internal Server Error: /poll/7/results/
>> Traceback (most recent call last):
>>   File 
>> "/root/.virtualenvs/djan/local/lib/python2.7/site-packages/django/core/handlers/base.py",
>>  
>> line 114, in get_response
>> response = wrapped_callback(request, *callback_args, 
>> **callback_kwargs)
>>   File 
>> "/home/seenu/work/Django_proj/d_tutorial/dj_tutorial/poll/views.py", line 
>> 24, in results
>> poll = get_object_or_404(Poll, poll_id)
>>   File 
>> "/root/.virtualenvs/djan/local/lib/python2.7/site-packages/django/shortcuts/__init__.py",
>>  
>> line 113, in get_object_or_404
>> return queryset.get(*args, **kwargs)
>>   File 
>> "/root/.virtualenvs/djan/local/lib/python2.7/site-packages/django/db/models/query.py",
>>  
>> line 298, in get
>> clone = self.filter(*args, **kwargs)
>>   File 
>> "/root/.virtualenvs/djan/local/lib/python2.7/site-packages/django/db/models/query.py",
>>  
>> line 590, in filter
>> return self._filter_or_exclude(False, *args, **kwargs)
>>   File 
>> "/root/.virtualenvs/djan/local/lib/python2.7/site-packages/django/db/models/query.py",
>>  
>> line 608, in _filter_or_exclude
>> clone.query.add_q(Q(*args, **kwargs))
>>   File 
>> "/root/.virtualenvs/djan/local/lib/python2.7/site-packages/django/db/models/sql/query.py",
>>  
>> line 1192, in add_q
>> if not self.need_having(q_object):
>>   File 
>> "/root/.virtualenvs/djan/local/lib/python2.7/site-packages/django/db/models/sql/query.py",
>>  
>> line 1155, in need_having
>> return any(self.need_having(c) for c in obj.children)
>>   File 
>> "/root/.virtualenvs/djan/local/lib/python2.7/site-packages/django/db/models/sql/query.py",
>>  
>> line 1155, in 
>> return any(self.need_having(c) for c in obj.children)
>>   File 
>> "/root/.virtualenvs/djan/local/lib/python2.7/site-packages/django/db/models/sql/query.py",
>>  
>> line 1153, in need_having
>> or (hasattr(obj[1], 'contains_aggregate')
>>
>  
>
>> IndexError: string index out of range
>> [23/Apr/2014 09:20:24] "GET /poll/7/results/ HTTP/1.1" 500 91775
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Wednesday, April 23, 2014 12:58:54 PM UTC+5:30, Daniel Roseman wrote:
>>>
>>> Why have you posted screenshots of text to a text-based newsgroup? 
>>> Please copy and paste the relevant text into a message (the Django error 
>>> page even has a special link to go to a copy and paste view).
>>> -- 
>>> DR.
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8a2232e5-430e-41d7-8b35-974bd6c34fab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: views

2014-04-17 Thread Lee
Go through the tutorial linked in the other post before trying to write your 
own apps. That'll cover all the questions you just asked

-- 
You received this message because you are subscribed to the Google Groups 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/46e94f4a-882a-41dc-b9d3-8e202a1f400c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django apps

2014-04-01 Thread Lee
Start here and follow the tutorial:

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

Then you may want to run through this if you are interested in the goe 
stuff:

https://docs.djangoproject.com/en/1.6/ref/contrib/gis/tutorial/

That should give you a good idea on where to start with your own app


On Sunday, 30 March 2014 14:40:19 UTC+1, ngangsia akumbo wrote:
>
> I wish to develope application that can give directions and location.
>
> Pleas i need some guidance for a way forward. I have done some research but
> still not getting it right. 
>
> I need some guidance
>
> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/02c7e892-241f-482a-ab1d-09843e7b08d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   3   4   5   >