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
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 par
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
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
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)
#
> 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
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,
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 var
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__() go
> 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?
San
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 t
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)
> 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 ch
> 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
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 ev
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, h
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 get
17 matches
Mail list logo