Re: Forbidden (CSRF token missing or incorrect.)

2018-11-29 Thread Zach
when using the development server over HTTP, don't set these values:
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True

On Wednesday, November 21, 2018 at 5:38:19 AM UTC-8, Rabah Saadi wrote:
>
> Hello,
>
> I've been using Django 2.2Dev for a while now, since April 2018, and it is 
> working just fine (I got my reasons why Django Dev). But since the last git 
> pull, it shows the CSRF token missing, on every page has a form with CSRF 
> token. 
>
> Is there something broke or ... ? since My Django-2.2Dev before the last 
> "git pull" was working just fine.
>
> PS : Donwgrade to Django 2.1.3 stable, works fine too.
>
> thank you.
>

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


Re: Strange intermittent UUID bug

2018-11-23 Thread Zach
You could try modifying to_python with something like this:

import logging


def to_python(self, value):
if value is not None and not isinstance(value, uuid.UUID):
try:
value = uuid.UUID(value)
except Exception as e:
logging.info('class: %s', e.__class__)
logging.info('module: %s', e.__module__)
logging.info('type(value): %s', type(value))
logging.info('value: %s', value)
raise exceptions.ValidationError(
self.error_messages['invalid'],
code='invalid',
params={'value': value},
)
return value


On Tuesday, November 20, 2018 at 9:47:25 AM UTC-8, Jerry Vinokurov wrote:
>
> Hi all,
>
> We have a project that uses UUIDs as a primary key for some objects. Our 
> project is deployed on AWS via Elastic Beanstalk. After the initial deploy, 
> everything works fine, but at some point, we encounter the following error, 
> deep within Django:
>
> ValidationError: ["'7c6eee47-53d0-48f6-a8b7-8aff82bc47c3' is not a valid 
> UUID."]
>
> Now, that certainly is a valid UUID; just pass it as a parameter to 
> uuid.UUID to verify that. So this is definitely odd. We use Sentry for 
> our error logging, and I dove into the stack trace, which I'll post a 
> picture of:
>
> [image: stack_trace.png]
>
>
> As can be seen in the stack trace, the following thing seems to happen:
>
> 1. Line 2315 is supposed to check for whether the value is already a UUID. 
> That check fails (the purple line above indicates that the execution path 
> has reached that line). Note that below, Sentry gives value as a UUID 
> object.
> 2. Line 2316 is therefore invoked, calling self.to_python(value)
>
> Here's the to_python function in its entirety (it can be found in 
> django/db/models/fields/__init__.py):
>
> 2322:def to_python(self, value):
> 2323:if value is not None and not isinstance(value, uuid.UUID):
> 2324:try:
> 2325:return uuid.UUID(value)
> 2326:except (AttributeError, ValueError):
> 2327:raise exceptions.ValidationError(
> 2328:self.error_messages['invalid'],
> 2329:code='invalid',
> 2330:params={'value': value},
> 2331:)
> 2332:return value
>
> 3. The isinstance check at 2323 also fails, and so uuid.UUID(value) is 
> invoked, which throws the ValidationError shown above, since the value 
> passed into the constructor is not a string.
>
> Now, the really, really weird thing about this problem is that *it goes 
> away when we redeploy the code*. We then seem to operate normally for 
> some time (as short as half a day, as long as several weeks) and then the 
> problem crops up again. And on top of all of this, we can't seem to at all 
> reproduce it locally; it only shows up in the production environment on AWS.
>
> This is bedeviling our entire team and I would love to know if anyone has 
> encountered a something like this or can provide any insight into just what 
> is happening here. It seems that it should not be possible and yet it's 
> happening.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/6c7f234d-a415-41d8-adb9-58fd465168e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Tutorial Equivalent to Ruby on Rails Tutorial by Michael Hartl

2015-02-22 Thread Zach Swift
I realize this post is several years old, but this is for anyone still 
looking for an up to date Django tutorial on par with Michael Hartl rails 
tutorial. Here it is:


The title of the book is very deceiving. Its a book about web development 
with python using django but doing it with test driven development. 
https://books.google.com/books?id=fTLJAwAAQBAJ=PR2=test+driven+development+with+python=en=X=nmLqVNOqENGvyASPkIDYDA=0CCcQ6AEwAg#v=onepage=false

I say it's on par with Michal Hartl's because of these things:

1. You learn more of the generalities of web development instead of the 
scope being laser focused on django stuff only (like most django books out 
there assuming you already know web development)

2. It's a project based, where you build a web application with python and 
Django throughout the book.

3. Like the Hartl tutorial, you are also learning test driven development 
and Git along the way. 



On Monday, October 22, 2012 at 11:58:25 AM UTC-5, Tommy DANGerous wrote:
>
> Thanks everyone for the help. I've gone through several tutorials, such as 
> the one on the Django website and at http://lightbird.net/dbe/. Just 
> trying to get more familiar with Django before I start trying to write it 
> on my own. I'll take a look at the Django Book and the youtube videos you 
> all posted. Thank you for all the help!

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


Re: CSRF verification failed when I use smart phone

2015-01-30 Thread Zach Borboa


Here's an example of the csrf cookie value obtained by typing 
document.cookie in the javascript console.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/3879ce91-fa33-4e6f-a57b-d51abf6052e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: CSRF verification failed when I use smart phone

2015-01-30 Thread Zach Borboa
What you want to compare is the expected token value and the token value 
the view received (via POST, PUT, DELETE, etc.). These values need to 
match. Printing out the token via {{ csrf_token }} in the template will 
show you the token that the view will receive when the form is submitted. 
This submitted value needs to match the value in the cookie named csrftoken.


On Friday, January 30, 2015 at 1:59:45 PM UTC-8, Pouria M wrote:
>
> Thanks Zach. 
> What are your thoughts after this test? if they match or if they don't 
> match
>
> On Wednesday, January 28, 2015 at 9:46:23 PM UTC-8, Zach Borboa wrote:
>>
>> For anyone trying to debug this issue, you may want to print out the 
>> variable using {{ csrf_token }} as well as using {% csrf_token %} on the 
>> form to verify the token is correct.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/e7d8ec73-4fc1-44bf-9424-77edb20d4bb0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: CSRF verification failed when I use smart phone

2015-01-28 Thread Zach Borboa
For anyone trying to debug this issue, you may want to print out the 
variable using {{ csrf_token }} as well as using {% csrf_token %} on the 
form to verify the token is correct.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/24ac2c16-d2f4-4e52-93b1-7058101e8a61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


post_save signal not working in Django 1.7

2015-01-16 Thread Zach LeRoy
I have a block of code that works fine in Django 1.6.10 but does not work 
at all in Django 1.7.3.  I would expect my log statement to print every 
time a Django User is created and this is the behavior in 1.6.10:

import logging

from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver

log = logging.getLogger(__name__)


class UserProfile(models.Model):
uuid = models.CharField(max_length=36)
user = models.OneToOneField(User)


@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, **kwargs):
"""
When a new user is created, add a UserProfile
"""
log.debug('received post save signal: {}'.format(instance))
if created:
UserProfile.objects.create(user=instance)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/d732a896-d262-4673-8ff0-1080fec68498%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: CSRF verification failed when I use smart phone

2015-01-08 Thread Zach Borboa
Mobile device could also be caching an incorrect csrf token.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/a2f6a467-5530-44ec-841c-9599e66456bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Rotate the CSRF token on every request

2014-11-01 Thread Zach Borboa
Rotating the CSRF token on every request is probably not a great idea. 
Tokens will become invalidated when multiple tabs are open.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/5b4f5bfd-c2b8-4c59-9502-468709f0f269%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Strange behavior with defer and select_related

2014-08-14 Thread Zach Snow
Upon reviewing the code in `django/db/models/sql/compiler.py` it seems 
clear that the list of deferred fields is per-table instead of per-table 
alias  -- see `deferred_column_names`, 
https://github.com/django/django/blob/f0b358880a6825d667c037757caac470bc526a1f/django/db/models/sql/compiler.py#L683
 
which for the above example will generate something like the following:

{ 'defer_company': set([u'creator_id', 'name', u'id']) }

Whereas I would expect:

{ 'T3': set([u'creator_id', 'name', u'id']) }

(As the `only_load` dictionary created by this method only lists tables for 
which the entire set of columns should not be loaded, we wouldn't see an 
entry for 'defer_company' at all). It seems that impossible to generate the 
correct SQL without tracking deferred fields per-table alias, but it wasn't 
clear to me that the information necessary to determine the table alias to 
which each deferred field "path" (of the form 
'field1__field2__...__fieldN') should be applied is available in the 
relevant place in the code.

-Zach

On Thursday, August 14, 2014 11:59:08 AM UTC-5, Zach Snow wrote:
>
> Hi there. I'm running into some strange behavior when using `defer` with 
> `select_related` and I wanted to find out if I'm simply misunderstanding 
> what should be going on, or if indeed I have stumbled onto a bug.
>
> Summary: Using `defer` on a table that has been re-included in a query via 
> `select_related` affects the fields returned by "original" table.
>
> Consider in the following example that each `Company` might have many 
> users, and each company might have been created by a user owned by the 
> company itself or a different company. Now we'd like to query the database 
> for a list of companies, along with enough information about the `creator` 
> to display, say, their name and company name.
>
> (For the sake of the example the number of fields is very small, but in 
> practice I ran into this bug because doing multiple `select_related`s on a 
> wide table actually caused me to hit the 1664 column limit in Postgres).
>
> # This is in an app "defer".
> from django.db import models
>
> class Company(models.Model):
> creator = models.ForeignKey('defer.User', null=True)
> name = models.CharField(max_length=32)
> description = models.TextField()
>
> class User(models.Model):
> company = models.ForeignKey(Company)
> username = models.CharField(max_length=32)
> name = models.CharField(max_length=32)
>
> Now we query `Company` in such a way that it is `select_related` again 
> into the query, and defer fields on the instance of the table that is 
> `select_related`, but not on the "main" instance of the table.
>
> >>> cs = Company.objects.all().select_related(
> 'creator', 
> 'creator__company').defer('creator__company__description')
> >>>cs.first().description # Causes a query.
>
> Printing the SQL shows what's going wrong:
>
> >>> print cs.query
> SELECT "defer_company"."id", "defer_company"."creator_id",
> "defer_company"."name", "defer_user"."id",
> "defer_user"."company_id", "defer_user"."username", 
> "defer_user"."name",
> T3."id", T3."creator_id", T3."name"
> FROM "defer_company"
> LEFT OUTER JOIN "defer_user" ON ( "defer_company"."creator_id" = 
> "defer_user"."id" )
> LEFT OUTER JOIN "defer_company" T3 ON ( "defer_user"."company_id" = 
> T3."id" )
>
> Note that we are *not* retrieving the field `defer_company.description`. 
> It seems that the `defer` called on the instance of the `defer_company` 
> table selected through the `creator` field (`T3` above) is being applied to 
> the "first" instance of the table as well.
>
> Updating the SQL to include that column (in the way I expected `defer` and 
> `select_related` to behave) succeeds in returning the correct data -- in 
> sqlite3, at least.
>
> I encountered this behavior in version 1.6.5 and also reproduced it in 
> 1.7c2.
>
> Thanks!
>  
> -Zach
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/d66f5898-6dd5-422f-8d7f-782183625b39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Strange behavior with defer and select_related

2014-08-14 Thread Zach Snow
Hi there. I'm running into some strange behavior when using `defer` with
`select_related` and I wanted to find out if I'm simply misunderstanding
what should be going on, or if indeed I have stumbled onto a bug.

Summary: Using `defer` on a table that has been re-included in a query via
`select_related` affects the fields returned by "original" table.

Consider in the following example that each `Company` might have many
users, and each company might have been created by a user owned by the
company itself or a different company. Now we'd like to query the database
for a list of companies, along with enough information about the `creator`
to display, say, their name and company name.

(For the sake of the example the number of fields is very small, but in
practice I ran into this bug because doing multiple `select_related`s on a
wide table actually caused me to hit the 1664 column limit in Postgres).

# This is in an app "defer".
from django.db import models

class Company(models.Model):
creator = models.ForeignKey('defer.User', null=True)
name = models.CharField(max_length=32)
description = models.TextField()

class User(models.Model):
company = models.ForeignKey(Company)
username = models.CharField(max_length=32)
name = models.CharField(max_length=32)

Now we query `Company` in such a way that it is `select_related` again into
the query, and defer fields on the instance of the table that is
`select_related`, but not on the "main" instance of the table.

>>> cs = Company.objects.all().select_related(
'creator',
'creator__company').defer('creator__company__description')
>>>cs.first().description # Causes a query.

Printing the SQL shows what's going wrong:

>>> print cs.query
SELECT "defer_company"."id", "defer_company"."creator_id",
"defer_company"."name", "defer_user"."id",
"defer_user"."company_id", "defer_user"."username",
"defer_user"."name",
T3."id", T3."creator_id", T3."name"
FROM "defer_company"
LEFT OUTER JOIN "defer_user" ON ( "defer_company"."creator_id" =
"defer_user"."id" )
LEFT OUTER JOIN "defer_company" T3 ON ( "defer_user"."company_id" =
T3."id" )

Note that we are *not* retrieving the field `defer_company.description`. It
seems that the `defer` called on the instance of the `defer_company` table
selected through the `creator` field (`T3` above) is being applied to the
"first" instance of the table as well.

Updating the SQL to include that column (in the way I expected `defer` and
`select_related` to behave) succeeds in returning the correct data -- in
sqlite3, at least.

I encountered this behavior in version 1.6.5 and also reproduced it in
1.7c2.

Thanks!

-Zach

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/CAE1SZhCmoN7ThUb295Zm3x_DZiayN2Wnn1GJQMTsvoG5GwHxEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Spammed with 'Invalid HTTP_HOST header' messages

2013-12-06 Thread Zach Borboa
Can you not add a filter to your logger 
handler? http://stackoverflow.com/a/19534738



On Friday, December 6, 2013 8:28:37 AM UTC-8, Jon Dufresne wrote:
>
> On Fri, Dec 6, 2013 at 7:47 AM, Zach Borboa <zachb...@gmail.com> 
> wrote: 
> > SuspiciousOperation should now return a 400 error [1]. 
>
> It is true, the response is a 400 Bad Request error, but I still 
> receive emails going to my admins/managers email account. I thought 
> 400 errors shouldn't be mailed out. I would prefer to avoid installing 
> Sentry if there is a simple fix. Any ideas? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/452abce6-ffee-4e08-ba0e-13b03701f6c6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Spammed with 'Invalid HTTP_HOST header' messages

2013-12-06 Thread Zach Borboa
SuspiciousOperation should now return a 400 error [1]. You could also use 
something like Sentry [2] or filter these messages.

[1] https://code.djangoproject.com/ticket/19866
[2] https://github.com/getsentry/sentry
[3] http://stackoverflow.com/a/19534738

On Thursday, December 5, 2013 11:21:33 AM UTC-8, Jon Dufresne wrote:
>
> I am running Django 1.6. 
>
> I receive a lot of false positive errors from my Django application 
> when accessed with an invalid HTTP_HOST. I have verified that these 
> are in fact HTTP_HOST values that I am not interested in. So I *do* 
> want to return an error to the user. However, it doesn't help me as an 
> admin to receive an email every time this happens. 
>
> What is the most straight forward way to prevent these errors from 
> emailing the admins? I want to continue to receive other errors. 
>
> Thanks, 
> Jon 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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/575fa704-ebae-4642-bda5-e6c55cd46249%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django-cms + Wymeditor + Heroku + AWS s3 + Cors

2013-09-07 Thread Zach Frank
Having same problem.. did you figure anything out?

Z

On Thursday, October 11, 2012 12:57:30 PM UTC-5, Matteo Suppo wrote:
>
> I found this: 
> http://comments.gmane.org/gmane.comp.python.django.django-cms/1202
>
> and I decided to use tinymce for now. It's not solved though. I will do 
> something, maybe.
>
> On Thursday, October 11, 2012 7:25:19 PM UTC+2, Matteo Suppo wrote:
>>
>> Ok, here's a fun one.
>>
>> I set up a django installation on Heroku, added the django-cms app, 
>> deployed on heroku, and collected the static files on AWS.
>>
>> The problem is Django-CMS tries to load the js file for the wymeditor but 
>> AWS says:
>>
>> MLHttpRequest cannot load 
>> https://s3.amazonaws.com/[...]/cms/js/wymeditor/skins/django/skin.js. 
>> Origin [...] is not allowed by Access-Control-Allow-Origin.
>>
>> I actually searched a lot, and discovered this: 
>> http://docs.amazonwebservices.com/AmazonS3/latest/dev/cors.html
>>
>> Seems like a solution, but even if I activated it, nothing works.
>>
>> I'm at loss. It should work but it doesn't. Am I missing something here? 
>> Maybe it doesn't work the way I thought? Should I ask AWS directly?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django-cms + Wymeditor + Heroku + AWS s3 + Cors

2013-09-07 Thread Zach Frank
Having this same problem... did you fix it? I'm using heroku, django-cms, 
s3 for static files and i'm getting the same domain origin error.. any new 
insights appreciated.

Z

On Thursday, October 11, 2012 12:57:30 PM UTC-5, Matteo Suppo wrote:
>
> I found this: 
> http://comments.gmane.org/gmane.comp.python.django.django-cms/1202
>
> and I decided to use tinymce for now. It's not solved though. I will do 
> something, maybe.
>
> On Thursday, October 11, 2012 7:25:19 PM UTC+2, Matteo Suppo wrote:
>>
>> Ok, here's a fun one.
>>
>> I set up a django installation on Heroku, added the django-cms app, 
>> deployed on heroku, and collected the static files on AWS.
>>
>> The problem is Django-CMS tries to load the js file for the wymeditor but 
>> AWS says:
>>
>> MLHttpRequest cannot load 
>> https://s3.amazonaws.com/[...]/cms/js/wymeditor/skins/django/skin.js. 
>> Origin [...] is not allowed by Access-Control-Allow-Origin.
>>
>> I actually searched a lot, and discovered this: 
>> http://docs.amazonwebservices.com/AmazonS3/latest/dev/cors.html
>>
>> Seems like a solution, but even if I activated it, nothing works.
>>
>> I'm at loss. It should work but it doesn't. Am I missing something here? 
>> Maybe it doesn't work the way I thought? Should I ask AWS directly?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django 1.4 - how to display a success message on form save

2013-04-04 Thread Zach Mance
Hi Kurtis,

I saw your SO post, and I'm trying trigger success messages from my CBV's, 
and I'm just wondering how your "MessageMixin" methods work with your 
CBV's. For example, where/how does the form_valid() get called to pass the 
success_message from the CBV's. 

Also, will this work with 1.4? 


On Tuesday, June 26, 2012 10:31:17 AM UTC-5, Kurtis wrote:
>
> We do it all over our site. I use class-based views but you can checkout 
> my "MessageMixin". I have the code on this stackoverflow page:
>
>
> http://stackoverflow.com/questions/5531258/example-of-django-class-based-deleteview/10903943#10903943
>
> It will show up wherever you send the user to next, as long as your 
> template is coded to display the message.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Settings for different environments

2013-02-17 Thread Zach Borboa
Yet another approach to using local development settings versus production 
settings. Here's something I've been using that I wanted to share. Thanks

https://github.com/django-settings/django-settings

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django on Bluehost

2012-09-24 Thread Zach
Hey everyone,
I have recently been setting up a Django 1.4.1 project with python 2.7.2 
and MySQL. I am using fcgi to deploy my project in this environment because 
mod_wsgi is not available through bluehost. After much frustration I have 
gotten my site up to display the "it works" page. Now for some strange 
reason I can not get it away from this page. I have set up the urls.py file 
for the main project along with adding my app into the Installed_Apps 
section of the settings.py file. 
My .htaccess file is the following
*AddHandler fcgid-script .fcgi*
*Options +SymLinksIfOwnerMatch*
*RewriteEngine On*
*RewriteBase /*
*RewriteRule ^(media/.*)$ - [L]*
*RewriteRule ^(adminmedia/.*)$ - [L]*
*RewriteCond %{REQUEST_URI} !(mysite.fcgi)*
*RewriteRule ^(.*)$ mysite.fcgi/$1 [L]*

My mysite.fcgi is the following
*#!/home1/propesn4/python27/bin/python*
*import sys, os*
*sys.path.insert(0, "/home1/propesn4/python27")*
*os.environ['DJANGO_SETTINGS_MODULE'] = "project.settings"
*
*sys.path.append("/home1/propesn4/project/")*
*from django.core.servers.fastcgi import runfastcgi*
*runfastcgi(method="threaded", daemonize="false")*
*
*
When I make changes to my django project I preform a *touch mysite.fcgi* so 
that the fcgi agent knows there has been changes.
If anyone could lead me in the right direction I would really appreciate it!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Aqyku-yyimsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Setting up Django 1.4 for a production environment

2012-09-23 Thread Zach
I am new to django and I am having trouble following the instructions on 
setting up django with apache and mod_wsgi. Apache 2.2.22, Python 2.7.2 and 
mod_wsgi are all install on my machine running Mac os X 10.8.2 (mountain 
lion). I have imported a conf file to my httpd file with the following

WSGIScriptAlias / /Users/Zachary/Sites/django/project/project/wsgi.py
 


Order deny,allow
Allow from all



I just want to get the initial django project setup so it goes to the "it 
works" page. My wsgi.py is the default file with the following

import os

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

I am sure I am missing a lot, so if anyone can just point me in the right 
direction that would be awesome! I do know mod_wsgi is installed and 
running because I was able to get the hello world file from their 
configuration tutorial to work

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/foi5DE1zsWYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



PostgreSQL Socket 5432 Error

2012-04-19 Thread Zach
Hi I am trying to setup a PostgreSQL database for Heroku. I am running
into trouble.

I installed PostgreSQL(9.0) from EnterpriseDB on OS X 10.6. However,
when I do a simple

 $ psql -U postgres

I get this error message.

 psql: could not connect to server: No such file or directory
 Is the server running locally and accepting
 connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.
5432"?

I am getting the same message when I do a syncdb.

Any ideas what could be causing this.  Thank you so much!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Need help creating model.

2012-03-27 Thread Zach
I have the following in my Student model. I am wanting to track the
date of each point given to each student. The idea would be so that I
could see not only how many points each student has, but also see the
date each point was given. In the future I want to see the trend of
each students' points.   How should I go about this? Should I use a
Foreign Key in another class. I am new to this so thanks for reading.


class Student(models.Model):

  CLASS_CHOICES = (
(u'Yoga','Yoga'),
(u'Spanish', 'Spanish'),
(u'French', 'French'),
(u'Dance', 'Dance'),
  )

  name = models.CharField(max_length=30)
  points = models.IntegerField(max_length=4)
  classname = models.CharField("Class Name",max_length=20, choices =
CLASS_CHOICES)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Additional fields in Django-Registration

2012-01-30 Thread Zach
Hi,

I have been trying to add first_name and last_name to django
registration but I can't get the information to save.  It appears on
the form but something isn't right.  I have been looking at different
solutions online but for some reason it is not working.  Please help.
Thank you!

My post on StackOverflow

http://stackoverflow.com/questions/9066739/additional-fields-not-saving-with-django-registration>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Adding first_name and last_name to django registration

2012-01-28 Thread Zach
I have tried to use this tutorial but I didn't have any luck.

http://inka-labs.com/en-us/blog/2012/01/13/add-custom-backend-django-registration/



On Jan 28, 9:23 pm, Andres Reyes <armo...@gmail.com> wrote:
> The django.contrib.auth User model already contains first_name and
> last_name fields so you don't need a UserProfile for that.
>
> Also the view that handles the registration takes a form_class that
> parameter that you can pass in the urlconf, you would only need to
> subclass the RegistrationForm, add your fields and then pass it to
> django-registraion
>
> https://bitbucket.org/ubernostrum/django-registration/src/d073602dc10...https://bitbucket.org/ubernostrum/django-registration/src/d073602dc10...
>
> 2012/1/28 Jonathan Paugh <jpa...@gmx.us>:
>
>
>
>
>
>
>
>
>
> > contrib.auth.models.User has a get_profile() hook that allows you to add
> > extra info to a user account from your own model; however, I don't see
> > support for that in django-registration at first glance.
>
> > I'm looking at the code from
> >https://bitbucket.org/ubernostrum/django-registration/
>
> > On 01/28/2012 11:59 AM, Zach wrote:
> >> I am new to Django and have implemented the django-registration app on
> >> my website. I want users to input their first name and last name on
> >> the registration page. However, the default setting only ask users for
> >> their email address/username/password . Is there an easy way to
> >> address this?
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> Andrés Reyes Monge
> armo...@gmail.com
> +(505)-8873-7217

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Adding first_name and last_name to django registration

2012-01-28 Thread Zach
I am new to Django and have implemented the django-registration app on
my website. I want users to input their first name and last name on
the registration page. However, the default setting only ask users for
their email address/username/password . Is there an easy way to
address this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Subclassing models

2007-02-10 Thread Zach Seifts

I don't want to use a ForeignKey. I want to be able to set up a class
in the model and not have a table created. Maybe the base model thing
is the way to do it. I've read somewhere about mixins, could these be
of interest?

On Feb 10, 4:37 pm, "Collin Grady" <[EMAIL PROTECTED]> wrote:
> Subclassing doesn't work right yet, you need to use a ForeignKey or
> similar to the base model in order to relate them - if you do it the
> way you're trying it will break things randomly.
>
> On Feb 10, 12:25 pm, "Zach Seifts" <[EMAIL PROTECTED]> wrote:
>
> > I have been working on a project where I need to create a few classes
> > in the model that are very similar. What I want to do is subclass a
> > model but have it not set up a database table. I know there are ways
> > of doing this I just haven't figured out yet.
>
> > Here's an example of what I am trying to do
>
> > class Foo(models.Model)
> > """ This class does not have a db table """
> > name = models.CharField(maxlength=100)
>
> > class Bar(Foo)
> > """ This class has a db table """
> > eyeColor = models.CharField(maxlength=100)
>
> > Thanks for you help.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Subclassing models

2007-02-10 Thread Zach Seifts

I have been working on a project where I need to create a few classes
in the model that are very similar. What I want to do is subclass a
model but have it not set up a database table. I know there are ways
of doing this I just haven't figured out yet.

Here's an example of what I am trying to do

class Foo(models.Model)
""" This class does not have a db table """
name = models.CharField(maxlength=100)

class Bar(Foo)
""" This class has a db table """
eyeColor = models.CharField(maxlength=100)

Thanks for you help.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django_website from svn on Mac OSX problems.

2006-06-28 Thread Zach

Hi, I'm running Mac OSX 10.4.7 on a Mac Mini Intel Core Duo (1.66 ghz
512mb of RAM) Python 2.4.3 (Universal Build). I have the latest Django
build from the trunk in the SVN. I got django_website straight from the
SVN, aswell. I installed memcached from darwinports and py-memcached
from the source. After only configuring my database settings
(Postgresql running locally connecting with psycopg2) and running
python manage.py syncdb I did python manage.py runserver and could not
access localhost:8000 from my web browser (I tried Camino and Safari).
Any ideas? Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---