For 1., did you import play_django?
On Jun 21, 11:17 am, tekion wrote:
> All,
> I noticed that putting single quote around include argument makes a
> different, for example:
> (r'^admin/', include(admin.site.urls)),
> (r'^polls/', include('play_django.polls.urls')),
> works. Where as:
> (r'^
import sys, codecs, locale
sys.stdout = codecs.getwriter(locale.getpreferredencoding())
(sys.stdout)
or you can hard-code locale.getpreferredencoding() as 'utf-8'
On Jun 7, 2:19 am, "Carlos A. Carnero Delgado"
wrote:
> Hi there!
>
> I'm having a problem with a custom management command. Running
I have a need to define 2 models, both with a large number of fields
in common, but where in once case these common fields are completely
optional, and in the other case they are mandatory.
class XYZTemplate(Model):
field_a = TextField( blank=True)
field_b = TextField( blank=True)
n the desirability of doing
this, and potential alternative solutions.
Thanks,
Richard
On Jun 17, 8:03 pm, Richard Colley wrote:
> I have a need to define 2 models, both with a large number of fields
> in common, but where in once case these common fields are completely
> optional, and in the o
lank attribute to false.
>
> TiNo
>
> On Wed, Jun 17, 2009 at 13:32, Richard Colley wrote:
>
>
>
> > Ok, after looking through the django wiki entries for AuditTrail
> > (http://code.djangoproject.com/wiki/AuditTrail) and DynamicModels
> > (http://code.dja
The answer was given to you in the previous post.
Whatever __unicode__() returns from your model is what will be
displayed.
So, on your model, define a __unicode__ method:
e.g.
class Person(...):
def __unicode__(self):
return self.name
On Jun 18, 12:03 am, DaveB wrote:
> > Your
, Jun 17, 2009 at 14:42, Richard Colley wrote:
>
>
>
> > Thanks TiNo,
>
> > Are there any caveats with this? e.g. to make syncdb etc. work
> > correctly?
>
> I don't know, as I never tried, and I am not very experienced with messing
> with the inner meta c
I have overriden the save method on my model, and want to use the id
field (default autoincrementing pk) to set one of the other fields.
Is this ok:
class MyModel(models.Model):
...
def save(self, *args, **kwargs):
super(MyModel, self).save(*args, **kwargs)
self.some_string_
Exactly as you had described ... I wanted to upload images to paths
with the model instance's id in it. Seemed easier for a human to
relate to that way (in case of maintenance outside of django).
However, the uuid approach or similar may be the way forward.
On May 13, 10:58 pm, zinckiwi wrote:
7;t even get as far as discovering that it could
> cause problems with shortcut functions. What turned me off at the
> outset was needing to provide fake or default values for every other
> field in the model, deleting that one if the "real" save failed, etc.
> Seemed like a
Why not call your "boot" code from settings.py?
On Aug 18, 4:05 pm, Tang Daogang wrote:
> hi, Emily,
>
> Let me introduce Scala/Lift as example.
>
> Every lift project has a file named 'Boot.scala', this file will only
> be executed once when this project boots up. In this file, we can
> write so
11 matches
Mail list logo