django-admin.py startproject mysite

2011-04-04 Thread Santiago Caracol
Hello, the Django (1.3) tutorial says: >From the command line, cd into a directory where you’d like to store your code, then run the command django-admin.py startproject mysite. This will create a mysite directory in your current directory. When I run django-admin.py startproject mysite, I

'NoneType' object has no attribute 'set_cookie'

2011-03-31 Thread Santiago Caracol
Hello, I didn't use a certain Django project for a few weeks. Now I wanted to continue developing the project and, as it usually happens with software that has been left alone for a while, it didn't work anymore. I am not aware of having changed anything. The system administrator may, of course,

reimport module every n seconds in main process

2011-02-16 Thread Santiago Caracol
Hello, in a Django application I compile certain data into a Python module for efficiency reasons. Each time an admin changes or adds objects, this module also changes. Therefore, I want my main process (the one that is started with "manage.py runserver" or the like) to reimport the data module

Re: compiled regex as attribute

2011-02-11 Thread Santiago Caracol
> Since the pickled value is a string, it should work in fixtures. There is no point in storing the regex strings in a pickle field. I already have the regex strings in ordinary django fields. What I want to store is *compiled* regular expressions in order to be able to use them without having to

Re: compiled regex as attribute

2011-02-11 Thread Santiago Caracol
> http://pypi.python.org/pypi/django-picklefield/0.1 Thanks for the tip. This works, but it has one great disadvantage: The regexes can't be stored in fixtures. They are stored in the database directly. So it seems I would have to insert all my several thousand products manually again. And if I

compiled regex as attribute

2011-02-11 Thread Santiago Caracol
Hello, I have got objects with very large regular expressions: class Product(models.Model): # ... canonical_name = models.CharField(max_length=200) spelling_variants = models.CharField(max_length=1, blank=True) lexical_variants = models.CharField(max_length=1, blank=True)

Re: blank ModelMultipleChoiceField, sort a ManyToManyField that is allowed to be blank

2011-02-01 Thread Santiago Caracol
Ah, now there is a new problem. Before, my ManyToManyField was unsorted, but it was possible to add new items by clicking on the "+" button. Now my items are sorted thanks to a ModelMultipleChoiceFormField (with "order_by('...')" and "required=False"), but the "+" button is gone. Is there a way

Re: blank ModelMultipleChoiceField, sort a ManyToManyField that is allowed to be blank

2011-02-01 Thread Santiago Caracol
> No form fields take that argument - that's for model fields. > > Form fields take the argument "required", which defaults to True. Thank you! That is exactly the information I needed. By the way, is there a special reason why "blank" of model fields translates to "required" of form fields?

blank ModelMultipleChoiceField, sort a ManyToManyField that is allowed to be blank

2011-02-01 Thread Santiago Caracol
Hi, why can't a ModelMultipleChoiceField not have the property "blank=True"? I need the ModelMultipleChoiceField to sort the values of a models.ManyToManyField in a form class. Sorting works as expected, but only if the field is obligatory. (Else, I get the error message "TypeError: __init__()

use variable that is bound at an object's creation time at the object's creation time

2011-01-28 Thread Santiago Caracol
Hello, my model Product has an attribute spelling_variants and a property variants: class Product(models.Model): canonical_name = models.CharField(max_length=200) spelling_variants = models.ManyToManyField(String, related_name="product spellings", blank=True) ... @property def

slight model change makes app unusable

2011-01-19 Thread Santiago Caracol
Hello, I have got a model MobilePhone that has a producer, such as "alcatel", a canonical name, such as "b-500 s" and a paraphrase type, such as "a-341 i". Each instance of MobilePhone is supposed to calculate all its variants (such as alcatel b-500 s, alcatel b 500 s, alcatel b-500- s, b-500 s,

Re: override save()

2011-01-17 Thread Santiago Caracol
> Since these attributes > are "ordinary" attributes, they aren't saved to the database, so they > aren't loaded from it neither. It seems that this was the problem. Thank you. Santiago -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: override save()

2011-01-17 Thread Santiago Caracol
Sorry the formatting of the code went wrong. Here it is again: # class ContentClassifier(models.Model): # def save(self, *args, **kwargs): self.compile() super(ContentClassifier, self).save(*args, **kwargs) #

override save()

2011-01-17 Thread Santiago Caracol
Hello, I have got a model called ContentClassifier which uses regular expressions to classify the content of messages. It has a method compile() that compiles an instance's regular expressions into self.posrx. When the classify method calls compile, i.e. when each ContentClassifier compiles its

Re: compiled methods

2011-01-16 Thread Santiago Caracol
Thank you very much! The term "memoize" was exactly what I was looking for. Santiago -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email

compiled methods

2011-01-16 Thread Santiago Caracol
Hello, is there such a thing as "compiled methods" in Django i.e. methods whose return value is calculated only once and then stored? Or is there a canonical Djangoish way to implement this? An example: Suppose we have phone objects that have a canonical form, such as "alcatel a-341 i" and a

build application from admin code

2011-01-04 Thread Santiago Caracol
Hello, I just started using Django and I am still "marvelling at all the code I didn't have to write". I wonder if this code, the admin interface, could be used for the application itself. I would like to do something like this: Each user of my application gets his very own predefined objects of