you can try something like that:
group = ...
choices = [(product.pk, product.name) for product in
group.product_set.all()]
form.fields["myfield"].choices = choices
On Wed, Aug 1, 2012 at 1:17 AM, Ignacio Soto wrote:
> Hi everyone
>
> i have this model
>
> GROUP and Product
>
>
> pro
On Tue, Jul 31, 2012 at 11:59 AM, Satinder Goraya
wrote:
> Lets say that you need a form with a drop-down list that have dynamic
> values. With Django this can be done simple and fast.
> my_choice_field). With this code get_my_choices is called on every
> form load and you will get your dynamic
Just now I also did
pip install --upgrade django
>>> import django
>>> django.get_version()
'1.4.1'
>>>
On 8/1/12, Mike Dewhirst wrote:
> Yesterday I did ...
>
> pip install --upgrade django
>
> ... and it happily upgraded mine to 1.4.1
>
> Mike
>
> On 1/08/2012 9:46am, Dennis Lee Bieber wr
On Tue, Jul 31, 2012 at 3:15 AM, JJ Zolper wrote:
> Hello all,
>
> I didn't realize a new release was put out until something weird happened.
>
> I'm installing DJ on my production server now and when I was downloading a
> copy from https://www.djangoproject.com/download/
On that same page (optio
Hi,
My checkboxes are giving me grief.
I want to make it required for the user to check a checkbox before being
allowed to submit a forms.
I'm using model forms so the checkbox is defined as a models.BooleanField
in my models.py. I have included blank=False, though this should be the
default.
I too have the same problem. How did you fix it?
On Wednesday, April 6, 2011 2:13:48 AM UTC+5:30, Roy Smith wrote:
>
> I'm using django-1.3 . I have a view with the following code:
>
> def item_create(request):
> if request.method == 'POST':
> form = ItemForm(request.POST)
>
On Monday, December 11, 2006 4:37:25 AM UTC+1, Rares Vernica wrote:
>
> Hi,
>
> What is a way to get the union of two QuerySets?
>
> Something like:
>
> In [6]: a = Person.objects.filter(first_name__startswith='mic')
>
> In [7]: b = Person.objects.filter(first_name__startswith='joh')
>
> In [8]: a
On 31-7-2012 14:36, Joris wrote:
>
>> Hmm, I guess I'm missing the "real world use case" for this. Most
>> importantly, I'm missing how this slow model relates to the fast model
>> and what kind of query it is executing. I'm especially curious about the
>> "as this statement is executed as an i
Read the above reply.
When you print form.error --> prints out a custom __unicode__ for you to
use in your templates.
However, you can iterate over form.errors and it will act as a normal dict.
On Wednesday, August 1, 2012 1:56:28 AM UTC-4, vivek soundrapandi wrote:
>
> I too have the same pro
Hello,
I want to take objects of another project that i don't have installed.
I can have the contenttype of the external object but I can't take the
object I understand that, take the object remotly of a model thah you
dosen't have have the class is not possible (I think...) but if i want only
a
Hi,
it's better Person.objects.filter(models.Q(first_**name__startswith='mic'),
models.Q(first_**name__startswith='joh'))
(only one query...)
2012/8/1 Robin Pedersen
> On Monday, December 11, 2006 4:37:25 AM UTC+1, Rares Vernica wrote:
>>
>> Hi,
>>
>> What is a way to get the union of two Que
It seems in this particular case you don't need the boolean field in the
model. As the behaviour you want has to do only with the form, you just
have to add an additional required checkbox in this model form.
class MyModelForm(forms.ModelForm):
involved = forms.BooleanField(required=True)
clas
I'm going to assume that we're talking about a single checkbox (an "I
agree to the terms" checkbox).
First, remember that unchecked is not the same as "blank", it is
"false", so "blank=False" is subject to interpretation.
There are two places where you might insist that the box be checked:
in the
The information comes from a database, which I got it with a problem.
However, I need to show a graph as well.
Please let me know any suggestions...
thanks and have great day.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this gro
On 08/01/12 10:28, Àlex Pérez wrote:
> Hi,
>
> it's better Person.objects.filter(models.Q(first_**name__startswith='mic'),
> models.Q(first_**name__startswith='joh'))
> (only one query...)
I'm pretty sure this will get you the intersection (it uses AND)
rather than the union (which would be usin
Do you need to display a graph, or allow the user to print one?
On Wed, Aug 1, 2012 at 12:06 PM, Peregil wrote:
> The information comes from a database, which I got it with a problem.
> However, I need to show a graph as well.
>
> Please let me know any suggestions...
>
> thanks and have great d
a user to print one
I did this in python, but throws an error in django when I tried to run
it... I have seen some examples of saving an image, but I would like to
avoid that since I don't want to open and close a file...
let me know if you have any idea
thanks
Python program:
def drawPlo
Thanks so much for the reply!
I had a feeling I would need it but I just like to be sure before I act.
Another thing. On Ubuntu there were additional packages I had to install. I
believe one was called "psycopg2-python-dev" or something like that.
If I install psycopg2-python at:
http://www.in
QuerySet API - istartswith - use UPPER instead of ILIKE with PostgreSQL
backend
which conflict with Documentation
(https://docs.djangoproject.com/en/dev/ref/models/querysets/)
as documentation's example shows SQL equivalent as " ILIKE "
Is this due to my backend being PostgreSQL? or is there se
OK, I got it working, I'm not sure what the problem was, but calling the
loop variable 'file' was overriding the python default file object class
now I'm doing this:
response = HttpResponse(File(file(tmp[1])),
mimetype="application/zip")
response['Content-disposition'] = ('attachm
Hi Anton,
Thank you very much for your response. The 'fields_for_a' is generating the
form fields for the instance of the model 'A'. The author admits that it
might not be the prettiest implementation, but fully functional.
def fields_for_a(instance):
# generate a sorted dict of fields co
Here are my models, if you are interested:
class Photographer(models.Model):
name = models.CharField(max_length=20)
models = models.ManyToManyField('Model')
class Model(models.Model):
model = models.CharField(max_length=20, blank=False)
series = models.Fore
What are you using for your plotting package? Matplotlib? I think that
this will show the plot (on the server machine)--the easiest thing I can
think of for now (assuming that you are using matplotlib) is to generate a
pdf and send them the file. I haven't tried printing directly--is this
intr
it is an intranet, and I don't have any restrictions
using JavaScript... abd I am using matplotlib... I thing it is the only way
to save a file and put it on the web page...
On Wed, Aug 1, 2012 at 1:59 PM, william ratcliff wrote:
> What are you using for your plotting package? Matplotlib?
On 1 elo, 19:15, Tim Chase wrote:
> On 08/01/12 10:28, lex P rez wrote:
>
> > Hi,
>
> > it's better Person.objects.filter(models.Q(first_**name__startswith='mic'),
> > models.Q(first_**name__startswith='joh'))
> > (only one query...)
>
> I'm pretty sure this will get you the intersection (it uses
On Sat, Jul 28, 2012 at 2:44 PM, lubos wrote:
> Hello,
>
> I have a quite sophisticated database with frequently interconnected
> tables and on the top level table, Django produces queries like this:
>
> SELECT `data_schedule`.`id`, `data_schedule`.`process_id`,
> `data_schedule`.`hardware_id`, `
On Tue, Jul 31, 2012 at 8:05 PM, Larry Martell wrote:
> I've only been working with django for 6 months, and I'm not really
> clear on how the login process works.
>
> I have a client that has a login screen created by a template. It has
> a submit button with:
>
>
>
> In their urls file they hav
As a quick hack, you could generate a postscript file using savefig().
Then, you could print that from the commandline to a local printer--If they
don't need a physical printout, I would generate a pdf file and serve it to
them and let them print it. If I figure out how to print directly using
th
I need to have the graphic on a web page... as soon as a user hit summit...
On Wed, Aug 1, 2012 at 3:16 PM, william ratcliff wrote:
> As a quick hack, you could generate a postscript file using savefig().
> Then, you could print that from the commandline to a local printer--If they
> don't nee
On 01/08/12 15:19, Peregil wrote:
I need to have the graphic on a web page... as soon as a user hit summit...
If you need to draw a graph, you can try the pygraphviz.
If you need to plot a chart, you can matplotlib, if that is not
so easy to implement, you can try using django google chart
If you can convert the Graph into an image (file or object) than you could
use PIL (Python Imaging Library) to dynamically generate an image and serve
it via a dynamically generated link.
On Wed, Aug 1, 2012 at 3:19 PM, Peregil wrote:
> I need to have the graphic on a web page... as soon as a us
Is the "Dialog Box" going to be presented using Javascript? If so, why not
use Javascript for this functionality? I'd typically only use this type of
functionality to serve pages when javascript isn't enabled or you need to
show various templates based upon the type of browser (for example, a
Mobil
If you just need the graphic on the web, then savefig("myfile.png") and
insert the image link in your template...Since you're already using
matplotlib, there's no need for another package.
William
On Wed, Aug 1, 2012 at 3:19 PM, Peregil wrote:
> I need to have the graphic on a web page... as s
Sorry for the double-message. Anyways, if you do want to do what that other
person recommended, simply find the View that the user is redirected to
after logging in. Then, modify the "context data" of that view to dump
whatever data to the template. And then do some magic in the template based
upon
On Wed, Aug 1, 2012 at 1:36 PM, Kurtis Mullins wrote:
> Is the "Dialog Box" going to be presented using Javascript? If so, why not
> use Javascript for this functionality? I'd typically only use this type of
> functionality to serve pages when javascript isn't enabled or you need to
> show various
On Wed, Aug 1, 2012 at 1:38 PM, Kurtis Mullins wrote:
> Sorry for the double-message. Anyways, if you do want to do what that other
> person recommended, simply find the View that the user is redirected to
> after logging in. Then, modify the "context data" of that view to dump
> whatever data to
On Wed, Aug 1, 2012 at 1:52 PM, Larry Martell wrote:
> On Wed, Aug 1, 2012 at 1:38 PM, Kurtis Mullins
> wrote:
>> Sorry for the double-message. Anyways, if you do want to do what that other
>> person recommended, simply find the View that the user is redirected to
>> after logging in. Then, modi
Great thanks...
I found this function... it seems complicated, but it is kind of
working... I hope that I can include it in a my web page...
# file charts.pydef simple(request):import randomimport django
import datetimefrom matplotlib.backends.backend_agg import
FigureCanvas
Today we've issued Django 1.3.3, a quick bugfix release which restores
Python 2.4 compatibility in the Django 1.3 release series:
https://www.djangoproject.com/weblog/2012/aug/01/django-13-bugfix-release/
Affected users are encouraged to upgrade.
--
You received this message because you are sub
If you're planning on adding this to your views.py, then you want to move
the import statements to the top of the file (outside of simple), so they
aren't called every time. Don't import django.
William
On Wed, Aug 1, 2012 at 4:06 PM, Peregil wrote:
> Great thanks...
>
>I found this funct
Can you attach an example png? If it's not too complex, you might be able
to do this all clientside as well...
William
On Wed, Aug 1, 2012 at 5:41 PM, william ratcliff wrote:
> If you're planning on adding this to your views.py, then you want to move
> the import statements to the top of the
On Wed, Aug 1, 2012 at 1:56 PM, Larry Martell wrote:
> On Wed, Aug 1, 2012 at 1:52 PM, Larry Martell wrote:
>> On Wed, Aug 1, 2012 at 1:38 PM, Kurtis Mullins
>> wrote:
>>> Sorry for the double-message. Anyways, if you do want to do what that other
>>> person recommended, simply find the View th
interesting!!! i will give it a try, and let you know.
thanks
2012/8/1 Anton Baklanov
> you can try something like that:
>
> group = ...
> choices = [(product.pk, product.name) for product in
> group.product_set.all()]
> form.fields["myfield"].choices = choices
>
>
> On Wed, Aug 1,
On Wed, Aug 1, 2012 at 5:08 PM, Doug Blank wrote:
> On Tue, Jul 31, 2012 at 3:15 AM, JJ Zolper wrote:
>> Hello all,
>>
>> I didn't realize a new release was put out until something weird happened.
>>
>> I'm installing DJ on my production server now and when I was downloading a
>> copy from https:
I'm trying to install django-tinymce so that I can use utilize it within
the admin when editing flatpages and flatblocks. I've been following the
instructions at
http://django-tinymce.readthedocs.org/en/latest/installation.html, but I
can't seem to get TinyMCE to display. django-tinymce has bee
On Wed, Aug 1, 2012 at 3:57 PM, Larry Martell wrote:
> On Wed, Aug 1, 2012 at 1:56 PM, Larry Martell wrote:
>> On Wed, Aug 1, 2012 at 1:52 PM, Larry Martell
>> wrote:
>>> On Wed, Aug 1, 2012 at 1:38 PM, Kurtis Mullins
>>> wrote:
Sorry for the double-message. Anyways, if you do want to do
On 2/08/2012 11:19am, jondbaker wrote:
I'm trying to install django-tinymce so that I can use utilize it within
the admin when editing flatpages and flatblocks. I've been following the
instructions at
http://django-tinymce.readthedocs.org/en/latest/installation.html, but I
can't seem to get TinyM
Thanks Mike. 'tinymce' is included in INSTALLED_APPS because I'm using the
app located here: https://github.com/aljosa/django-tinymce/ . I saw a few
comments around the web that suggested that this was the route to go to
easily integrate TinyMCE.
I've made a few adjustments to no avail. The app is
Well, I have been trying, but I cannot get the graph or error from the
function...
I will keep trying,..
On Wed, Aug 1, 2012 at 5:42 PM, william ratcliff wrote:
> Can you attach an example png? If it's not too complex, you might be
> able to do this all clientside as well...
>
>
> William
On 2/08/2012 1:37pm, Jonathan Baker wrote:
Thanks Mike. 'tinymce' is included in INSTALLED_APPS because I'm using
the app located here: https://github.com/aljosa/django-tinymce/ . I saw
a few comments around the web that suggested that this was the route to
go to easily integrate TinyMCE.
Sorry
50 matches
Mail list logo