Models within Imported TestCases not created in Test Database...

2011-04-17 Thread Bob Carr
Hi All, Why don't models within tests imported into app/tests.py get picked up during test database creation. from django.db import models from django.test import TestCase # This test defined in app/tests.py works fine... class test_TestModel(TestCase): class TestModel(models.Model):

Re: Using composition in Django

2011-04-17 Thread Guevara
Hello Craig! Thanks for the reply! Actually I want to use a form that will save the Employee data and would be sent to the Employee class, and this class has relationship with the Person and Address, the data would automatically be persisted. Follow the instructions you suggested and they match

Re: p.save not working in tutorial

2011-04-17 Thread Karen Tracey
On Sun, Apr 17, 2011 at 5:06 PM, xpdx wrote: > > >>> p > > >>> p.save > > > >>> Poll.objects.all() > [] p.save just shows you that p has an attribute named save, and what it is. You need parentheses after the save to actually call the method: >>> p.save() Karen --

p.save not working in tutorial

2011-04-17 Thread xpdx
Hi all! A newbee here. A little problem going through the tutorial. Hoping somebody can help. OS X 10.6.6 with included python version 2.6.1 Downloaded and installed Django from http://www.djangoproject.com/download/ verison 3.1 started tutorial- everything including creation of tables seemed

Re: problems with errors in templates

2011-04-17 Thread Daniel Roseman
On Sunday, 17 April 2011 21:41:15 UTC+1, Antonio Sánchez wrote: > > hi, im working with a modelform, and overrided clen methos for making > some custom checks, raising a forms.ValidationError when i need, im > sure this error is raised, but i dont know why in the template errors > are not

problems with errors in templates

2011-04-17 Thread Antonio Sánchez
hi, im working with a modelform, and overrided clen methos for making some custom checks, raising a forms.ValidationError when i need, im sure this error is raised, but i dont know why in the template errors are not showed (instead of form is showed again cause it's not valid!), here is some of

Re: Using composition in Django

2011-04-17 Thread W Craig Trader
On 04/16/2011 04:35 PM, Guevara wrote: Hello! I have two class, Person and employee, i need make a composition for this (Prefer composition over inheritance): class Person(models.Model): name = models.CharField(max_length=50) date_inclusion = models.DateField() # others fields

Re: Using composition in Django

2011-04-17 Thread Guevara
Thanks for the replies! if I leave the class person like this: class Employee(models.Model): person = models.OneToOneField(Person) This is SQL generated: CREATE TABLE "person_person" ( "id" serial NOT NULL PRIMARY KEY, "name" varchar(50) NOT NULL, ) ; CREATE TABLE

Force lowercase in Django-Taggit

2011-04-17 Thread shacker
I've just finished migrating my site's tagging system from django- tagging to django-taggit. Wrote up some notes on the migration process in case useful to anyone else: http://birdhouse.org/blog/2011/04/17/migrate-django-tagging-taggit/ But I still have two questions outstanding: 1) Unlike

Re: how to find if a record changed

2011-04-17 Thread Aref
I managed to solve the issue. Here's the code: def save(self, *args, **kwargs): if hasattr(self, 'id') and getattr(self, 'id') is not None: old_issue = Issues.objects.get(id=getattr(self,'id')) self.updated_at = datetime.datetime.now() if

Re: how to find if a record changed

2011-04-17 Thread Joel Goldstick
On Sun, Apr 17, 2011 at 1:25 PM, Aref wrote: > Thank you Mengu. I have tried what you suggested (I was concatenating > the date to the updated field instead) but the problem is that every > time there is a save the date gets added even though the field has not > changed.

Default from display for charfield

2011-04-17 Thread Richard Smith
Hello all: I am new to Django, and have what I hope is a simple question. in my model: class DESubscription(models.Model): SubscriptionIssuedGUID = models.CharField(max_length=36,unique=True,default=make_model_uuid) in my view: class AddSubscriptionForm(ModelForm): class Meta:

Re: how to find if a record changed

2011-04-17 Thread Aref
Thank you Mengu. I have tried what you suggested (I was concatenating the date to the updated field instead) but the problem is that every time there is a save the date gets added even though the field has not changed. So I wanted to test if the field was changed and if so concatenate the date to

Re: best practice override admin 1.2 "delete"?

2011-04-17 Thread Mengu
while i was reading the docs, i've noticed something and felt like i should warn you. my suggestion is not the best practice if you are doing something like "Model.objects.filter(some_field=some_value).delete()". for deletions like that you should use pre_delete signal [1]. [1]

Re: how to find if a record changed

2011-04-17 Thread Mengu
i believe it does. you can override the "save" method of your model like this: from django.db import models from datetime import datetime # Create your models here. class TestModel(models.Model): first_field = models.CharField(max_length=255) second_field = models.BooleanField()

Re: How to send email from html?

2011-04-17 Thread Mengu
that is actually jquery code, mixed with a django template variable. $ is an alias for jquery which lets you do some nice things with it. you can also replace it with "jQuery('#send_..')". #send_{{ forloop.counter }} means the element with id "send_x". x there is whatever the current

How to send email from html?

2011-04-17 Thread LIU Liang
I want to realize the e-mail verification for the social network. But not clear about the code below: what does the '$' and the '#' mean? and the method 'submit()? {% trans "re-send verification e-mail" %} I want that after clicking the button 'Verify', it should send out an e-mail. However,

how to find if a record changed

2011-04-17 Thread Aref
Hello, I have a text field which could be updated regularly and I want to automatically attach a date every time the record is updated--but only if the record is updated. Can this be done in django and how would I go about doing it. Thanks. -- You received this message because you are

Re: satchmo currency

2011-04-17 Thread ug Charlie
You are right. Thank you. Then I just need to add a button in the page to switch the currency. However, still have no idea for this. :( On 4/15/11, Chris Moffitt wrote: > First off, you'll probably get better responses on the Satchmo list. > > Secondly, changing languages

Programmaticly declaring Models and caching in Admin contrib

2011-04-17 Thread Yuka Poppe
Hi List, Maybe someone can hint me in the right direction with this. Im using Django backed by a non relational database, declaring my django models is enough in order to store and retrieve data, so I devised a design where models itself are declared by instantiating the metaclasses and using

Re: How to unit test if user has access to page

2011-04-17 Thread Pedro Kroger
Good point. Thank you guys! Pedro On Sat, Apr 16, 2011 at 2:15 PM, Martin Brochhaus wrote: > Also beware! Only do a client.post if you really want to test that a user > submits a form. Usually when a not-logged-in-user wants to go to a secured > page immediately

Re: Dajaxice and CSRF issues

2011-04-17 Thread Red
Hi, > At the point the first AJAX request is sent, the user doesn't have a validCSRF > token yet, since the user hasn't visited a Django page yet. .That's why a GET > may be preferable here. You could send the csrf token with the 1st page request via set- cookie: from django.middleware.csrf

Re: Dajaxice and CSRF issues

2011-04-17 Thread Red
Hi, I found this thread today as I have come across the same problem. I did find a solution that seems to work OK and I'd like to post it and get some feedback. I've built a standard user log in pretty much exactly the same as in the django docs. I now want to create a 2nd log in method that