a model, blank=True inside the models
is transformed into required=False for the form.
class MyModelForm(forms.ModelForm):
class Meta:
model = MyModel
Hope this helps!
Dan Harris
dih0...@gmail.com
On Jun 22, 4:11 pm, Jonathan Hayward
<christos.jonathan.hayw...@gmail.com> wrote:
be looking for.
Cheers,
Dan Harris
dih0...@gmail.com
On Jun 22, 10:59 am, Venkatraman S <venka...@gmail.com> wrote:
> On Tue, Jun 22, 2010 at 8:06 PM, M Rotch <planetra...@gmail.com> wrote:
> > I'm setting up a website with multiple subdomains, and one thing I
> > notice
the super class delete. This way when the cascades
go through it doesn't have links to next or previous chapters and not
everything is deleted.
Hope this helps,
Dan Harris
dih0...@gmail.com
On Jun 15, 12:11 pm, Tim Arnold <a_j...@bellsouth.net> wrote:
> Hi,
> I have a model for a Book t
# replace
with your ordering method
return db_field.formfield(**kwargs)
return super(MyModelAdmin, self).formfield_for_foreignkey(db_field,
request, **kwargs)
Hope this helps,
Dan Harris
dih0...@gmail.com
On Jun 13, 8:53 am, backdoc <ali...@crotchett.com> wrote:
> This onl
This article might help you out: http://djangoadvent.com/1.2/object-permissions/
Cheers,
Dan Harris
dih0...@gmail.com
On Jun 11, 11:46 pm, Wiiboy <jordon...@gmail.com> wrote:
> Hi guys,
> I don't know whether the built-in permissions system would be
> appropriate here, but I
last meeting before 3 or start
betweeen 3pm and 5pm"
MyModel.objects.filter(latest_meeting | after_3_and_before_5)
Not sure if this is what you're looking for or if it's even right :)
Dan Harris
dih0...@gmail.com
On Jun 11, 4:28 pm, Cesar Devera <cesardev...@gmail.com> wrote:
> I'm
the space.
See: http://docs.djangoproject.com/en/1.2/ref/models/options/#verbose-name
for more details.
Cheers,
Dan Harris
dih0...@gmail.com
On Jun 11, 2:38 pm, creecode <creec...@gmail.com> wrote:
> Hello Dan,
>
> Thanks for the info. verbose_name does take care of the display
&
the "db_table" meta option. Please refer to the docs at:
http://docs.djangoproject.com/en/1.2/ref/models/options/#model-meta-options
for more information.
Cheers,
Dan Harris
dih0...@gmail.com
On Jun 11, 1:06 pm, creecode <creec...@gmail.com> wrote:
> Hello all,
>
> I
That looks ok from a code readability point of view, however you will
still need to cast the form values to float or cast the float values
(i.e. pow(2,2) and pow(2*math.pi*v,2) to Decimals otherwise will you
will get an UnsupportedOperation exception.
Dan Harris
dih0...@gmail.com
On Jun 11, 6:58
Looks like you haven't created any polls yet, at least not one with an
ID of 5. Go into the admin section described in part 2 of the tutorial
and make a few polls. Once you've create some you should see polls of
IDs 1,2,3 etc show up and the URLs should start to work.
Dan Harris
dih0...@gmail.com
models.py file only. If you make a models directory, you have to
import all models you want Django to recognize into your __init__.py
file within the models directory.
Hopefully this makes sense, if not I can try to be more clear.
Dan Harris
dih0...@gmail.com
On Jun 10, 4:46 pm, rahul jain <
first-view
part of the documentation for more.
Cheers,
Dan Harris
dih0...@gmail.com
On Jun 10, 6:30 pm, albert kao <albertk...@gmail.com> wrote:
> I try the "Writing your first Django app tutorial, part 3" (http://
> docs.djangoproject.com/en/dev/intro/tutorial03/#intro-tuto
}
As a readability thing, you might want to split that giant line of
code into a few separate calculations, but that's just an idea!
Cheers,
Dan Harris
dih0...@gmail.com
On Jun 10, 3:33 pm, Dan Harris <dih0...@gmail.com> wrote:
> The error looks like you are attempting to multiply
ead the docs, it may not be correct :)
Cheers,
Dan Harris
dih0...@gmail.com
On Jun 10, 4:54 pm, Michael Hrivnak <mhriv...@americanri.com> wrote:
> I read that myself. I asked the question because it goes on to state that you
> can specify down-stream models like this:
>
> query.select_re
n a list of the form:
[{'name__count': 2, 'name': u''}, {'name__count': 1, 'name':
u'bbb'}]
Hope this helps!
Dan Harris
dih0...@gmail.com
On Jun 10, 5:01 pm, SlafS <slaf...@gmail.com> wrote:
> Hi there!
> I have a question. If i have a model with some fields (let's say all
&g
over
like:
{% for r in res %}
{{ r.name }} - {{ r.name__count}}
{% endfor %}
however there may be duplicated {{ r.name }}
Dan Harris
dih0...@gmail.com
On Jun 10, 5:24 pm, SlafS <slaf...@gmail.com> wrote:
> Thanks.
>
> I've already tried that but this isn't quite what i'm looking for.
a foreign keys with a depth of two.
Hope this helps,
Dan Harris
dih0...@gmail.com
On Jun 10, 3:19 pm, Michael Hrivnak <mhriv...@americanri.com> wrote:
> If I use select_related() on a queryset and specify some attribute names, will
> it follow those relationships as far as possib
an convert the decimal returned by the form into a float, or
convert the floats into decimals and do your math. Converting to
decimal is probably more precise.
Hope this helps,
Dan Harris
dih0...@gmail.com
On Jun 10, 3:22 pm, Waleria <waleriantu...@gmail.com> wrote:
> Hello..
>
>
Sounds about right, glad it's working for you!
Dan Harris
dih0...@gmail.com
On Jun 10, 12:41 pm, onorua <ono...@gmail.com> wrote:
> I did following:
> add Media JS for User model (jquery and my own script follows), with
> FireBug get the names of HTML id of the elemets I
e than 1 match found")
candidates[0].incumbent = True
candidates[0].save()
Something like that might work for you assuming that the models and
stuff are similar. Also, this code is just off the top of my head, so
who knows if it will actually work :)
Cheers,
Dan Harris
dih0...@gmail.com
the comments to toggle ascending
vs descending.
Hope this helps,
Dan Harris
dih0...@gmail.com
On Jun 5, 9:16 pm, rahul jain <jainwolver...@gmail.com> wrote:
> Hi Django,
>
> I tried lots of different ways to get my ids listed in ascending order
> (1 - x). But it always d
ou reading? If they are the official Django tutorials that is most
likely a bug in the documentation.
The documentation on the deprecation of newforms in favor of form is
in the Django 1.0 release notes at:
http://docs.djangoproject.com/en/dev/releases/1.0/
Cheers,
Dan Harris
dih0...@gmail.com
O
uot;might" work.
And obviously if you have like 5 child classes, this gets ugly very
quickly.
Dan Harris
dih0...@gmail.com
On Jun 8, 3:27 pm, John M <retireonc...@gmail.com> wrote:
> Hmm, that doesn't really get me what I want, it just caches the
> related child objects in one SQL qu
ModelAdmin. You of course don't have to use
JQuery, but it is included by default in the admin and is quite
popular.
Dan Harris
dih0...@gmail.com
On Jun 8, 3:17 pm, onorua <ono...@gmail.com> wrote:
> Hello, thank you for your reply!
> That's really what I've looked for, some way to pre
You need to have a 500.html and a 404.html defined when DEBUG=False.
See: http://code.djangoproject.com/ticket/3335
Hope this helps!
Dan Harris
dih0...@gmail.com
On Jun 8, 2:56 pm, adrian <adrian.imm...@gmail.com> wrote:
> tracked the problem more down...
>
> the problem appe
ef/contrib/admin/#modeladmin-methods)
Hope this helps!
Dan Harris
dih0...@gmail.com
On Jun 8, 10:04 am, onorua <ono...@gmail.com> wrote:
> I have
>
> class User(models.Model):
> Switch = models.ForeignKey(Switch, related_name='SwitchUsers')
> Port = models.Fo
virtualenv can be used with mod_wsgi, we are doing so on our
production servers.
see http://code.google.com/p/modwsgi/wiki/VirtualEnvironments for more
information
Cheers,
Dan
On May 3, 8:26 am, Stodge wrote:
> I am aware of virtualenv, but can it be used with mod_wsgi. Time
I just wanted to give a shout out as well to webfaction. I used to use
my own virtual private server for hosting django stuff, but to cut
costs i switched to a webfaction account and it is pretty fantastic.
Super easy to set up, if you decide to go that way just drop me and
email and i'd be happy
Have you checked out:
http://code.google.com/p/django-threadedcomments/
I think it is still being updated for 1.1, but it should still work
with 1.1. I haven't used it, just know of it's existence.
Cheers,
Dan
On Aug 7, 11:44 am, Alessandro Ronchi
wrote:
> I
what error are you getting?
On Aug 1, 4:41 pm, cprsystems wrote:
> I'm trying to write a simple html page using Django that passes one
> variable via a submit button and text line and prints it out to
> another hmtl document. I'm having trouble getting it to work. Could
>
Assuming that you set_sub_date() function just sets the publish date
to when the item was created and easy way to do this is in the model
class PressRelease(models.Model):
pub_date = models.DateField(auto_now_add=True)
That will just set the pub_date to the current date when it is added
to
Looks just like you have an error in your programming, the name of
your view is "Dpatas", then you attempt to later call
"Dpatas.objects.filter()" as if Dpatas was a model. The _CheckLogin is
coming from your use of the @login_required decorator I would imagine.
Hopefully that helps,
Dan
On
Take a peek at the Django forms documentation, specifically the
ModelChoiceField and ModelMultipleChoiceField, the docs are at:
http://docs.djangoproject.com/en/dev/ref/forms/fields/
These fields allow you to specify a queryset to populate your form
select fields, this queryset can be the list
The stuff in the brackets are the optional arguments passed to the
"register" view.
You can read the documentation about the view at:
http://bitbucket.org/ubernostrum/django-registration/src/b360801eae96/docs/views.txt
Alternatively you can check out the code as well.
Cheers,
Dan
That shouldn't be a problem, after all templates are just strings as
are textfields.
If you have a model with your textfield in it as so:
class MyModel(models.Model):
template = models.TextField()
and you have a view which renders the template defined in the next
field
def
Oh I gotcha now.
Django model forms by default do not represent auto fields (ID's)
because it wouldn't make much sense for a user to be able to edit the
PK in a form. Having said that, I do understand why you need to be
able to see the PK.
I shown in my example, I personally prefer to represent
What do you mean by having the ID "in" the form? I don't quite
understand what you are trying to do.
On Jul 21, 4:15 pm, mettwoch wrote:
> Ok, I come back to what I wrote before. If the partner already exists
> it has an id (primary-key or whatever). If it doesn't exist it has
This may not be helpful but here is how I usually go about processing
model forms:
class Partner(models.Model):
# this is your model, DB fields go in here
# This is your model form
class PartnerForm(forms.ModelForm):
class Meta:
model = Partner
# This is the view that displays a
You can always check out the free online Django book at:
http://www.djangobook.com/
There is the 1.0 version (outdated) and a free web-preview of the 2nd
edition available.
In addition to books, the documentation for Django is pretty fantastic
to learn from for a beginner. This is located at:
http://docs.djangoproject.com/en/dev/topics/auth/#limiting-access-to-generic-views
hope this helps. Basically you write your own view which calls the
generic view after you have done your authentication.
On Apr 16, 11:25 am, Col Wilson
wrote:
> I'm using
40 matches
Mail list logo