Re: Guidance needed - Real time and django

2014-09-02 Thread Amirouche Boubekki
2014-09-02 18:15 GMT+02:00 Robin Lery :

> Thank you Amirouche! I will surely look onto that. And I saw many
> tutorials on django + node.js and socket.io, and was just curious as to
> what your thoughts are on this as the new version of socket.io has also
> been released?
>

I will look at the new version, later.

Last time I tried it, I didn't grasp the interest of it, except providing
fallbacks for browser that did not support websockets. Which probably means
that you need a specific code in the backend to support those...

Checkout the documentation of gevent-socketio

at some point there was a wrapper for django.


>
> On Mon, Sep 1, 2014 at 3:09 AM, Amirouche Boubekki <
> amirouche.boube...@gmail.com> wrote:
>
>> Hello,
>>
>>
>> 2014-08-29 17:26 GMT+02:00 Aamu Padi :
>>
>>  Hello,
>>> I would like to build a real time web application, but have little idea
>>> of where to start to from. It will have notification and feed system like
>>> facebook or instagram. Would really appreciate if anyone who have already
>>> done this type of web application could kindly guide me through. I will be
>>> very grateful.
>>>
>>
>> I never done such things besides small experiments and research...
>>
>> Here are some pointers:
>>
>> - search://django+gevent
>> - search://django+asyncio among other things django-c10k-demo
>>  created by Aymeric
>> Augustin django core contributor which use websockets
>> - search://tornado
>> - search://django+SSE
>> - search://django+webRTC
>> - search://django+pjax
>>
>> HTH,
>>
>> Amirouche
>>
>>>
>>> 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/CAHSNPWuiOJ5m%3DcCUFOc-j%3DRR3LHSAOyhd4Uk7HOaR78cQB-V4A%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAL7_Mo9Tfqi_BsM2KCLX7aVNZFZcC0vMO6eu1tMtrY-H6L8GKg%40mail.gmail.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2B4-nGpvDaKasrw_f-Bj6-B7UW6WRtDd17b%2BMk9BJ-WbKtwDJg%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ANNOUNCE] Django 1.7 released

2014-09-02 Thread Sithembewena Lloyd Dube
Awesome! Thanks to everyone who's made this release possible.


On Wed, Sep 3, 2014 at 12:13 AM, James Bennett 
wrote:

> Django 1.7 is now available:
>
> https://www.djangoproject.com/weblog/2014/sep/02/release-17-final/
>
> Alongside this are bugfix releases for 1.4, 1.5 and 1.6. The bugfix 1.5
> release is the final releae in the 1.5 series, as Django 1.5 has now
> reached end-of-life.
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/CAL13Cg_Cdzf3aYLxfV0qgrMY3CqbOqt%3D0DxEm1V27%2BzF65O_cA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Regards,
Sithu Lloyd Dube

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


Re: Writing your first Django App Part 1

2014-09-02 Thread Max Nathaniel Ho
Thanks!

For the codes, do I save them in views.py?

On Wednesday, September 3, 2014 7:23:07 AM UTC+8, Jonathan Querubina wrote:
>
> Just tupe in. Do not worry. 
>
> Is just for learning about the shell and its power 
>
> Sent from my iPhone 
>
> > On Sep 2, 2014, at 20:07, Max Nathaniel Ho  > wrote: 
> > 
> > I'm following the instructions in the tutorial but am stuck at this 
> part. 
> > 
> > We are told to type in "python manage.py shell" and explore the database 
> API. 
> > 
> > Thereafter there is a chunk of code that is presented. 
> > 
> > Am I supposed to type it into my Command Prompt box, and when I do, it 
> will be saved automatically? 
> > 
> > Where can I find the codeos so that I edit the codes in the future? 
> > 
> > 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...@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/7c4092e5-e8d4-4d15-8065-0f8139d0743f%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/80fc1a22-1f0b-4c20-b5b1-e113f16f4dbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How create a custom permission for a model?

2014-09-02 Thread YusufSalahAdDin
Hi men, now i have my model is thus:

from django.core.mail import send_mail, mail_admins


from django.db import models
from django.template.defaultfilters import slugify
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User


from ckeditor.fields import RichTextField


from subtopic.models import Subtopic
from topic.models import Topic
from keywords.models import KeyWord


#Global Vars




# Create your models here.


class New(models.Model):
author = models.ForeignKey(User, verbose_name='Autor', related_name=
'news')
content = RichTextField(verbose_name='Contenido')
created_date = models.DateTimeField(auto_now_add=True, verbose_name='Fecha 
y Hora')
is_published = models.BooleanField(verbose_name='Publicada', default=
False,) #Nueva, para verificar si se publica o no
keywords = models.ManyToManyField(KeyWord, blank=True, 
verbose_name='Palabras 
Clave', related_name='news')
place = models.CharField(max_length=255, verbose_name='Lugar')
source = models.URLField(verbose_name='Fuente', blank=True)
subtopic = models.ForeignKey(Subtopic, verbose_name='Subtema', 
related_name='news') #Filtramos por Opinion para sacar todas las columnas
times_viewed = models.PositiveIntegerField(default=0, editable=False, 
verbose_name='Veces Vista' )
title = models.CharField(verbose_name='Título', max_length=255, unique=
True)
slug =  models.SlugField(verbose_name='Slug', max_length=100, unique=
True)
topic = models.ForeignKey(Topic, verbose_name='Tema', related_name=
'news', )


class Meta:
ordering = ['-created_date']
verbose_name_plural = 'Noticias'
verbose_name = 'Noticia'


permissions = (
("can_publish", "Puede publicar noticias"), #Can publish news
)

def first_image(self):
return self.images.first() # Siendo images el related_name en Image


def first_video(self):
return self.videos #Devuelve el video de la imagen


def get_absolute_url(self):
return reverse ('NewsDefaultView', args = [str(self.created_date.
strftime("%Y")), str(self.created_date.strftime("%m")), str(self.
created_date.strftime("%d")), str(self.slug)])


def get_all_keys(self):
keys_list = self.keywords.values_list('name', flat=True)
return str(keys_list).strip("'[]'").replace("'",'')


#def is_published(self): devuelve si la noticia ha sido pulicada para 
que salga en la lista de noticias


def __str__(self):
return self.title


def save(self):  #Definir metodo para guardar, validar y otros metodos 
del Slug
super(New, self).save() #Solo con este me funciona correctamente
if not self.id:
self.slug = slugify(self.title)
super(New, self).save()


def get_queryset(self, request):
queryset = super(New, self).get_queryset(request)
if request.user.groups.filter(name="Author").exist():  # is the 
user an author?
 queryset = queryset.filter(author=self.user)  # only allow 
users to edit their own posts
return queryset


def get_readonly_fields(self, request, obj=None):
readonly_fields = super(New, self).get_readonly_field(request, obj)
if request.user.groups.filter(name="Author").exist():  # is the 
user an author?
readonly_fields += ['is_published']  # don't allow authors to 
change the publish status
return readonly_fields


from django.db.models.signals import post_save
def send_notification(sender, **kwargs):
return   mail_admins('Nueva noticia espera por edición','Una nueva 
noticia ha sido creada y espera ser editada y publicada muy pronto, anda, 
te esperamos.', )


post_save.connect(send_notification, sender=New)


from permission import add_permission_logic
from permission.logics import AuthorPermissionLogic, StaffPermissionLogic
add_permission_logic(New, AuthorPermissionLogic(
field_name='author',
any_permission=False,
change_permission=True,
delete_permission=True,
))
add_permission_logic(New, StaffPermissionLogic(
any_permission=False,
change_permission=True,
delete_permission=True,
))


from django.core.cache import cache
from django.db.models.signals import post_save
from django.dispatch import receiver


from django.contrib.sessions.models import Session
@receiver(post_save)
def clear_cache(sender, **kwargs):
if sender != Session:
cache.clear()

But, don't works, the author user can change other news and can publish 
:'(, what i'm doing bad?

I can created a group in python code? in models.py or other file or only 
can created a group in django admin?

El martes, 2 de septiembre de 2014 19:54:40 UTC-5, YusufSalahAdDin escribió:
>
> Wel wel wel, my code is it :
>
> news.models.py
>
> class New(models.Model):
> author = models.ForeignKey(User, verbose_name='Autor', related_name=
> 'news')
> content = RichTextField(verbose_name='Contenido')
> created_date = 

Re: How create a custom permission for a model?

2014-09-02 Thread YusufSalahAdDin
Wel wel wel, my code is it :

news.models.py

class New(models.Model):
author = models.ForeignKey(User, verbose_name='Autor', related_name=
'news')
content = RichTextField(verbose_name='Contenido')
created_date = models.DateTimeField(auto_now_add=True, verbose_name='Fecha 
y Hora')
is_published = models.BooleanField(verbose_name='Publicada', default=
False,) #Nueva, para verificar si se publica o no
keywords = models.ManyToManyField(KeyWord, blank=True, 
verbose_name='Palabras 
Clave', related_name='news')
place = models.CharField(max_length=255, verbose_name='Lugar')
source = models.URLField(verbose_name='Fuente', blank=True)
subtopic = models.ForeignKey(Subtopic, verbose_name='Subtema', 
related_name='news') #Filtramos por Opinion para sacar todas las columnas
times_viewed = models.PositiveIntegerField(default=0, editable=False, 
verbose_name='Veces Vista' )
title = models.CharField(verbose_name='Título', max_length=255, unique=
True)
slug =  models.SlugField(verbose_name='Slug', max_length=100, unique=
True)
topic = models.ForeignKey(Topic, verbose_name='Tema', related_name=
'news', )


class Meta:
ordering = ['-created_date']
verbose_name_plural = 'Noticias'
verbose_name = 'Noticia'


permissions = (
("can_publish", "Puede publicar noticias"), #Can publish news
)

from permission import add_permission_logic
from permission.logics import AuthorPermissionLogic, StaffPermissionLogic
add_permission_logic(New, AuthorPermissionLogic(
field_name='author',
any_permission=False,
change_permission=True,
delete_permission=True,
))
add_permission_logic(New, StaffPermissionLogic(
any_permission=False,
change_permission=True,
delete_permission=True,
))


As you can see, i'm using django-permission.

What have i do ?

El lunes, 1 de septiembre de 2014 12:07:19 UTC-5, Collin Anderson escribió:
>
> > Can't create other users
> > Can't create other topics or subtopics
> These can be done using built in permissions and groups
>
> Something like this might work for the rest:
>
> class NewsAdmin(models.Model):
>
> def get_queryset(self, request):
> queryset = super(NewsAdmin, self).get_queryset(request):
> if request.user.groups.filter(name="Author").exist():  # is the 
> user an author?
>  queryset = queryset.filter(author=self.user)  # only allow 
> users to edit their own posts
> return queryset
>
> def get_readonly_fields(self, request, obj=None):
> readonly_fields = super(NewsAdmin, self).get_readonly_field(
> request, obj)
> if request.user.groups.filter(name="Author").exist():  # is the 
> user an author?
> readonly_fields += ['published']  # don't allow authors to 
> change the publish status
> return readonly_fields
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/f8831c56-a326-447a-b296-214dc8f3cd3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANNOUNCE] Django 1.7 released

2014-09-02 Thread Nikolas Stevenson-Molnar
+1

I've been trying out 1.7 for a new project and the migrations are awesome!

_Nik

On 9/2/2014 3:15 PM, Carlos Aguilar wrote:
> congratulations!!!
>
> And thank you for a really good job!
>
> Best Regards
>
>
> On Tue, Sep 2, 2014 at 4:13 PM, James Bennett  > wrote:
>
> Django 1.7 is now available:
>
> https://www.djangoproject.com/weblog/2014/sep/02/release-17-final/
>
> Alongside this are bugfix releases for 1.4, 1.5 and 1.6. The
> bugfix 1.5 release is the final releae in the 1.5 series, as
> Django 1.5 has now reached end-of-life.
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to django-developers+unsubscr...@googlegroups.com
> .
> To post to this group, send email to
> django-develop...@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/django-developers/CAL13Cg_Cdzf3aYLxfV0qgrMY3CqbOqt%3D0DxEm1V27%2BzF65O_cA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> -- 
> Carlos Aguilar
> Consultor Hardware y Software
> DWD
> http://www.dwdandsolutions.com 
> http://www.houseofsysadmin.com 
> Cel: +50378735118
> USA: (301) 337-8541
> -- 
> You received this message because you are subscribed to the Google
> Groups "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/CAN-g%3Dg%3DW_9MXJiFawGX%2BczkVXLRKhdb6Zvp3AQU6sjnf2zPy7g%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.

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


Re: Writing your first Django App Part 1

2014-09-02 Thread Jonathan Querubina
Just tupe in. Do not worry. 

Is just for learning about the shell and its power

Sent from my iPhone

> On Sep 2, 2014, at 20:07, Max Nathaniel Ho  wrote:
> 
> I'm following the instructions in the tutorial but am stuck at this part.
> 
> We are told to type in "python manage.py shell" and explore the database API. 
> 
> Thereafter there is a chunk of code that is presented. 
> 
> Am I supposed to type it into my Command Prompt box, and when I do, it will 
> be saved automatically? 
> 
> Where can I find the codeos so that I edit the codes in the future?
> 
> 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/7c4092e5-e8d4-4d15-8065-0f8139d0743f%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/F1D9152A-339E-4169-A51B-6CEBFCDBC816%40me.com.
For more options, visit https://groups.google.com/d/optout.


Writing your first Django App Part 1

2014-09-02 Thread Max Nathaniel Ho
I'm following the instructions in the tutorial but am stuck at this part.

We are told to type in "python manage.py shell" and explore the database API. 

Thereafter there is a chunk of code that is presented. 

Am I supposed to type it into my Command Prompt box, and when I do, it will be 
saved automatically? 

Where can I find the codeos so that I edit the codes in the future?

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/7c4092e5-e8d4-4d15-8065-0f8139d0743f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Database configuration errors saying 'ENGINE' isn't set when it is

2014-09-02 Thread Shaun Kruger
After a few more hours of going over this I determined the root cause and 
now I simply do not understand how this was not a problem in dev instances 
or any other environments.

This was a circular import issue.

local_settings.py started with an import that fetched defaults from the app.
from .settings import *

/__init__.py imported some error handlers from common.utils (common is 
one of our 'apps').  common.utils also imported one model which invoked 
dependencies that tried to import django.db.  

In my testing I was having trouble understanding why when I started a 
python shell with all of the configuration environment variables I couldn't 
import django.db without getting an import error on local_settings.  This 
circular import explains that.  Moving my error handler functions to a 
different module resolved the circular import and now everything is working.

I was finally able to debug this by inserting a debugging statement at the 
beginning of django/db/__init__.py that called traceback.print_stack(). 
 The stack trace showed the "from .settings import *" followed by the 
import in /__init__.py that then imported common.utils that imported a 
database model and then finally the import of django.db.

On Tuesday, September 2, 2014 1:07:07 PM UTC-6, Shaun Kruger wrote:
>
> I have a django 1.4.3 application (upgrading to 1.4.14 made no difference) 
> that is behaving oddly.  I know 1.4 isn't officially supported, but I'm 
> hoping to come up with some understanding about what is going wrong so I 
> can get by for the next few weeks until we can start our upgrade to 1.7.  I 
> am also concerned that this problem won't simply be fixed by going to 
> django 1.7 because I have not been able to find any reference to these 
> conditions in my searching.
>
> The application is deployed as a pip installable package into a virtualenv 
> in a directory called vproton.  The local_settings.py file is specified by 
> environment variable and lives in a directory that is specified by the 
> PYTHONPATH environment variable sys.path has everything we expect it to.
>
> I first started investigating based on an odd error coming from a celery 
> worker.
>
> =
>   File 
> "/home/proton/vproton-15e49fb5/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
>  
> line 306, in get_default_columns
> r = '%s.%s' % (qn(alias), qn2(field.column))
>   File 
> "/home/proton/vproton-15e49fb5/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
>  
> line 49, in quote_name_unless_alias
> r = self.connection.ops.quote_name(name)
>   File 
> "/home/proton/vproton-15e49fb5/local/lib/python2.7/site-packages/django/db/backends/dummy/base.py",
>  
> line 15, in complain
> raise ImproperlyConfigured("settings.DATABASES is improperly 
> configured. "
> ImproperlyConfigured: settings.DATABASES is improperly configured. Please 
> supply the ENGINE value. Check settings documentation for more details.
> =
>
> It took a while, but I was able to figure out that this error was coming 
> up because the 'dummy' backend was being loaded instead of the one that is 
> configured in my settings file.
>
> What has been baffling is that we all have verified that our settings file 
> appears to be configured correctly and that django is loading it correctly.
>
> =
> $ PROTON_LOG_LOCATION=/home/proton/logs 
> DJANGO_SETTINGS_MODULE=local_settings PYTHONPATH=/home/proton/config 
> vproton/bin/django-admin.py shell
> Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
> [GCC 4.8.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>> from django.conf import settings
> >>> settings.DATABASES
> {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'HOST': 
> '***', 'PASSWORD': '***', 'NAME': 'proton_staging', 'USER': 
> 'proton'}}
> =
>
> As I dug deeper I wanted to understand how django's database connections 
> were handled so I began inspecting django.db (
> https://github.com/django/django/blob/1.4.3/django/db/__init__.py).  I 
> determined that the settings object imported from django.conf seems normal, 
> but things take a problematic turn once I get to ConnectionHandler which is 
> imported from django.db.utils (
> https://github.com/django/django/blob/1.4.3/django/db/utils.py).  
>
> django.db.connections is initialized by calling 
> ConnectionHandler(settings.DATABASES) and ConnectionHandler sets 
> self.databases equal to the value passed as settings.DATABASES so I expect 
> django.db.settings.DATABASES to match django.db.connections.databases, but 
> they do not match.
>
> =
> >>> import django.db
> >>> django.db.settings.DATABASES
> {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'HOST': 
> '***', 'PASSWORD': '***', 'NAME': 'proton_staging', 'USER': 
> 'proton'}}
> >>> django.db.connections.databases
> {'default': {'ENGINE': 

Re: Add/update form

2014-09-02 Thread Jagger
I realized, this could be the solution:

I changed spadmin_newstickeritem_changeform.html this way:

{% extends "spweb/spadmin/spadmin_base_ext.html" %}
{% block content %}
{% if newstickeritem_id %}

{% else %}

{% endif %}
{% csrf_token %}
 {{ form.as_p }}
 
 
 {% endblock %}

2014. szeptember 3., szerda 0:18:41 UTC+2 időpontban Jagger a következőt 
írta:
>
> Hi Everyone!
>
>
>
> I intend to write an add/update form.
>
>
> *models.py*:
>
> class NewsTickerItem(models.Model):
> #Content
> content = models.CharField(max_length=60)
> #Highlighted
> is_highlighted = models.BooleanField()
> #Active
> is_active = models.BooleanField()
> # Ordering number
> ordernum = models.IntegerField()
> #Expiry time
> expiry_time = models.DateTimeField()
>
> def __unicode__(self):
> return self.content
>
>
>
> *forms.py*:
>
> class NewsTickerItemForm(ModelForm):
> class Meta:
> model = NewsTickerItem
>
>
>
> *urls.py*:
>
>url(r'^spadmin_newstickeritem_changeform/add/$', 
> views.spadmin_newstickeritem_changeform,
>name='spadmin_newstickeritem_changeform_add'),
>
> url(r'^spadmin_newstickeritem_changeform/(?P\d+)/$', 
> views.spadmin_newstickeritem_changeform,
>
> name='spadmin_newstickeritem_changeform_update'),
>
> I have a link (spadmin_newstickeritem_changeform_add) on my webpage to add 
> new items, and another link (spadmin_newstickeritem_changeform_update) to 
> update existing items. Both links refer to 
> views.spadmin_newstickeritem_changeform method.
>
>
>
> *views.py*:
>
> def spadmin_newstickeritem_changeform(request, newstickeritem_id = None):
> if request.method == 'POST':
> if newstickeritem_id:
> newstickeritem = 
> NewsTickerItem.objects.get(pk=newstickeritem_id)
> form = NewsTickerItemForm(request.POST, 
> instance=newstickeritem)
> else:
> form = NewsTickerItemForm(request.POST)
>
> if form.is_valid():
> form.save()
> return 
> HttpResponseRedirect(reverse('spadmin_newstickeritem_changelist'))
> else:
> if newstickeritem_id:
> newstickeritem = 
> NewsTickerItem.objects.get(pk=newstickeritem_id)
> form = NewsTickerItemForm(instance=newstickeritem)
> else:
> form = NewsTickerItemForm()
>
> context = {'functiontitle': 'Newsticker item', 'form': form, 
> 'newstickeritem_id': newstickeritem_id}
> return render(request, 
> 'spweb/spadmin/spadmin_newstickeritem_changeform.html', context)
>
> I treat adding, and updating in one method.
>
>
>
> *spadmin_newstickeritem_changeform.html*:
>
> {% extends "spweb/spadmin/spadmin_base_ext.html" %}
> {% block content %}
> {% csrf_token %}
> {{ form.as_p }}
> 
> 
> {% endblock %}
>
>
> It works on update, because the newstickeritem_id exists. If 
> newstickeritem_id == None (in case of adding a new item), I get this error 
> message:
> "Reverse for 'spadmin_newstickeritem_changeform_update' with arguments 
> '(None,)' and keyword arguments '{}' not found. 1 pattern(s) tried: 
> ['spadmin_newstickeritem_changeform/(?P\\d+)/$']"
>
> How can I handle newstickeritem_id == None. How can I change form action 
> to spadmin_newstickeritem_changeform_add, in case of adding a new item. 
> Should I make different adding and updating templates?
>
>
> Thanks for your answers!
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/4c05edc3-8ba7-4258-af97-c9ef5643635f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Add/update form

2014-09-02 Thread Jagger


Hi Everyone!



I intend to write an add/update form.


*models.py*:

class NewsTickerItem(models.Model):
#Content
content = models.CharField(max_length=60)
#Highlighted
is_highlighted = models.BooleanField()
#Active
is_active = models.BooleanField()
# Ordering number
ordernum = models.IntegerField()
#Expiry time
expiry_time = models.DateTimeField()

def __unicode__(self):
return self.content



*forms.py*:

class NewsTickerItemForm(ModelForm):
class Meta:
model = NewsTickerItem



*urls.py*:

   url(r'^spadmin_newstickeritem_changeform/add/$', 
views.spadmin_newstickeritem_changeform,
   name='spadmin_newstickeritem_changeform_add'),
   
url(r'^spadmin_newstickeritem_changeform/(?P\d+)/$', 
views.spadmin_newstickeritem_changeform,
   name='spadmin_newstickeritem_changeform_update'),

I have a link (spadmin_newstickeritem_changeform_add) on my webpage to add 
new items, and another link (spadmin_newstickeritem_changeform_update) to 
update existing items. Both links refer to 
views.spadmin_newstickeritem_changeform method.



*views.py*:

def spadmin_newstickeritem_changeform(request, newstickeritem_id = None):
if request.method == 'POST':
if newstickeritem_id:
newstickeritem = 
NewsTickerItem.objects.get(pk=newstickeritem_id)
form = NewsTickerItemForm(request.POST, instance=newstickeritem)
else:
form = NewsTickerItemForm(request.POST)

if form.is_valid():
form.save()
return 
HttpResponseRedirect(reverse('spadmin_newstickeritem_changelist'))
else:
if newstickeritem_id:
newstickeritem = 
NewsTickerItem.objects.get(pk=newstickeritem_id)
form = NewsTickerItemForm(instance=newstickeritem)
else:
form = NewsTickerItemForm()

context = {'functiontitle': 'Newsticker item', 'form': form, 
'newstickeritem_id': newstickeritem_id}
return render(request, 
'spweb/spadmin/spadmin_newstickeritem_changeform.html', context)

I treat adding, and updating in one method.



*spadmin_newstickeritem_changeform.html*:

{% extends "spweb/spadmin/spadmin_base_ext.html" %}
{% block content %}
{% csrf_token %}
{{ form.as_p }}


{% endblock %}


It works on update, because the newstickeritem_id exists. If 
newstickeritem_id == None (in case of adding a new item), I get this error 
message:
"Reverse for 'spadmin_newstickeritem_changeform_update' with arguments 
'(None,)' and keyword arguments '{}' not found. 1 pattern(s) tried: 
['spadmin_newstickeritem_changeform/(?P\\d+)/$']"

How can I handle newstickeritem_id == None. How can I change form action to 
spadmin_newstickeritem_changeform_add, in case of adding a new item. Should 
I make different adding and updating templates?


Thanks for your answers!



-- 
You received this message because you are subscribed to the Google Groups 
"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/ae64d4b6-43d8-4b8a-999c-515d5d2fb0fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANNOUNCE] Django 1.7 released

2014-09-02 Thread Carlos Aguilar
congratulations!!!

And thank you for a really good job!

Best Regards


On Tue, Sep 2, 2014 at 4:13 PM, James Bennett  wrote:

> Django 1.7 is now available:
>
> https://www.djangoproject.com/weblog/2014/sep/02/release-17-final/
>
> Alongside this are bugfix releases for 1.4, 1.5 and 1.6. The bugfix 1.5
> release is the final releae in the 1.5 series, as Django 1.5 has now
> reached end-of-life.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-develop...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAL13Cg_Cdzf3aYLxfV0qgrMY3CqbOqt%3D0DxEm1V27%2BzF65O_cA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Carlos Aguilar
Consultor Hardware y Software
DWD
http://www.dwdandsolutions.com
http://www.houseofsysadmin.com
Cel: +50378735118
USA: (301) 337-8541

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


[ANNOUNCE] Django 1.7 released

2014-09-02 Thread James Bennett
Django 1.7 is now available:

https://www.djangoproject.com/weblog/2014/sep/02/release-17-final/

Alongside this are bugfix releases for 1.4, 1.5 and 1.6. The bugfix 1.5
release is the final releae in the 1.5 series, as Django 1.5 has now
reached end-of-life.

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


Re: Does Django detect changes in models Meta ?

2014-09-02 Thread Collin Anderson
The newest version of django, version 1.7, has migrations built in.

-- 
You received this message because you are subscribed to the Google Groups 
"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/48946c78-4d41-4229-bbc5-f433ab45cc5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: runserver error

2014-09-02 Thread Swathi Rajanna
gave*


On Wed, Sep 3, 2014 at 2:57 AM, Swathi Rajanna 
wrote:

>
>
> (r'^resetpassword/passwordsent/$',django.contrib.auth.views.password_reset_done),
> (r'^resetpassword/$',django.contrib.auth.views.password_reset),
>
> #(r'^reset/(?P[0-9A-Za-z]+)-(?P.+)/$','django.contrib.auth.views.password_reset_confirm'),
>
> url(r'^reset/(?P[0-9A-Za-z_\-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
> django.contrib.auth.views.password_reset_confirm),
> (r'^reset/done/$',django.contrib.auth.views.password_reset_complete),
>
>  this is what i GAVE
>
>
> On Wed, Sep 3, 2014 at 2:14 AM, Collin Anderson 
> wrote:
>
>> don't use quotes in your url conf:
>>
>> from whatever import password_reset
>>
>> url(r'^reset_password/$', password_reset),
>>
>> # not this
>> url(r'^reset_password/$', "password_reset"),
>>
>> --
>> 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/Si2Vm9BZ2Jo/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 http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/adddcf9f-6dbf-46c1-abd7-6fa84b113404%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/CAFL1zAu0kErhMq0SG9PaxiKDGM98YLWLZEmVEv%2B4SXp3RQK%2Brg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: runserver error

2014-09-02 Thread Swathi Rajanna
(r'^resetpassword/passwordsent/$',django.contrib.auth.views.password_reset_done),
(r'^resetpassword/$',django.contrib.auth.views.password_reset),

#(r'^reset/(?P[0-9A-Za-z]+)-(?P.+)/$','django.contrib.auth.views.password_reset_confirm'),

url(r'^reset/(?P[0-9A-Za-z_\-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
django.contrib.auth.views.password_reset_confirm),
(r'^reset/done/$',django.contrib.auth.views.password_reset_complete),

 this is what i GAVE


On Wed, Sep 3, 2014 at 2:14 AM, Collin Anderson 
wrote:

> don't use quotes in your url conf:
>
> from whatever import password_reset
>
> url(r'^reset_password/$', password_reset),
>
> # not this
> url(r'^reset_password/$', "password_reset"),
>
> --
> 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/Si2Vm9BZ2Jo/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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/adddcf9f-6dbf-46c1-abd7-6fa84b113404%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/CAFL1zAsGB6GWV73KJHpqt39egrsf6UFEW0u8w34XJ3QpFMNnhA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Concern about FastCGI deprecation

2014-09-02 Thread Shawn H
Thank you both for the response, and the explanation of why the FastCGI support 
was deprecated. I will look into both of your suggestions, though I will also 
look to see if http://pytools.codeplex.com/wikipage?title=wfastcgi (which I 
found after posting this question) will work. Microsoft apparently uses in this 
in the Azure environment, so it may be the best approach for ongoing support.

-- 
You received this message because you are subscribed to the Google Groups 
"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/cf087185-8541-463a-a38d-52c92b1ad707%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Does Django detect changes in models Meta ?

2014-09-02 Thread Norman Bird
OK, I found out that in order to change the schema of the tables one has to
install and run a migration tool. I used south. just install south and
check out their website for basic use and you basically run a few commands
from the command line and it sees the changes you made and migrate the
changes to your tables. I found that it does not work very well on sqlite3
Db, so I converted my DB to MYSQL and did that.

Or find another migration tool other than south, but in order to update
tables in Django, the easiest way is with a migration tool. And I found
this all out via stackoverflow. :-)

thanks



On Fri, Aug 22, 2014 at 11:42 PM, Norman Bird 
wrote:

> how about: python manage.py sql myapp
> I just changed my model and I had to runt that in order to build the
> tables.
>
>
> On Fri, Aug 22, 2014 at 11:49 AM, Norman Bird 
> wrote:
>
>> I stand corrected. :-)
>>
>>
>> On Fri, Aug 22, 2014 at 11:47 AM, Larry Martell 
>> wrote:
>>
>>> On Fri, Aug 22, 2014 at 9:55 AM, Norman Bird 
>>> wrote:
>>> > I am new, just completed the tutorials, but from my understanding you
>>> run
>>> > "python manage.py syncdb" and that rebuilds the tables etc.
>>>
>>> No, syncdb only create tables that do not exist. It does not alter any
>>> existing tables.
>>>
>>> >
>>> > On Friday, August 22, 2014 3:32:43 AM UTC-4, termopro wrote:
>>> >>
>>> >> Hi there,
>>> >>
>>> >> I am using Django 1.7 RC2.
>>> >> I have created models and have run all the migrations so Django
>>> created
>>> >> tables in database.
>>> >> Now i decided to change database table names and have added Meta
>>> class to
>>> >> models containing table name:
>>> >>
>>> >> class SomeModel(models.Model):
>>> >>...
>>> >>class Meta:
>>> >>   db_table = 'newname'
>>> >>
>>> >> Now when i run "makemigrations" Django doesn't detect any changes in
>>> >> models:
>>> >> "No changes detected in app 'blabla'."
>>> >> As far as i understand the logic, Django should change table names
>>> from
>>> >> 'appname_somemodel" to "newname".
>>> >>
>>> >> Is this an expected behavior or i am missing something?
>>>
>>> --
>>> 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/Yj6Guv0ch5k/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 http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CACwCsY6SXWrzFVthSXGEMGbF2UmVaP1dMiO%2ByDc1W8Qy_28OSQ%40mail.gmail.com
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Thank You,
>>
>> Norman Bird
>> Principal Web Development Consultant
>> DatabaseInDays.com
>> (703) 986-7157
>>
>
>
>
> --
> Thank You,
>
> Norman Bird
> Principal Web Development Consultant
> DatabaseInDays.com
> (703) 986-7157
>



-- 
Thank You,

Norman Bird
Principal Web Development Consultant
DatabaseInDays.com
(703) 986-7157

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


Re: runserver error

2014-09-02 Thread Collin Anderson
don't use quotes in your url conf:

from whatever import password_reset

url(r'^reset_password/$', password_reset),

# not this
url(r'^reset_password/$', "password_reset"),

-- 
You received this message because you are subscribed to the Google Groups 
"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/adddcf9f-6dbf-46c1-abd7-6fa84b113404%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


runserver error

2014-09-02 Thread Swathi Rajanna
python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_from_command_line(sys.argv)
  File 
"/home/swathi/env/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 399, in execute_from_command_line
utility.execute()
  File 
"/home/swathi/env/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/home/swathi/env/local/lib/python2.7/site-packages/django/core/management/base.py",
 
line 242, in run_from_argv
self.execute(*args, **options.__dict__)
  File 
"/home/swathi/env/local/lib/python2.7/site-packages/django/core/management/base.py",
 
line 280, in execute
translation.activate('en-us')
  File 
"/home/swathi/env/local/lib/python2.7/site-packages/django/utils/translation/__init__.py",
 
line 130, in activate
return _trans.activate(language)
  File 
"/home/swathi/env/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py",
 
line 188, in activate
_active.value = translation(language)
  File 
"/home/swathi/env/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py",
 
line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
  File 
"/home/swathi/env/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py",
 
line 159, in _fetch
app = import_module(appname)
  File 
"/home/swathi/env/local/lib/python2.7/site-packages/django/utils/importlib.py", 
line 40, in import_module
__import__(name)
ImportError: No module named password_reset

-- 
You received this message because you are subscribed to the Google Groups 
"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/95160656-df71-46a4-84e4-6f459ad8b40c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Does Django detect changes in models Meta ?

2014-09-02 Thread David Los
Very, very good question. I am experiencing the same issues with Django 
1.7rc2 and 1.7rc3.

Syncdb and sql statements are intended for Django < 1.7.

Would love to hear a solution!

Op vrijdag 22 augustus 2014 09:32:43 UTC+2 schreef termopro:
>
> Hi there,
>
> I am using Django 1.7 RC2.
> I have created models and have run all the migrations so Django created 
> tables in database.
> Now i decided to change database table names and have added Meta class to 
> models containing table name:
>
> class SomeModel(models.Model):
>...
>class Meta:
>   db_table = 'newname'
>
> Now when i run "makemigrations" Django doesn't detect any changes in 
> models:
> "No changes detected in app 'blabla'."
> As far as i understand the logic, Django should change table names from 
> 'appname_somemodel" to "newname".
>
> Is this an expected behavior or i am missing something?
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/90760ee6-5508-4f8b-a9d6-8633451df696%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Concern about FastCGI deprecation

2014-09-02 Thread James Bennett
On Tue, Sep 2, 2014 at 3:08 PM, Javier Guerra Giraldez 
wrote:

> FastCGI isn't a Django concern, as it is a WSGI-only framework (like
> most Python frameworks).   flup used to be a reasonable FastCGI WSGI
> container, but it's no longer supported, so it's unreasonable to ask
> the Django foundation to support it.
>
> the question is: what options are there to run WSGI under IIS?  my
> first guess would be any HTTP-WSGI container (gunicorn?) and set IIS
> as a proxy.


The answer is: copy/paste the flup bridge code from an old version of
Django.

Nothing in Django attempts to detect use of FastCGI and crash when
discovered. Rather, Django just no longer ships a FastCGI-to-WSGI bridge,
so deployments which use FastCGI will need to provide their own.

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


Re: Concern about FastCGI deprecation

2014-09-02 Thread Javier Guerra Giraldez
On Tue, Sep 2, 2014 at 2:15 PM, Shawn H  wrote:
> Please provide a lifeline to those of us who love Django but have to use
> IIS. Thanks.


FastCGI isn't a Django concern, as it is a WSGI-only framework (like
most Python frameworks).   flup used to be a reasonable FastCGI WSGI
container, but it's no longer supported, so it's unreasonable to ask
the Django foundation to support it.

the question is: what options are there to run WSGI under IIS?  my
first guess would be any HTTP-WSGI container (gunicorn?) and set IIS
as a proxy.

-- 
Javier

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


Concern about FastCGI deprecation

2014-09-02 Thread Shawn H
While my preference would be to run Django on Linux Apache and run 
mod_wsgi, I'm limited to a IIS web server for production. What options will 
those of us stuck in this situation have, now that FastCGI support is being 
removed? Please provide a lifeline to those of us who love Django but have 
to use IIS. 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/4662e96c-2b3c-4476-b3c0-c44646ba3aac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Database configuration errors saying 'ENGINE' isn't set when it is

2014-09-02 Thread Shaun Kruger
I have a django 1.4.3 application (upgrading to 1.4.14 made no difference) 
that is behaving oddly.  I know 1.4 isn't officially supported, but I'm 
hoping to come up with some understanding about what is going wrong so I 
can get by for the next few weeks until we can start our upgrade to 1.7.  I 
am also concerned that this problem won't simply be fixed by going to 
django 1.7 because I have not been able to find any reference to these 
conditions in my searching.

The application is deployed as a pip installable package into a virtualenv 
in a directory called vproton.  The local_settings.py file is specified by 
environment variable and lives in a directory that is specified by the 
PYTHONPATH environment variable sys.path has everything we expect it to.

I first started investigating based on an odd error coming from a celery 
worker.

=
  File 
"/home/proton/vproton-15e49fb5/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
 
line 306, in get_default_columns
r = '%s.%s' % (qn(alias), qn2(field.column))
  File 
"/home/proton/vproton-15e49fb5/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
 
line 49, in quote_name_unless_alias
r = self.connection.ops.quote_name(name)
  File 
"/home/proton/vproton-15e49fb5/local/lib/python2.7/site-packages/django/db/backends/dummy/base.py",
 
line 15, in complain
raise ImproperlyConfigured("settings.DATABASES is improperly 
configured. "
ImproperlyConfigured: settings.DATABASES is improperly configured. Please 
supply the ENGINE value. Check settings documentation for more details.
=

It took a while, but I was able to figure out that this error was coming up 
because the 'dummy' backend was being loaded instead of the one that is 
configured in my settings file.

What has been baffling is that we all have verified that our settings file 
appears to be configured correctly and that django is loading it correctly.

=
$ PROTON_LOG_LOCATION=/home/proton/logs 
DJANGO_SETTINGS_MODULE=local_settings PYTHONPATH=/home/proton/config 
vproton/bin/django-admin.py shell
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.conf import settings
>>> settings.DATABASES
{'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'HOST': 
'***', 'PASSWORD': '***', 'NAME': 'proton_staging', 'USER': 
'proton'}}
=

As I dug deeper I wanted to understand how django's database connections 
were handled so I began inspecting django.db 
(https://github.com/django/django/blob/1.4.3/django/db/__init__.py).  I 
determined that the settings object imported from django.conf seems normal, 
but things take a problematic turn once I get to ConnectionHandler which is 
imported from django.db.utils 
(https://github.com/django/django/blob/1.4.3/django/db/utils.py).  

django.db.connections is initialized by calling 
ConnectionHandler(settings.DATABASES) and ConnectionHandler sets 
self.databases equal to the value passed as settings.DATABASES so I expect 
django.db.settings.DATABASES to match django.db.connections.databases, but 
they do not match.

=
>>> import django.db
>>> django.db.settings.DATABASES
{'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'HOST': 
'***', 'PASSWORD': '***', 'NAME': 'proton_staging', 'USER': 
'proton'}}
>>> django.db.connections.databases
{'default': {'ENGINE': 'django.db.backends.dummy', 'TEST_MIRROR': None, 
'NAME': '', 'TEST_CHARSET': None, 'TIME_ZONE': 'America/Chicago', 
'TEST_COLLATION': None, 'PORT': '', 'HOST': '', 'USER': '', 'TEST_NAME': 
None, 'PASSWORD': '', 'OPTIONS': {}}}
=

I am now left with a question.  Is there any way that django.db can load a 
bad django.conf.settings when the settings module is given by environment 
variable?  As far as I can tell this problem shouldn't even be possible 
since importing django.conf initializes settings as an instance of 
LazySettings that loads .  Has anyone else run into this before?  Is this a 
known issue that would be resolved by just waiting for the 1.7 upgrade we 
have planned?  Is there anything that I should check for in my settings 
file that would cause a problem, but not result in any errors coming back 
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/535cd6e3-ab2a-4e7d-8eca-fb92f92eaf90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: celery problems

2014-09-02 Thread Dima
tried to run as a different user, now -
IOError: [Errno 13] Permission denied: '/home/linguion/log/
supervisord/supervisord.log'
help(


вторник, 2 сентября 2014 г., 21:43:21 UTC+3 пользователь Dima написал:
>
> The question is not really about Django, but can someone faced. Trying to 
> run on the server -
> /manage.py celeryd -l INFO
>
> output
> Running a worker with superuser privileges when the
> worker accepts messages serialized with pickle is a very bad idea!
>
>
> If you really want to continue then you have to set the C_FORCE_ROOT
> environment variable (but please think about this before you do).
>
>
> User information: uid=0 euid=0 gid=0 egid=0
>
> And of course when you run through the same supervisor. How to run without 
> root access? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/2c9d6533-ec49-4d28-ae33-7514423b1f02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


celery problems

2014-09-02 Thread Dima
The question is not really about Django, but can someone faced. Trying to 
run on the server -
/manage.py celeryd -l INFO

output
Running a worker with superuser privileges when the
worker accepts messages serialized with pickle is a very bad idea!


If you really want to continue then you have to set the C_FORCE_ROOT
environment variable (but please think about this before you do).


User information: uid=0 euid=0 gid=0 egid=0

And of course when you run through the same supervisor. How to run without 
root access? 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+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/61fd3d71-1f16-4761-a1fe-fa398598439c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Guidance needed - Real time and django

2014-09-02 Thread Robin Lery
Thank you Amirouche! I will surely look onto that. And I saw many tutorials
on django + node.js and socket.io, and was just curious as to what your
thoughts are on this as the new version of socket.io has also been released?


On Mon, Sep 1, 2014 at 3:09 AM, Amirouche Boubekki <
amirouche.boube...@gmail.com> wrote:

> Hello,
>
>
> 2014-08-29 17:26 GMT+02:00 Aamu Padi :
>
>  Hello,
>> I would like to build a real time web application, but have little idea
>> of where to start to from. It will have notification and feed system like
>> facebook or instagram. Would really appreciate if anyone who have already
>> done this type of web application could kindly guide me through. I will be
>> very grateful.
>>
>
> I never done such things besides small experiments and research...
>
> Here are some pointers:
>
> - search://django+gevent
> - search://django+asyncio among other things django-c10k-demo
>  created by Aymeric
> Augustin django core contributor which use websockets
> - search://tornado
> - search://django+SSE
> - search://django+webRTC
> - search://django+pjax
>
> HTH,
>
> Amirouche
>
>>
>> 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/CAHSNPWuiOJ5m%3DcCUFOc-j%3DRR3LHSAOyhd4Uk7HOaR78cQB-V4A%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAL7_Mo9Tfqi_BsM2KCLX7aVNZFZcC0vMO6eu1tMtrY-H6L8GKg%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Possible bug: delete_cookie() causes malformed Set-Cookie header

2014-09-02 Thread Tao Bojlen
Hi,

I'm trying to delete a cookie on user logout. The issue is that the 
Set-Cookie header in the response is malformed, and thus the cookie doesn't 
get deleted. This is the header:

Set-Cookie: "{{ cookie_name }}=; Domain={{ cookie_domain }}; expires=Thu, 
01-Jan-1970 00:00:00 GMT; Max-Age=0; 
Path=/sessionid=25lysb3tzhozv464mrgg08uqz100ur39; expires=Mon, 15-Sep-2014 
19:07:22 GMT; httponly; Max-Age=1209600; Path=/"
It looks like there should be some sort of division right before 
"sessionid=...". I've posted the view code on Stack Overflow if anyone wants to 
have a look: 
http://stackoverflow.com/questions/25611319/django-does-not-delete-cookie
Could this be an issue with my code, or perhaps a bug in Django?
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/696cf5e3-afe5-47e4-9660-9b1dbde25a57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Apache on Windows & multiple Django apps

2014-09-02 Thread DJ-Tom

*facepalm*... honestly, I did not spot the difference, i believed the line 
I had was right!!!

thanks anyways, I will try that tomorrow.

Am Dienstag, 2. September 2014 17:45:37 UTC+2 schrieb Collin Anderson:
>
> setdefault is what's causing your trouble. Change it to an explicit:
>
> os.environ['DJANGO_SETTINGS_MODULE'] = 'app.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/398b5cbb-adf7-425e-b91f-9902a8f5a6bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Apache on Windows & multiple Django apps

2014-09-02 Thread Collin Anderson
setdefault is what's causing your trouble. Change it to an explicit:

os.environ['DJANGO_SETTINGS_MODULE'] = 'app.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3322a2c1-ff5c-45e8-884f-e8852102b36a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Cannot start tutorial that begins with '"jango-admin.py startproject mysite"

2014-09-02 Thread Collin Anderson
django-admin (without .py) only works in django 1.7 what version are you 
using?

-- 
You received this message because you are subscribed to the Google Groups 
"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/b91c95e1-42f0-4700-b979-e89ad3350a62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Apache on Windows & multiple Django apps

2014-09-02 Thread DJ-Tom


Am Dienstag, 2. September 2014 13:51:28 UTC+2 schrieb Tom Evans:
 

> The most obvious and simple solution is to not use Windows.
>

lol - ever heard of the "box of pandora"? :-)

My knowledge of Linux boxes is very close to zero - so setting up a server 
that is not based on Windows would be the most complicated solution for me.

Apart from that, the box on which all of this needs to be run also runs a 
different application server which is Windows-only.

Thomas

-- 
You received this message because you are subscribed to the Google Groups 
"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/062785ad-d55f-40e4-9dd0-79ebf7e875e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: i18n and overriding django.auth translations

2014-09-02 Thread Avraham Serour
is this a theoretical question or did you try and it is not working?


On Tue, Sep 2, 2014 at 1:26 PM,  wrote:

> I've got some basic translations working in de_de (German), but it seems
> that django has brought it's own translations along for the ride after I
> compile.  I has not translated 'Password' in my locale files but DJango is
> doing it automatically (I assume from the django.admin module?).  That's
> fine, but is there a way to override this so that my translations in my
> locale files take precedence?
>
> So if my /locale/de_de/LC_MESSAGES/django.po file contains a translation,
> it overrides the default 'Passwort' that django is putting in?
>
> --
> You received this message because you are subscribed to the Google Groups
> "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/f5ba28a5-42ef-4cfa-a43b-19977440574b%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/CAFWa6tJy%2BF2w7OXAsmUqY_hab7ssFD4UD2WEpVHHbR4E%2BAN1%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How quickly do Django unit tests run?...

2014-09-02 Thread Fred Stluka

Benjamin,

Thanks for the followup!

I've been using MySQL.  For normal (non-testing) use, it seems
fast enough on our development machines (Mac laptop) and in
our TEST and PROD environments (Linux on AWS).  Page loads
are typically sub-second.  It was only when I used the command:
% python manage.py test
that I saw the long delays.

I assume the delays are related to the default stuff happening in
setUp() and tearDown() for each test.  Still happens with SQLite,
I assume.  Just much faster.  I may step through in the debugger
sometime to confirm this.

I read the slides at the URL you gave me.  Good info!  For now,
our site is fast enough and is not expected to scale dramatically,
but we do have a JIRA ticket for improving performance if/when
we need it.  So far, I've tossed a bunch of idea in there, but not
needed to do any of them:  profiling, caching, file minimization
and packaging, tuning mix of Ajax vs full page loads, etc.
I've added this URL to the JIRA ticket for further consideration
if/when we need it.

Is there a more current version of the slides?  This copy was
presented to OSCON in 2011, and refers to Django 1.3 as new.

Here are some notes I added to our JIRA ticket along with this
URL for if/when we need it:

- Beware ManyToManyField
- Beware over-indexing
- Look into pg_stat_activity (PostgreSQL), or MySQL equivalent
- Prefer NULL to DEFAULT when migrating a large table
   - Or do it 3 steps shown to avoid long lock on DB table
- Consider direct SQL sometimes instead of Django ORM
- Beware iterating over large querysets
- Beware filters with "__in" that match more than 10-15 items
- Beware OFFSET
- Use replication or a backup DB copy for large reporting operations
- Don't use DB as Celery job queue
- Use @commit_on_success or TransactionMiddleware
- Leave autocommit on (even thought it seems wrong)
- Modify tables in a fixed order.  Same for rows of a table.
- Pass QuerySets directly to templates (to allow lazy evaluation)
- Cache templates and fragments
- Cache expensive query results
- Pool DB connections if over 100 concurrent users
- Use db_routers.py to write primary DB, read replica DB

Thanks again!
--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 9/2/14 5:37 AM, Benjamin Scherrey wrote:
What DB were you testing on before? Unless you're going to launch this 
thing into production with SQLite I would recommend you switch back to 
whatever DB you're planning for production and test with it as you 
probably have some serious performance considerations to work out 
asap. If they're architectural rather than configuration-based issues 
then the sooner you recognize and repair them the better. If you 
happen to be using Postgres out of the box with no changes from your 
distro's base install then it's going to be real slow because 
Postgres' default config is to use as few resources as possible which 
necessarily makes performance less than optimal. It's not hard to make 
Postgres a very fast DB but you better start using it right to make 
things go well when you launch.


See this article for some good advice: 
http://thebuild.com/presentations/unbreaking-django.pdf It's a bit 
dated and newer versions of Django improve on the old implementation 
of the ORM but it's recommendations and things to look out for are 
sound. You need to measure your actual performance and act accordingly.


Good luck,

  -- Ben


On Sat, Aug 30, 2014 at 2:05 AM, Fred Stluka > wrote:


Benjamin,

I solved my problem.  I switched to SQLite for testing and now
run 500+ tests in 30 secs instead of 75 minutes.  Much better!

Thanks for your help!

--Fred

Fred Stluka -- mailto:f...@bristle.com --
http://bristle.com/~fred/ 
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 8/27/14 5:22 PM, Benjamin Scherrey wrote:

Postgres. best of luck.


On Thu, Aug 28, 2014 at 4:16 AM, Fred Stluka > wrote:

Ben,

Thanks!  That's exactly the kind of ballpark figure I wanted.

Sounds like I should be expecting roughly 5-10 tests/sec, plus
maybe 10-20 secs DB setup/migration.  I'm currently seeing 1
test per 7-9 secs, plus 50-60 secs DB setup time (syncdb, not
South, since I'm setting SOUTH_TESTS_MIGRATE = False).

Yeah, something must be wrong here.  I'm 

Re: crispy forms two forms and context

2014-09-02 Thread Brad Rice
I wrote an app that allows people to login to fill out an application. It 
has quite a few text areas that have to be filled out, so the idea was to 
allow them to fill out partial and come back and work on it and eventually 
submit it. The last stage before submit I pull all the data into a final 
form and allow them to submit it if they are satisfied. It set's required 
on the fields at that stage. There are three related db tables (models). So 
maybe, I'm thinking about this wrong. Instead of having two or three forms 
on a single page, maybe I need to built one from from the three related 
models at the end.

On Monday, September 1, 2014 8:45:05 PM UTC-4, James Schneider wrote:
>
> I would assume you want something akin to the first example here:
>
> https://docs.djangoproject.com/en/dev/topics/forms/modelforms/
>
> Once you have the form object built with the instance of your Answer 
> object, just pass it along.
>
> Since I've never needed more than one form on a page, there may be other 
> gotchas, but you should be able to Google for those. I don't believe that 
> you'll need to do anything special though. Keep in mind that only one of 
> the forms will be submitted (assuming each has it's own set of  
> tags). If you need to combine them and submit info for both, you may need 
> to roll a single custom form class that can handle all of the data, or 
> possibly look into Django formsets.
>
> -James
>
>
> On Monday, September 1, 2014, Brad Rice  
> wrote:
>
>> Here is my entire view class to go with a ModelForm. How do I get the 
>> various forms as context into my template?
>>
>> class ApplicationVerify(UpdateView):
>> model = Answers
>> form_class = ApplicationCheckForm
>> template_name = 'requestform/application_detail.html'
>>
>> @method_decorator(login_required(login_url='/accounts/login/'))
>> def dispatch(self, *args, **kwargs):
>> return super(ApplicationVerify, self).dispatch(*args, **kwargs)
>>
>> def get_object(self, queryset=None):
>> return Answers.objects.get(created_by=self.request.user)
>>
>> def form_valid(self, form):
>> obj = form.save(commit=False)
>> obj.created_by = self.request.user
>> obj.save()
>> a = Application.objects.get(created_by=self.request.user)
>> b = Answers.objects.get(created_by=self.request.user)
>> c = Applicant.objects.get(created_by=self.request.user)
>> return HttpResponseRedirect(reverse('requestform:app_complete', 
>> kwargs={'app_id': a.id}))
>>
>>
>> def get_context_data(self, **kwargs):
>> context = super(ApplicationVerify, 
>> self).get_context_data(**kwargs)
>> context['app'] = Application.objects.get(id=self.kwargs['app_id'])
>> context['answers'] = 
>> Answers.objects.get(created_by=self.request.user)
>> context['applicant'] = 
>> Applicant.objects.get(created_by=self.request.user)
>> return context
>>
>> On Monday, September 1, 2014 4:15:39 PM UTC-4, James Schneider wrote:
>>>
>>> It looks like you are passing the context an actual Answers object, not 
>>> a Form or ModelForm object that will add/update an Answers object, 
>>> hence the reason the trace back complains about a lack of 'fields'.
>>>
>>> -James
>>>
>>> On Monday, September 1, 2014, Brad Rice  wrote:
>>>
 This document seems to indicate I can have two forms inside one set of 
 form tags:

 http://django-crispy-forms.readthedocs.org/en/latest/
 crispy_tag_forms.html#rendering-several-forms-with-helpers

 I cannot figure out how to set the context to be able to iterate over 
 both forms.

 {% crispy form %}

 works on my model form.

  If I try to set context in my view like this:

 def get_context_data(self, **kwargs):
 context = super(ApplicationVerify, self).get_context_data(**
 kwargs)
 context['app'] = Application.objects.get(id=
 self.kwargs['app_id'])
 context['answers'] = Answers.objects.get(created_
 by=self.request.user)
 context['applicant'] = Applicant.objects.get(created_
 by=self.request.user)
 return context

 and then use instead of crispy form

 {% crispy answers %}

 I get errors.

 'Answers' object has no attribute 'fields'

 How do I set a form to have context from several models?

 I do see the context is coming into the template, it just is not 
 treating them as having form widgets.

 -- 
 You received this message because you are subscribed to the Google 
 Groups "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 

i18n and overriding django.auth translations

2014-09-02 Thread paul . connell
I've got some basic translations working in de_de (German), but it seems 
that django has brought it's own translations along for the ride after I 
compile.  I has not translated 'Password' in my locale files but DJango is 
doing it automatically (I assume from the django.admin module?).  That's 
fine, but is there a way to override this so that my translations in my 
locale files take precedence?

So if my /locale/de_de/LC_MESSAGES/django.po file contains a translation, 
it overrides the default 'Passwort' that django is putting in?

-- 
You received this message because you are subscribed to the Google Groups 
"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/f5ba28a5-42ef-4cfa-a43b-19977440574b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Apache on Windows & multiple Django apps

2014-09-02 Thread Robert Grant
Waitress runs fine on Windows; just install with pip.

On Tuesday, 2 September 2014 13:51:28 UTC+2, Tom Evans wrote:
>
> On Tue, Sep 2, 2014 at 12:08 PM, DJ-Tom  
> wrote: 
> > Most likely the docs refer to this section of wsgi.py: 
> > 
> >> # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This 
> >> breaks 
> >> # if running multiple sites in the same mod_wsgi process. To fix this, 
> use 
> >> # mod_wsgi daemon mode with each site in its own daemon process, or use 
> >> # os.environ["DJANGO_SETTINGS_MODULE"] = "spcmanage.settings" 
> > 
> > 
> > But I already have set this in wsgi.py: 
> > os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings") 
> > 
> > Daemon mode is not possible as this is only available in NON-Windows 
> > environments. 
> > 
> > So I'm still stuck with this. I did quite a lot of search for this but 
> > apparently nobody knows an answer that actually works. 
> > 
>
> The most obvious and simple solution is to not use Windows. Whilst 
> lots of open source software does work on Windows (to some extent), 
> almost all of it is not developed, designed or targeted for Windows. 
> Using Windows will make your life harder, not easier (I've never had 
> to track down specific binary versions of a python package, for 
> instance). 
>
> The next most simple solution is to not use mod_wsgi, use 
> mod_proxy_http to proxy to a standalone http server that runs django 
> in its own wsgi container. Again, your problem here is finding one 
> that runs well on Windows. uWSGI apparently supports it via Cygwin... 
>
> Cheers 
>
> Tom 
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/97edcc5d-ee32-4ff3-843a-ec3c8866c530%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Bug in Webkit when redirecting with anchor/fragment

2014-09-02 Thread saintger
Hello,

I would like a workaround for this 5.5 year old Webkit bug which remove the 
anchor when redirecting:
https://bugs.webkit.org/show_bug.cgi?id=24175
https://code.djangoproject.com/ticket/9967

Using language prefix in the URL 
(https://docs.djangoproject.com/en/dev/topics/i18n/translation/#language-prefix-in-url-patterns),
 
I cannot provide an language-independent URL with an anchor 
(example.com/index#description) because Safari will redirect to just 
example.com/en/index.

It may also cause problem with redirection from www.example.com to 
example.com or, or http://example.com to https://example.com.

Does someone know a good workaround with Django ?
I can always use parameters with example.com/index?ref=description but it 
seems really not elegant.

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/2c6f8222-0412-485f-9241-74d1394fb892%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: nothing i can do about "CSRF token missing or incorect" -- beginner

2014-09-02 Thread aseds
it suddenly got solved. i don't know how but now it's working.
anyway i didn't know exactly what this CSRF do but thanks to you i now do 
know. thanks again..

On Tuesday, September 2, 2014 4:25:11 PM UTC+4:30, François Schiettecatte 
wrote:
>
> Did you check that the csrf_token is actually inserted into the form by 
> looking at the HTML in the browser? 
>
> François 
>
> On Sep 2, 2014, at 3:57 AM, aseds  
> wrote: 
>
> > i searched and tried what i found to solve it, but... 
> > here is my edit.html which contains my form: 
> > 
> >  
> >  
> >  
> > {{ page_name }} - Editing 
> >  
> > 
> >  
> > Editing {{ page_name }} 
> >  
> > {% csrf_token %} 
> > {{ content 
> }} 
> >  
> >  
> >  
> > 
> >  
> > 
> > and here is my views.py: 
> > 
> > # ... 
> > 
> > def edit_page(request, page_name): 
> > try: 
> > page = Page.objects.get(pk = page_name) 
> > content = page.contents 
> > except Page.DoesNotExist: 
> > content = "" 
> > return render(request, "edit.html", {"page_name": 
> page_name, "content": content}) 
> > 
> > # ... 
> > 
> > 
> > i changed my views.py as was suggested in a webpage to this: 
> > 
> > @csrf_protect 
> > def edit_page(request, page_name): 
> > c = {} 
> > try: 
> > page = Page.objects.get(pk = page_name) 
> > content = page.contents 
> > except Page.DoesNotExist: 
> > content = "" 
> > return render(request, "edit.html", {"page_name": 
> page_name, "content": content}, c) 
> > 
> > 
> > but it didn't help. 
> > thank you for your 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...@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/0acb15b8-6752-4930-8e72-c3c77ec9bd32%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/59ce8509-3cca-45c5-934e-042da25c673d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: nothing i can do about "CSRF token missing or incorect" -- beginner

2014-09-02 Thread François Schiettecatte
Did you check that the csrf_token is actually inserted into the form by looking 
at the HTML in the browser?

François

On Sep 2, 2014, at 3:57 AM, aseds  wrote:

> i searched and tried what i found to solve it, but...
> here is my edit.html which contains my form:
> 
> 
> 
> 
>   {{ page_name }} - Editing
> 
> 
> 
>   Editing {{ page_name }}
>   
>   {% csrf_token %}
>   {{ content 
> }}
>   
>   
> 
> 
> 
> 
> and here is my views.py:
> 
> # ...
> 
> def edit_page(request, page_name):
>   try:
>   page = Page.objects.get(pk = page_name)
>   content = page.contents
>   except Page.DoesNotExist:
>   content = ""
>   return render(request, "edit.html", {"page_name": page_name, 
> "content": content})
> 
> # ...
> 
> 
> i changed my views.py as was suggested in a webpage to this:
> 
> @csrf_protect
> def edit_page(request, page_name):
>   c = {}
>   try:
>   page = Page.objects.get(pk = page_name)
>   content = page.contents
>   except Page.DoesNotExist:
>   content = ""
>   return render(request, "edit.html", {"page_name": page_name, 
> "content": content}, c)
> 
> 
> but it didn't help.
> thank you for your 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/0acb15b8-6752-4930-8e72-c3c77ec9bd32%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/B82B6A46-B77B-4E8A-9C0F-168B80E1A816%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Apache on Windows & multiple Django apps

2014-09-02 Thread Tom Evans
On Tue, Sep 2, 2014 at 12:08 PM, DJ-Tom  wrote:
> Most likely the docs refer to this section of wsgi.py:
>
>> # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This
>> breaks
>> # if running multiple sites in the same mod_wsgi process. To fix this, use
>> # mod_wsgi daemon mode with each site in its own daemon process, or use
>> # os.environ["DJANGO_SETTINGS_MODULE"] = "spcmanage.settings"
>
>
> But I already have set this in wsgi.py:
> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
>
> Daemon mode is not possible as this is only available in NON-Windows
> environments.
>
> So I'm still stuck with this. I did quite a lot of search for this but
> apparently nobody knows an answer that actually works.
>

The most obvious and simple solution is to not use Windows. Whilst
lots of open source software does work on Windows (to some extent),
almost all of it is not developed, designed or targeted for Windows.
Using Windows will make your life harder, not easier (I've never had
to track down specific binary versions of a python package, for
instance).

The next most simple solution is to not use mod_wsgi, use
mod_proxy_http to proxy to a standalone http server that runs django
in its own wsgi container. Again, your problem here is finding one
that runs well on Windows. uWSGI apparently supports it via Cygwin...

Cheers

Tom

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


Re: Apache on Windows & multiple Django apps

2014-09-02 Thread DJ-Tom
Most likely the docs refer to this section of wsgi.py:

# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This 
> breaks
> # if running multiple sites in the same mod_wsgi process. To fix this, use
> # mod_wsgi daemon mode with each site in its own daemon process, or use
> # os.environ["DJANGO_SETTINGS_MODULE"] = "spcmanage.settings"
>

But I already have set this in wsgi.py:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")

Daemon mode is not possible as this is only available in NON-Windows 
environments.

So I'm still stuck with this. I did quite a lot of search for this but 
apparently nobody knows an answer that actually works.

Am Montag, 1. September 2014 19:11:41 UTC+2 schrieb Collin Anderson:
>
> See the docs on deploying with mod_wsgi:
>
> https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/
>
> If multiple Django sites are run in a single mod_wsgi process, all of them 
> will use the settings of whichever one happens to run first. This can be 
> solved with a minor edit to wsgi.py (see comment in the file for 
> details), or by using mod_wsgi daemon mode 
> 
>  and 
> ensuring that each site runs in its own daemon process.
>

-- 
You received this message because you are subscribed to the Google Groups 
"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/dd26b9f6-ddca-4909-b2e3-31deb904a252%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How quickly do Django unit tests run?...

2014-09-02 Thread Benjamin Scherrey
What DB were you testing on before? Unless you're going to launch this
thing into production with SQLite I would recommend you switch back to
whatever DB you're planning for production and test with it as you probably
have some serious performance considerations to work out asap. If they're
architectural rather than configuration-based issues then the sooner you
recognize and repair them the better. If you happen to be using Postgres
out of the box with no changes from your distro's base install then it's
going to be real slow because Postgres' default config is to use as few
resources as possible which necessarily makes performance less than
optimal. It's not hard to make Postgres a very fast DB but you better start
using it right to make things go well when you launch.

See this article for some good advice:
http://thebuild.com/presentations/unbreaking-django.pdf It's a bit dated
and newer versions of Django improve on the old implementation of the ORM
but it's recommendations and things to look out for are sound. You need to
measure your actual performance and act accordingly.

Good luck,

  -- Ben


On Sat, Aug 30, 2014 at 2:05 AM, Fred Stluka  wrote:

>  Benjamin,
>
> I solved my problem.  I switched to SQLite for testing and now
> run 500+ tests in 30 secs instead of 75 minutes.  Much better!
>
> Thanks for your help!
>
> --Fred
> --
> Fred Stluka -- mailto:f...@bristle.com  --
> http://bristle.com/~fred/
> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
> Open Source: Without walls and fences, we need no Windows or Gates.
> --
>  On 8/27/14 5:22 PM, Benjamin Scherrey wrote:
>
> Postgres. best of luck.
>
>
> On Thu, Aug 28, 2014 at 4:16 AM, Fred Stluka  wrote:
>
>>  Ben,
>>
>> Thanks!  That's exactly the kind of ballpark figure I wanted.
>>
>> Sounds like I should be expecting roughly 5-10 tests/sec, plus
>> maybe 10-20 secs DB setup/migration.  I'm currently seeing 1
>> test per 7-9 secs, plus 50-60 secs DB setup time (syncdb, not
>> South, since I'm setting SOUTH_TESTS_MIGRATE = False).
>>
>> Yeah, something must be wrong here.  I'm running 100X slower
>> than expected.
>>
>> BTW, are those numbers using SQLite, MySQL, PostgreSQL, other?
>> So far, I'm using MySQL, running locally on a pretty fast Mac laptop.
>> I'm planning to switch to SQLite for testing, to make it run faster,
>> but haven't gotten that to work yet.
>>
>> My next steps will be try again with SQLite, and perhaps get the
>> test suite to run in the PyCharm debugger so I can step through
>> the code and see where all the time is going.
>>
>> Thanks again!
>>
>> --Fred
>> --
>> Fred Stluka -- mailto:f...@bristle.com  --
>> http://bristle.com/~fred/
>> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
>> Open Source: Without walls and fences, we need no Windows or Gates.
>> --
>>   On 8/27/14 4:21 PM, Benjamin Scherrey wrote:
>>
>>  Clearly that depends on what your tests do. One of our projects runs
>> ~400 tests in about a minute. If your tests do much database access or have
>> complex setUp/tearDown then that's not going to be as fast of course. The
>> Django 1.7 project I'm working on at the moment takes a total of 12.7
>> seconds to complete but most of that time is the setup and migrations
>> execution for the test db. Once it starts the 36 tests I have now complete
>> in 3.58 seconds in verbose mode with full branch coverage turned on.
>>
>>  coverage run --branch --source="partner,item,utils,importing,channel"
>> manage.py test --verbosity=2 && coverage report --show-missing
>>
>>  -- Ben
>>
>>
>> On Thu, Aug 28, 2014 at 3:13 AM, Fred Stluka  wrote:
>>
>>>  Benjamin,
>>>
>>> OK, Thanks!  So roughly how fast would you expect?  Hundreds
>>> of trivial tests per minute?  Thousands per minute?
>>>
>>> Thanks!
>>> --Fred
>>> --
>>> Fred Stluka -- mailto:f...@bristle.com  --
>>> http://bristle.com/~fred/
>>> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
>>> Open Source: Without walls and fences, we need no Windows or Gates.
>>> --
>>>   On 8/27/14 3:57 PM, Benjamin Scherrey wrote:
>>>
>>>  Something's definitely wrong. Except for the initial setup for the
>>> test run (in 1.7 migrations run each time for example), the individual
>>> tests should execute as fast as any normal python unit test.
>>>
>>>
>>> On Wed, Aug 27, 2014 at 9:06 PM, Fred Stluka  wrote:
>>>
 How quickly do Django unit tests run?

 Mine are taking 7-9 seconds each, even for trivial tests like:
 self.assertEqual(1 + 1, 2)
 that are all in the same test class of the same app.

 Is this typical?  Or do I have something misconfigured.

 Thanks!
 --Fred

 --

Re: New user - struggling with database design

2014-09-02 Thread Derek
That looks like a database error - check in your database as to which 
tables have been created.

On Thursday, 28 August 2014 18:05:01 UTC+2, Jason G wrote:
>
> Ok - here is where I am stuck now. Any thoughts?
>
> If I try to render {{ vessel.CurrentBrew }} in a view, I get something 
> like this:
>  0x7f76f0088e10>
>
> and this errors out:
>
> {% for Brew in vessel.CurrentBrew.all %}X{{ Brew.ActualName }}{% 
> endfor %}
>
> (1146, "Table 'dbLunawireBrewing.brewlog_vessel_CurrentBrew' doesn't exist")
>
>
>
> The vessel model looks like this:
>
> class Vessel(models.Model):
> Name = models.CharField(max_length=20)
> ShortName = models.CharField(max_length=4)
> Gallons = models.DecimalField(max_digits=4, decimal_places=2, null=True, 
> blank=True)
> Weight = models.DecimalField(max_digits=4, decimal_places=2, null=True, 
> blank=True)
> CurrentBrew  = models.ManyToManyField('Brew', related_name="brew")
> def __unicode__(self):
> return self.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/41928000-f83d-4403-aa9d-086429f1fa80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Cannot start tutorial that begins with '"jango-admin.py startproject mysite"

2014-09-02 Thread aseds
for me

django-admin.py

does not work, but

django-admin

does work. i don't know why.



On Friday, August 29, 2014 10:13:55 AM UTC+4:30, Jo MM wrote:
>
> Hello.
> I believe I have successfully installed Django based on having no problems 
> with testing "import django" at the command prompt and in the Python 
> interpreter.
> However, I cannot get the tutorial started. 
> As explained by the tutorial ("From the command line, cd into a directory 
> where you’d like to store your code, then run the following command:
> django-admin.py startproject mysite") I cd over to: C:\Users\John. When I 
> type "django-admin . . ." nothing happens. "mysite" is not created.
> I have looked at group messages. One thing I notice is that I appear to be 
> missing "Lib\site-packages\django\bin", but I don't know how to 
> find/download this.
> Also, at the command prompt when I cd to Python27\Scripts and enter 
> "django-admin.py 
> startproject mysite" I get "Import Error: No module named django.core".
>
> My set-up:
> 1. Windows 7 32-bit
> 2. C:\Python27\Scripts\django-admin.py
> 3. End portion of my System Path as shown in Environmental Variables: . . 
> ;C:\Python27\Scripts; 
> C:\Python27\Lib\site-packages\django\bin; 
> C:\Python27\Scripts\django-admin.py
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To 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/190f2625-7ed3-4311-93ce-9e3262ab46dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


nothing i can do about "CSRF token missing or incorect" -- beginner

2014-09-02 Thread aseds
i searched and tried what i found to solve it, but...
here is my edit.html which contains my form:




{{ page_name }} - Editing



Editing {{ page_name }}

{% csrf_token %}
{{ content }}






and here is my views.py:

# ...

def edit_page(request, page_name):
try:
page = Page.objects.get(pk = page_name)
content = page.contents
except Page.DoesNotExist:
content = ""
return render(request, "edit.html", {"page_name": page_name, "content": 
content})

# ...


i changed my views.py as was suggested in a webpage to this:

@csrf_protect
def edit_page(request, page_name):
c = {}
try:
page = Page.objects.get(pk = page_name)
content = page.contents
except Page.DoesNotExist:
content = ""
return render(request, "edit.html", {"page_name": page_name, "content": 
content}, c)


but it didn't help.
thank you for your 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/0acb15b8-6752-4930-8e72-c3c77ec9bd32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.