Re: combobox prepopulated to only related objects to "self"

2012-08-01 Thread 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, 2012 at 1:17 AM, Ignacio Soto  wrote:

> Hi everyone
>
> i have this model
>
> GROUP and Product
>
>
> product has a group field thath is foreignkey to GROUP.
>
>
> and Group has foreignKey to Product to select primary product.
>
> so i want to have a group with many products and one is the "primary
> product".
>
>
> so...i could do this by select inline products with "trough" and search an
> intermediary Model (boolean field).
>
> but it let me select  more than one promary,
>
>
> the solution is the model this way:.
>
> product has a group field thath is foreignkey to GROUP.
>
>
> and Group has foreignKey to Product to select primary product.
>
> so i want to have a group with many products and one is the "primary
> product".
>
> but the primaryproduct field in group will be prepopulated with only the
> related products to this group.
>
>
> how i prepopulate the select(combobox) with the reverse query ?
>
>
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/d3UpfhONEWwJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards,
Anton Baklanov

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Dynamic forms

2012-08-01 Thread Sandeep kaur
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 drop-down.

This code is useful for bringing the drop down options from the database.
But I want to have the dynamically filtered options from the last
selected options without refreshing the page.

I have used the following code but it is not working according to my
requirement.
Please check and point out where I am making mistake.



from django import template

register = template.Library()

@register.inclusion_tag("field_test_select.html")
def field_test_select(request):
field_list = Field.objects.all()
return render_to_response('field_test_select.html', {'field_list'
: field_list}, context_instance=RequestContext(request))

def all_json_tests(request, field):
current_field = Field.objects.get(id=field)
test = Test.objects.all().filter(field=current_field)
json_test = serializers.serialize("json", test)
return HttpResponse(json_test, mimetype="application/javascript")



(r'^add_job/$', 'field_test_select'),
(r'^field/(?P[-\w]+)/all_json_tests/$', 'all_json_tests'),








Select a field
{% for field in field_list %}
{{ field.name }}
{% endfor %}


Select a test



$(document).ready(
 function() {
 $("select#field").change(function() {
 if ($(this).val() == 'Z') {
 $("select#test").html("");
 $("select#test").attr('disabled', true);
 }
 else {
 var url = "/field/" + $(this).val() +
"/all_json_tests";
 var field = $(this).val();
 $.getJSON(url, function(tests) {
 var options = '';
 for (var i = 0; i < tests.length; i++) {
options += '';
 }
 $("select#test").html(options);
 $("select#test
option:first").attr('selected', 'selected');
 $("select#test").attr('disabled', false);
 });
 //}
 });


 $("select#test").change(function(vent) {
 if ($(this).val() == -1) {
 return;
 }
 myAwesomeFunctionToCallWhenAtestIsSelected();
 });
 });
}





-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error in Brand New Django 1.4.1 released Yesterday

2012-08-01 Thread Babatunde Akinyanmi
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 wrote:
>> On Tue, 31 Jul 2012 16:06:20 -0700 (PDT), JJ Zolper
>>  declaimed the following in
>> gmane.comp.python.django.user:
>>
>>> Nope. Not Python 1.4. Django 1.4.
>>>
>>> http://pypi.python.org/pypi/Django/1.4#downloads
>>>
>>  Intriguing... When I did my search python.org routed me to the
>> Django server itself...
>>
>
> --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
Sent from my mobile device

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error in Brand New Django 1.4.1 released Yesterday

2012-08-01 Thread Doug Blank
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 (option number 2) are a couple of links for the
"Latest Development Version". The zip file is named:

django-django-1.4-616-g8d3e501.zip

but indeed the version in the zip file is:

VERSION = (1, 5, 0, 'alpha', 0)

-Doug

> and installed it and went into python:
>
 import django
 print django.get_version()
>
> I didn't see 1.4.1 I saw 1.5
>
> Sure it's probably a minor configuration fix to change it to 1.4.1 but I was
> really worried that I did something wrong.
>
> Maybe someone else can repeat this and see if I made a mistake or that
> indeed something is wrong with the brand new release?
>
> Cheers to all!
>
> JJ
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/sN647bh67AAJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Checkbox checking

2012-08-01 Thread Jon Underwood
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.

In the admin the checkboxes aren't required to be checked. When displaying 
the form in a template I can set required="True" as follows: 

This works in most browsers, though not Safari for some reason.

Is there a better method? I've messed around with this for ages!

Thank you in advance.

Jon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/4bBr_gr_Z44J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: form.errors is not a dictionary?

2012-08-01 Thread vivek soundrapandi
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) 
> if form.is_valid(): 
> url = form.cleaned_data['url'] 
> item.save() 
> return HttpResponseRedirect('/') 
> else: 
> print form.errors 
>
> when I submit the form, I expected that form.errors would print out as 
> a dict, as documented in 
> http://docs.djangoproject.com/en/1.3/ref/forms/api/#using-forms-to-validate-data.
>  
>
> Instead, I'm getting a hunk of HTML: 
>
>
> Django version 1.3, using settings 'soco-site.settings' 
> Development server is running at http://0.0.0.0:7626/ 
> Quit the server with CONTROL-C. 
> date_addedThis 
> field is required.user_id class="errorlist">This field is required. 
> [05/Apr/2011 16:36:32] "POST /item/create/ HTTP/1.1" 200 718 
>
> Is my understanding wrong, or is this a bug? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/-zDMLV9xjogJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: union of two QuerySets

2012-08-01 Thread 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 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 + b
>
> Thanks a lot,
> Ray
>

Try:

a | b

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ie69j4ewJNUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: merge data from multiple models

2012-08-01 Thread Melvyn Sopacua
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 instance of the model" bit. 
> 
> Ok, I'll try to explain this better. The fast model is coupled directly to 
> a table. The Slow model is not, it is activated by a specific sql query 
> that depends on a specific condition.

I thought about an alternative, since it seems your only reason to split
the models is performance and you prefer to have one model.
The prerequisite is that you know when you want to have access to the
slow data and make it available to the view.

The idea is borrowed from django.contrib.gis.db and it's GeoManager and
consists of implementing the raw sql as a method of the ModelManager and
adding the result of the query as attributes of the model.
For reference you can look at for example GeoQueryset.area()[1].

This will give you the ability to specify the queryset on a generic
class-based view to either be model.objects.all() for the fast version
or model.objects.calculate_slow_stuff() for the slow version.

[1]
https://docs.djangoproject.com/en/1.4/ref/contrib/gis/geoquerysets/#django.contrib.gis.db.models.GeoQuerySet.area
-- 
Melvyn Sopacua

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: form.errors is not a dictionary?

2012-08-01 Thread Victor Rocha
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 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) 
>> if form.is_valid(): 
>> url = form.cleaned_data['url'] 
>> item.save() 
>> return HttpResponseRedirect('/') 
>> else: 
>> print form.errors 
>>
>> when I submit the form, I expected that form.errors would print out as 
>> a dict, as documented in 
>> http://docs.djangoproject.com/en/1.3/ref/forms/api/#using-forms-to-validate-data.
>>  
>>
>> Instead, I'm getting a hunk of HTML: 
>>
>>
>> Django version 1.3, using settings 'soco-site.settings' 
>> Development server is running at http://0.0.0.0:7626/ 
>> Quit the server with CONTROL-C. 
>> date_addedThis 
>> field is required.user_id> class="errorlist">This field is required. 
>> [05/Apr/2011 16:36:32] "POST /item/create/ HTTP/1.1" 200 718 
>>
>> Is my understanding wrong, or is this a bug? 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Ui_ValHbXG0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



ContentType and multiple database

2012-08-01 Thread Àlex Pérez
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 value i think that could be reasonable...

I want to tho something like that:

 c = ContentType.objects.using("site").get(pk=self.ext_content_id)
 obj = c.get_object_for_this_type(pk=self.ext_object_id).values("nombre")

but obiously doesn't work.

Please guys help me!!

Thanks


-- 
Alex Perez
alex.pe...@bebabum.com

 *bebabum* be successful

c/ Còrsega 301-303, Àtic 2
08008 Barcelona
http://www.bebabum.com
http://www.facebook.com/bebabum
http://twitter.com/bebabum

This message is intended exclusively for its addressee and may contain
information that is confidential and protected by professional privilege.
If you are not the intended recipient you are hereby notified that any
dissemination, copy or disclosure of this communication is strictly
prohibited by law.

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si no es vd. el destinatario
indicado,
queda notificado que la utilización, divulgación y/o copia sin autorización
está prohibida en virtud de la legislación vigente.

Le informamos que los datos personales que facilite/ha facilitado pasarán a
formar parte de un fichero responsabilidad de bebabum, S.L. y que tiene
por finalidad gestionar las relaciones con usted.
Tiene derecho al acceso, rectificación cancelación y oposición en nuestra
oficina ubicada en c/ Còrsega 301-303, Àtic 2 de Barcelona o a la dirección
de e-mail l...@bebabum.com

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: union of two QuerySets

2012-08-01 Thread Àlex Pérez
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 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 + b
>>
>> Thanks a lot,
>> Ray
>>
>
> Try:
>
> a | b
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/ie69j4ewJNUJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Alex Perez
alex.pe...@bebabum.com

 *bebabum* be successful

c/ Còrsega 301-303, Àtic 2
08008 Barcelona
http://www.bebabum.com
http://www.facebook.com/bebabum
http://twitter.com/bebabum

This message is intended exclusively for its addressee and may contain
information that is confidential and protected by professional privilege.
If you are not the intended recipient you are hereby notified that any
dissemination, copy or disclosure of this communication is strictly
prohibited by law.

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si no es vd. el destinatario
indicado,
queda notificado que la utilización, divulgación y/o copia sin autorización
está prohibida en virtud de la legislación vigente.

Le informamos que los datos personales que facilite/ha facilitado pasarán a
formar parte de un fichero responsabilidad de bebabum, S.L. y que tiene
por finalidad gestionar las relaciones con usted.
Tiene derecho al acceso, rectificación cancelación y oposición en nuestra
oficina ubicada en c/ Còrsega 301-303, Àtic 2 de Barcelona o a la dirección
de e-mail l...@bebabum.com

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Checkbox checking

2012-08-01 Thread Carlos Palol
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)

class Meta:

model = MyModel 


cheers

On Wednesday, 1 August 2012 13:37:12 UTC+2, Jon Underwood wrote:
>
> 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.
>
> In the admin the checkboxes aren't required to be checked. When displaying 
> the form in a template I can set required="True" as follows:  type="checkbox" required="True" check_test="True" name="involved" 
> id="id_involved"/>
>
> This works in most browsers, though not Safari for some reason.
>
> Is there a better method? I've messed around with this for ages!
>
> Thank you in advance.
>
> Jon
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/K2iX2zo_vUMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Checkbox checking

2012-08-01 Thread Bill Freeman
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 browser; and in the form processing.  You *must* provide at
least the latter, since the first depends on JavaScript (since, as
you've discovered, the required attribute of a checkbox input doesn't
always work across browsers), which is disable-able and otherwise
circumventable.

The js approach is to disable the submit button on load (stays enabled
if js is disabled or the page is otherwise broken) and attach an on
change handler to the checkbox that enables or disables the submit
button based on whether the checkbox is now checked or not.

But the mandatory part is to add a validator to the field (see
https://docs.djangoproject.com/en/1.4/ref/forms/validation/ ) that
fails with a suitable error message if the checkbox field value is
False.

On Wed, Aug 1, 2012 at 7:37 AM, Jon Underwood  wrote:
> 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.
>
> In the admin the checkboxes aren't required to be checked. When displaying
> the form in a template I can set required="True" as follows:  type="checkbox" required="True" check_test="True" name="involved"
> id="id_involved"/>
>
> This works in most browsers, though not Safari for some reason.
>
> Is there a better method? I've messed around with this for ages!
>
> Thank you in advance.
>
> Jon
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/4bBr_gr_Z44J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to print a graph

2012-08-01 Thread Peregil
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 group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: union of two QuerySets

2012-08-01 Thread Tim Chase
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 using OR).  So I think you want

 from django.db.models import Q
 Person.objects.filter(
   Q(first_name__startswith="mic") |
   Q(first_name__startswith="joh")
   )

using the "|" (OR) operator to join the two Q objects.

-tkc


For reference, you can read at

https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.filter

https://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects


-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to print a graph

2012-08-01 Thread william ratcliff
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 day.
>
> --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to print a graph

2012-08-01 Thread Peregil
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 drawPlot(arrayGene1, arrayGene2):
message = ''
(m,b) = polyfit(arrayGene1,arrayGene2,1)
yp= polyval([m,b],arrayGene1)

xlable('Gene 1')
ylable('Gene 2')
title('Correlation Graph')
plot(arrayGene1, yp)
scatter(arrayGene1,arrayGene2,marker='>')
show()
return(message)



On Wed, Aug 1, 2012 at 12:21 PM, william ratcliff <
william.ratcl...@gmail.com> wrote:

> 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 day.
>>
>> --
>> 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 to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Issue Deploying Django

2012-08-01 Thread JJ Zolper
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.initd.org/psycopg/ 

Are there any additional packges that I might need?

I apologize for not being able to remember the additional ones I added 
before on Ubuntu but I'm at work and couldn't find in my installation 
history what they might have been or in my django google group discussions.

I feel like one was called "libpq-dev" actually.

Thanks for the help.

JJ

On Wednesday, August 1, 2012 2:07:54 AM UTC-4, lawgon wrote:
>
> On Tue, 2012-07-31 at 20:52 -0700, JJ Zolper wrote: 
> > Do I need to go through and install the python like adapters is that 
> > what it's complaining about? I don't think this has to do with my 
> > Django code on the server it's just a file missing right? 
>
> you need to install pycopg - and it is nothing to do with your code 
> -- 
> regards 
> Kenneth Gonsalves 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/luCfpw0prn8J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



QuerySet API - istartswith - use UPPER instead of ILIKE with PostgreSQL backend

2012-08-01 Thread Naoko
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 setting that I can 
change?
I would like to know this so that we can strategize indexing of DB.
Any advice would be appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/X63mnnoHTvwJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: returning a zip file for download

2012-08-01 Thread Tomas Neme
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'] = ('attachment; '

 'filename="{}"').format(os.path.basename(tmp[1]))
return response

and I'm wondering, what happens with that File object after the response is
sent? when does it get closed? isn't there some cleanup code missing?

-- 
"The whole of Japan is pure invention. There is no such country, there are
no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Working with a Custom, Dynamic Form (using BaseForm)

2012-08-01 Thread Nick_B
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 corresponding to the Field model
# for the A instance
fields_dict = SortedDict()
fields = field_list(instance)
# this really, really should be refactored
for field in fields:
if field.field_type == Field.BOOLEAN_FIELD:
fields_dict[field.name] = forms.BooleanField(label=field.label, 
required=False, help_text=field.help_text)
elif field.field_type == Field.CHAR_FIELD:
widget = forms.TextInput
fields_dict[field.name] = forms.CharField(label=field.label, 
required=field.required, max_length=field.max_length, 
help_text=field.help_text, widget=widget)

.(etc)

 fields_dict[field.name] = field_type(label=field.label,
 required=field.required,
 help_text=field.help_text,

 max_length=field.max_length,
 widget=widget)

return fields_dict


I am hoping to add an additional field, "Photographers" (from the 
'Photographer' model) to AForm so that users can select a Photographer to 
become part of an instance of the 'A' model.

Does that make sense?


Thank you very much for any ideas!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/JMg7nHwI44sJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Working with a Custom, Dynamic Form (using BaseForm)

2012-08-01 Thread Nick_B
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.ForeignKey('Series', null=True, blank=True)

class A(models.Model):
user = models.ForeignKey(User)
photographer = models.ForeignKey('Photographer', blank=True, 
null=True)
model = models.ForeignKey('Model', blank=True, null=True)



Thanks folks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/z5Gqc3jVzLsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to print a graph

2012-08-01 Thread william ratcliff
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
intranet, or external facing?  Do you have any restrictions on using
javascript?

William

On Wed, Aug 1, 2012 at 12:58 PM, Peregil  wrote:

> 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 drawPlot(arrayGene1, arrayGene2):
> message = ''
> (m,b) = polyfit(arrayGene1,arrayGene2,1)
> yp= polyval([m,b],arrayGene1)
>
> xlable('Gene 1')
> ylable('Gene 2')
> title('Correlation Graph')
> plot(arrayGene1, yp)
> scatter(arrayGene1,arrayGene2,marker='>')
> show()
> return(message)
>
>
>
> On Wed, Aug 1, 2012 at 12:21 PM, william ratcliff <
> william.ratcl...@gmail.com> wrote:
>
>> 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 day.
>>>
>>> --
>>> 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 to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>  --
>> 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 to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to print a graph

2012-08-01 Thread Peregil
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?   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
> intranet, or external facing?  Do you have any restrictions on using
> javascript?
>
> William
>
>
> On Wed, Aug 1, 2012 at 12:58 PM, Peregil  wrote:
>
>> 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 drawPlot(arrayGene1, arrayGene2):
>> message = ''
>> (m,b) = polyfit(arrayGene1,arrayGene2,1)
>> yp= polyval([m,b],arrayGene1)
>>
>> xlable('Gene 1')
>> ylable('Gene 2')
>> title('Correlation Graph')
>> plot(arrayGene1, yp)
>> scatter(arrayGene1,arrayGene2,marker='>')
>> show()
>> return(message)
>>
>>
>>
>> On Wed, Aug 1, 2012 at 12:21 PM, william ratcliff <
>> william.ratcl...@gmail.com> wrote:
>>
>>> 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 day.

 --
 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 to
 django-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/django-users?hl=en.

>>>
>>>  --
>>> 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 to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>  --
>> 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 to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: union of two QuerySets

2012-08-01 Thread akaariai
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 AND)
> rather than the union (which would be using OR).  So I think you want
>
>  from django.db.models import Q
>  Person.objects.filter(
>    Q(first_name__startswith="mic") |
>    Q(first_name__startswith="joh")
>    )
>
> using the "|" (OR) operator to join the two Q objects.
>
> -tkc
>
> For reference, you can read at
>
> https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db...
>
> https://docs.djangoproject.com/en/dev/topics/db/queries/#complex-look...

As stated earlier the correct way to combine two existing querysets is
to do: combined = qs1 | qs2.

There are some limitations to what kind of querysets will work, but
for plain querysets which have just filers applied things should just
work.

 - Anssi

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: MySQL total overheat (somewhat complex database)

2012-08-01 Thread Kurtis Mullins
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`, `data_schedule`.`task_id`,
> `data_schedule`.`start`, `data_schedule`.`times`, `data_schedule`.`done`,
> `data_process`.`id`, `data_process`.`string_id`,
> `data_process`.`operation_id`, `data_string`.`id`,
> `data_string`.`immutable`, `data_operation`.`id`,
> `data_operation`.`string_id`, T5.`id`, T5.`immutable`,
> `data_hardware`.`id`, `data_hardware`.`string_id`,
> `data_hardware`.`workspace_id`, `data_hardware`.`warmup`, T7.`id`,
> T7.`immutable`, `data_workspace`.`id`, `data_workspace`.`string_id`,
> T9.`id`, T9.`immutable`, `data_task`.`id`, `data_task`.`request_id`,
> `data_task`.`thread_id`, `data_task`.`amount`, `data_request`.`id`,
> `data_request`.`order_id`, `data_request`.`item_id`,
> `data_request`.`amount`, `data_order`.`id`, `data_order`.`string_id`,
> `data_order`.`subject_id`, `data_order`.`type`, `data_order`.`shipped`,
> `data_order`.`paid`, `data_order`.`end`, T13.`id`, T13.`immutable`,
> `data_subject`.`id`, `data_subject`.`string_id`, T15.`id`, T15.`immutable`,
> `data_item`.`id`, `data_item`.`string_id`, `data_item`.`measure_id`,
> `data_item`.`amount`, T17.`id`, T17.`immutable`, `data_measure`.`id`,
> `data_measure`.`string_id`, T19.`id`, T19.`immutable`, `data_thread`.`id`,
> `data_thread`.`string_id`, T21.`id`, T21.`immutable` FROM `data_schedule`
> INNER JOIN `data_process` ON (`data_schedule`.`process_id` =
> `data_process`.`id`) INNER JOIN `data_string` ON
> (`data_process`.`string_id` = `data_string`.`id`) INNER JOIN
> `data_operation` ON (`data_process`.`operation_id` = `data_operation`.`id`)
> INNER JOIN `data_string` T5 ON (`data_operation`.`string_id` = T5.`id`)
> INNER JOIN `data_hardware` ON (`data_schedule`.`hardware_id` =
> `data_hardware`.`id`) INNER JOIN `data_string` T7 ON
> (`data_hardware`.`string_id` = T7.`id`) INNER JOIN `data_workspace` ON
> (`data_hardware`.`workspace_id` = `data_workspace`.`id`) INNER JOIN
> `data_string` T9 ON (`data_workspace`.`string_id` = T9.`id`) INNER JOIN
> `data_task` ON (`data_schedule`.`task_id` = `data_task`.`id`) INNER JOIN
> `data_request` ON (`data_task`.`request_id` = `data_request`.`id`) INNER
> JOIN `data_order` ON (`data_request`.`order_id` = `data_order`.`id`) INNER
> JOIN `data_string` T13 ON (`data_order`.`string_id` = T13.`id`) INNER JOIN
> `data_subject` ON (`data_order`.`subject_id` = `data_subject`.`id`) INNER
> JOIN `data_string` T15 ON (`data_subject`.`string_id` = T15.`id`) INNER
> JOIN `data_item` ON (`data_request`.`item_id` = `data_item`.`id`) INNER
> JOIN `data_string` T17 ON (`data_item`.`string_id` = T17.`id`) INNER JOIN
> `data_measure` ON (`data_item`.`measure_id` = `data_measure`.`id`) INNER
> JOIN `data_string` T19 ON (`data_measure`.`string_id` = T19.`id`) INNER
> JOIN `data_thread` ON (`data_task`.`thread_id` = `data_thread`.`id`) INNER
> JOIN `data_string` T21 ON (`data_thread`.`string_id` = T21.`id`) ORDER BY
> `data_schedule`.`id` ASC
>
> MySQL, however, isn't able to process it and after few minutes it holds
> all processor performance.
>
> I would be glad for any idea.
>
>
Since you said this is caused by admin, did you modify the admin for this
class to pull in all of these details? If not, you could probably tell it
specifically which fields to show to reduce the number of joins it has to
execute.

With that being said -- it may be worth-while to look at the way your data
is structured and see if you can simplify it. However, I have no idea of
the domain of your project and what you've modeled.

I don't know how much experience you have with data modeling but if you'd
like to post your models (like Cal mentioned) then we may be able to offer
more suggestions on ways to enhance performance which would probably help
in a lot more places than this one instance. Again, I'm not trying to look
down at you so please don't take it that way :) There's many out there who
are much smarter and more experienced in the realm of data modeling than
myself!

Good luck!

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Detecting browser type after login

2012-08-01 Thread Larry Martell
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 have:
>
> (r'^accounts/login/$', login)
>
> In their views file they call login(request)
>
> What they want is, after the user has successfully logged in, I need
> to detect which browser they are using, and depending on which it is,
> potentially pop up a dialog box. I can't figure out where that code
> would live. I'm not asking how to detect the browser type, but rather,
> where that javascript code would go, and how I would cause it to get
> invoked after the login.

Someone suggested getting the browser type on the server side, and
then adding a variable to my response and check it in the template. I
like this solution, however I cannot figure out how to add the
variable to the response. After the successful login, the code calls
HttpResponseRedirect. How can I can I add a variable to that?

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to print a graph

2012-08-01 Thread william ratcliff
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
the printer dialog, I'll let you know...

William

On Wed, Aug 1, 2012 at 2:05 PM, Peregil  wrote:

> 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 <
> william.ratcl...@gmail.com> wrote:
>
>> 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
>> intranet, or external facing?  Do you have any restrictions on using
>> javascript?
>>
>> William
>>
>>
>> On Wed, Aug 1, 2012 at 12:58 PM, Peregil  wrote:
>>
>>> 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 drawPlot(arrayGene1, arrayGene2):
>>> message = ''
>>> (m,b) = polyfit(arrayGene1,arrayGene2,1)
>>> yp= polyval([m,b],arrayGene1)
>>>
>>> xlable('Gene 1')
>>> ylable('Gene 2')
>>> title('Correlation Graph')
>>> plot(arrayGene1, yp)
>>> scatter(arrayGene1,arrayGene2,marker='>')
>>> show()
>>> return(message)
>>>
>>>
>>>
>>> On Wed, Aug 1, 2012 at 12:21 PM, william ratcliff <
>>> william.ratcl...@gmail.com> wrote:
>>>
 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 day.
>
> --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

  --
 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 to
 django-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/django-users?hl=en.

>>>
>>>  --
>>> 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 to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>  --
>> 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 to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to print a graph

2012-08-01 Thread Peregil
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 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
> the printer dialog, I'll let you know...
>
> William
>
>
> On Wed, Aug 1, 2012 at 2:05 PM, Peregil  wrote:
>
>> 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 <
>> william.ratcl...@gmail.com> wrote:
>>
>>> 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 intranet, or external facing?  Do you have any
>>> restrictions on using javascript?
>>>
>>> William
>>>
>>>
>>> On Wed, Aug 1, 2012 at 12:58 PM, Peregil  wrote:
>>>
 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 drawPlot(arrayGene1, arrayGene2):
 message = ''
 (m,b) = polyfit(arrayGene1,arrayGene2,1)
 yp= polyval([m,b],arrayGene1)

 xlable('Gene 1')
 ylable('Gene 2')
 title('Correlation Graph')
 plot(arrayGene1, yp)
 scatter(arrayGene1,arrayGene2,marker='>')
 show()
 return(message)



 On Wed, Aug 1, 2012 at 12:21 PM, william ratcliff <
 william.ratcl...@gmail.com> wrote:

> 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 day.
>>
>> --
>> 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 to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

  --
 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 to
 django-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/django-users?hl=en.

>>>
>>>  --
>>> 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 to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>  --
>> 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 to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email t

Re: How to print a graph

2012-08-01 Thread Daniel Molina Wegener

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 charts packages:

  http://pypi.python.org/pypi/django-googlecharts/1.0-alpha-1

  http://pypi.python.org/pypi/django-google-charts/0.1.1





On Wed, Aug 1, 2012 at 3:16 PM, william ratcliff
mailto:william.ratcl...@gmail.com>> 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 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 the printer dialog, I'll
let you know...

William


On Wed, Aug 1, 2012 at 2:05 PM, Peregil mailto:pereg...@gmail.com>> wrote:

 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
mailto:william.ratcl...@gmail.com>>
wrote:

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
intranet, or external facing?  Do you have any restrictions
on using javascript?

William


On Wed, Aug 1, 2012 at 12:58 PM, Peregil mailto:pereg...@gmail.com>> wrote:

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 drawPlot(arrayGene1, arrayGene2):
 message = ''
 (m,b) = polyfit(arrayGene1,arrayGene2,1)
 yp= polyval([m,b],arrayGene1)
 xlable('Gene 1')
 ylable('Gene 2')
 title('Correlation Graph')
 plot(arrayGene1, yp)
 scatter(arrayGene1,arrayGene2,marker='>')
 show()
 return(message)



On Wed, Aug 1, 2012 at 12:21 PM, william ratcliff
mailto:william.ratcl...@gmail.com>> wrote:

Do you need to display a graph, or allow the user to
print one?

On Wed, Aug 1, 2012 at 12:06 PM, Peregil
mailto:pereg...@gmail.com>> 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 day.

--
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 to
django-users+unsubscr...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


--
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 to
django-users+unsubscr...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to
the Google Groups "Django users" group.
To 

Re: How to print a graph

2012-08-01 Thread Kurtis Mullins
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 user hit summit...
>
>
>
> On Wed, Aug 1, 2012 at 3:16 PM, william ratcliff <
> william.ratcl...@gmail.com> 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 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
>> the printer dialog, I'll let you know...
>>
>> William
>>
>>
>> On Wed, Aug 1, 2012 at 2:05 PM, Peregil  wrote:
>>
>>> 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 <
>>> william.ratcl...@gmail.com> wrote:
>>>
 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 intranet, or external facing?  Do you have any
 restrictions on using javascript?

 William


 On Wed, Aug 1, 2012 at 12:58 PM, Peregil  wrote:

> 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 drawPlot(arrayGene1, arrayGene2):
> message = ''
> (m,b) = polyfit(arrayGene1,arrayGene2,1)
> yp= polyval([m,b],arrayGene1)
>
> xlable('Gene 1')
> ylable('Gene 2')
> title('Correlation Graph')
> plot(arrayGene1, yp)
> scatter(arrayGene1,arrayGene2,marker='>')
> show()
> return(message)
>
>
>
> On Wed, Aug 1, 2012 at 12:21 PM, william ratcliff <
> william.ratcl...@gmail.com> wrote:
>
>> 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 day.
>>>
>>> --
>>> 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 to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>  --
>> 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 to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

  --
 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 to
 django-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/django-users?hl=en.

>>>
>>>  --
>>> 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 to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Djang

Re: Detecting browser type after login

2012-08-01 Thread Kurtis Mullins
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
Mobile browser). Just a suggestion.

On Wed, Aug 1, 2012 at 3:11 PM, Larry Martell wrote:

> 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 have:
> >
> > (r'^accounts/login/$', login)
> >
> > In their views file they call login(request)
> >
> > What they want is, after the user has successfully logged in, I need
> > to detect which browser they are using, and depending on which it is,
> > potentially pop up a dialog box. I can't figure out where that code
> > would live. I'm not asking how to detect the browser type, but rather,
> > where that javascript code would go, and how I would cause it to get
> > invoked after the login.
>
> Someone suggested getting the browser type on the server side, and
> then adding a variable to my response and check it in the template. I
> like this solution, however I cannot figure out how to add the
> variable to the response. After the successful login, the code calls
> HttpResponseRedirect. How can I can I add a variable to that?
>
> --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to print a graph

2012-08-01 Thread william ratcliff
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 soon as a user hit summit...
>
>
>
> On Wed, Aug 1, 2012 at 3:16 PM, william ratcliff <
> william.ratcl...@gmail.com> 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 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
>> the printer dialog, I'll let you know...
>>
>> William
>>
>>
>> On Wed, Aug 1, 2012 at 2:05 PM, Peregil  wrote:
>>
>>> 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 <
>>> william.ratcl...@gmail.com> wrote:
>>>
 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 intranet, or external facing?  Do you have any
 restrictions on using javascript?

 William


 On Wed, Aug 1, 2012 at 12:58 PM, Peregil  wrote:

> 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 drawPlot(arrayGene1, arrayGene2):
> message = ''
> (m,b) = polyfit(arrayGene1,arrayGene2,1)
> yp= polyval([m,b],arrayGene1)
>
> xlable('Gene 1')
> ylable('Gene 2')
> title('Correlation Graph')
> plot(arrayGene1, yp)
> scatter(arrayGene1,arrayGene2,marker='>')
> show()
> return(message)
>
>
>
> On Wed, Aug 1, 2012 at 12:21 PM, william ratcliff <
> william.ratcl...@gmail.com> wrote:
>
>> 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 day.
>>>
>>> --
>>> 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 to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>  --
>> 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 to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

  --
 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 to
 django-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/django-users?hl=en.

>>>
>>>  --
>>> 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 to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Group

Re: Detecting browser type after login

2012-08-01 Thread Kurtis Mullins
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 that context data. In short, put this logic in the view the user is
sent to after they've logged in.

On Wed, Aug 1, 2012 at 3: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 templates based upon the type of browser (for example, a
> Mobile browser). Just a suggestion.
>
>
> On Wed, Aug 1, 2012 at 3:11 PM, Larry Martell wrote:
>
>> 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 have:
>> >
>> > (r'^accounts/login/$', login)
>> >
>> > In their views file they call login(request)
>> >
>> > What they want is, after the user has successfully logged in, I need
>> > to detect which browser they are using, and depending on which it is,
>> > potentially pop up a dialog box. I can't figure out where that code
>> > would live. I'm not asking how to detect the browser type, but rather,
>> > where that javascript code would go, and how I would cause it to get
>> > invoked after the login.
>>
>> Someone suggested getting the browser type on the server side, and
>> then adding a variable to my response and check it in the template. I
>> like this solution, however I cannot figure out how to add the
>> variable to the response. After the successful login, the code calls
>> HttpResponseRedirect. How can I can I add a variable to that?
>>
>> --
>> 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 to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Detecting browser type after login

2012-08-01 Thread Larry Martell
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 templates based upon the type of browser (for example, a Mobile
> browser). Just a suggestion.

Yes, the dialog will be generated with javascript. My initial approach
was to do this all on the client side, but I was not able to figure
out how to fit that into the app (which was my original question).

Here's how it's structured:

Login screen is generated with django template
User clicks on submit
django login() is called, then a function from our views is called
that returns HttpResponseRedirect.

They want the dialog to pop up on top of the login screen before the
redirect. I don't know where the code that does this would live or how
it would get invoked.

As far as to why they want this, it doesn't really support IE, and
they want to alert the user to that if that's what they're using. It's
a custom app, not for public use.


>
> On Wed, Aug 1, 2012 at 3:11 PM, Larry Martell 
> wrote:
>>
>> 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 have:
>> >
>> > (r'^accounts/login/$', login)
>> >
>> > In their views file they call login(request)
>> >
>> > What they want is, after the user has successfully logged in, I need
>> > to detect which browser they are using, and depending on which it is,
>> > potentially pop up a dialog box. I can't figure out where that code
>> > would live. I'm not asking how to detect the browser type, but rather,
>> > where that javascript code would go, and how I would cause it to get
>> > invoked after the login.
>>
>> Someone suggested getting the browser type on the server side, and
>> then adding a variable to my response and check it in the template. I
>> like this solution, however I cannot figure out how to add the
>> variable to the response. After the successful login, the code calls
>> HttpResponseRedirect. How can I can I add a variable to that?
>>
>> --
>> 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 to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Detecting browser type after login

2012-08-01 Thread Larry Martell
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 the template. And then do some magic in the template based
> upon that context data. In short, put this logic in the view the user is
> sent to after they've logged in.

What view they are redirected to is not consistent. It depends on what
the user is permissioned for and what features the customer has paid
for. But I may be able to do this in some common part of the code.
Thanks.


> On Wed, Aug 1, 2012 at 3: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 templates based upon the type of browser (for example, a Mobile
>> browser). Just a suggestion.
>>
>>
>> On Wed, Aug 1, 2012 at 3:11 PM, Larry Martell 
>> wrote:
>>>
>>> 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 have:
>>> >
>>> > (r'^accounts/login/$', login)
>>> >
>>> > In their views file they call login(request)
>>> >
>>> > What they want is, after the user has successfully logged in, I need
>>> > to detect which browser they are using, and depending on which it is,
>>> > potentially pop up a dialog box. I can't figure out where that code
>>> > would live. I'm not asking how to detect the browser type, but rather,
>>> > where that javascript code would go, and how I would cause it to get
>>> > invoked after the login.
>>>
>>> Someone suggested getting the browser type on the server side, and
>>> then adding a variable to my response and check it in the template. I
>>> like this solution, however I cannot figure out how to add the
>>> variable to the response. After the successful login, the code calls
>>> HttpResponseRedirect. How can I can I add a variable to that?
>>>
>>> --
>>> 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 to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>
> --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Detecting browser type after login

2012-08-01 Thread Larry Martell
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, modify the "context data" of that view to dump
>> whatever data to the template. And then do some magic in the template based
>> upon that context data. In short, put this logic in the view the user is
>> sent to after they've logged in.
>
> What view they are redirected to is not consistent. It depends on what
> the user is permissioned for and what features the customer has paid
> for. But I may be able to do this in some common part of the code.
> Thanks.

Another issue with this is that I only want to display the pop up
once, immediately after they login. I don't think I can tell if that's
the case in the view, only in the code that is called after login().

>
>
>> On Wed, Aug 1, 2012 at 3: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 templates based upon the type of browser (for example, a Mobile
>>> browser). Just a suggestion.
>>>
>>>
>>> On Wed, Aug 1, 2012 at 3:11 PM, Larry Martell 
>>> wrote:

 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 have:
 >
 > (r'^accounts/login/$', login)
 >
 > In their views file they call login(request)
 >
 > What they want is, after the user has successfully logged in, I need
 > to detect which browser they are using, and depending on which it is,
 > potentially pop up a dialog box. I can't figure out where that code
 > would live. I'm not asking how to detect the browser type, but rather,
 > where that javascript code would go, and how I would cause it to get
 > invoked after the login.

 Someone suggested getting the browser type on the server side, and
 then adding a variable to my response and check it in the template. I
 like this solution, however I cannot figure out how to add the
 variable to the response. After the successful login, the code calls
 HttpResponseRedirect. How can I can I add a variable to that?

 --
 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 to
 django-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/django-users?hl=en.

>>>
>>
>> --
>> 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 to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to print a graph

2012-08-01 Thread Peregil
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
FigureCanvasAgg as FigureCanvasfrom matplotlib.figure import
Figurefrom matplotlib.dates import DateFormatterfig=Figure()
 ax=fig.add_subplot(111)x=[]y=[]
now=datetime.datetime.now()delta=datetime.timedelta(days=1)for
i in range(10):x.append(now)now+=delta
y.append(random.randint(0, 1000))ax.plot_date(x, y, '-')
ax.xaxis.set_major_formatter(DateFormatter('%Y-%m-%d'))
fig.autofmt_xdate()canvas=FigureCanvas(fig)
response=django.http.HttpResponse(content_type='image/png')
canvas.print_png(response)return response


On Wed, Aug 1, 2012 at 3:31 PM, Daniel Molina Wegener  wrote:

> 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 charts packages:
>
>   
> http://pypi.python.org/pypi/**django-googlecharts/1.0-alpha-**1
>
>   
> http://pypi.python.org/pypi/**django-google-charts/0.1.1
>
>
>>
>>
>> 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 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 the printer dialog, I'll
>> let you know...
>>
>> William
>>
>>
>> On Wed, Aug 1, 2012 at 2:05 PM, Peregil > > wrote:
>>
>>  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?
>> 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
>> intranet, or external facing?  Do you have any restrictions
>> on using javascript?
>>
>> William
>>
>>
>> On Wed, Aug 1, 2012 at 12:58 PM, Peregil > > wrote:
>>
>> 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 drawPlot(arrayGene1, arrayGene2):
>>  message = ''
>>  (m,b) = polyfit(arrayGene1,arrayGene2,**1)
>>  yp= polyval([m,b],arrayGene1)
>>  xlable('Gene 1')
>>  ylable('Gene 2')
>>  title('Correlation Graph')
>>  plot(arrayGene1, yp)
>>  scatter(arrayGene1,arrayGene2,**marker='>')
>>  show()
>>  return(message)
>>
>>
>>
>> On Wed, Aug 1, 2012 at 12:21 PM, william ratcliff
>> > 
>> >
>> wrote:
>>
>> Do you need to display a graph, or allow the user to
>> print one?
>>
>> On Wed, Aug 1, 2012 at 12:06 PM, Peregil
>> mailto:pereg...@gmail.com>>
>> 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 day.
>>
>> --
>> You received this message because you are
>> subscribed to the Google Groups "Django users"

[ANN] Django 1.3 bugfix release

2012-08-01 Thread James Bennett
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 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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to print a graph

2012-08-01 Thread william ratcliff
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 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 
> FigureCanvasAgg as FigureCanvasfrom matplotlib.figure import Figure
> from matplotlib.dates import DateFormatterfig=Figure()
> ax=fig.add_subplot(111)x=[]y=[]now=datetime.datetime.now()
> delta=datetime.timedelta(days=1)for i in range(10):x.append(now)  
>   now+=deltay.append(random.randint(0, 1000))ax.plot_date(x, 
> y, '-')ax.xaxis.set_major_formatter(DateFormatter('%Y-%m-%d'))
> fig.autofmt_xdate()canvas=FigureCanvas(fig)
> response=django.http.HttpResponse(content_type='image/png')
> canvas.print_png(response)return response
>
>
> On Wed, Aug 1, 2012 at 3:31 PM, Daniel Molina Wegener wrote:
>
>> 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 charts packages:
>>
>>   
>> http://pypi.python.org/pypi/**django-googlecharts/1.0-alpha-**1
>>
>>   
>> http://pypi.python.org/pypi/**django-google-charts/0.1.1
>>
>>
>>>
>>>
>>> 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 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 the printer dialog, I'll
>>> let you know...
>>>
>>> William
>>>
>>>
>>> On Wed, Aug 1, 2012 at 2:05 PM, Peregil >> > wrote:
>>>
>>>  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?
>>> 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
>>> intranet, or external facing?  Do you have any restrictions
>>> on using javascript?
>>>
>>> William
>>>
>>>
>>> On Wed, Aug 1, 2012 at 12:58 PM, Peregil >> > wrote:
>>>
>>> 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 drawPlot(arrayGene1, arrayGene2):
>>>  message = ''
>>>  (m,b) = polyfit(arrayGene1,arrayGene2,**1)
>>>  yp= polyval([m,b],arrayGene1)
>>>  xlable('Gene 1')
>>>  ylable('Gene 2')
>>>  title('Correlation Graph')
>>>  plot(arrayGene1, yp)
>>>  scatter(arrayGene1,arrayGene2,**marker='>')
>>>  show()
>>>  return(message)
>>>
>>>
>>>
>>> On Wed, Aug 1, 2012 at 12:21 PM, william ratcliff
>>> >> 
>>> >
>>> wrote:
>>>
>>> Do you need to display a graph, or allow the user to
>>> print one?
>>>
>>> On Wed, Aug 1, 2012 at 12:06 PM, Peregil
>>> mailto:pereg...@gmail.com>>
>>> wrote:
>>>
>>> The information comes from a dat

Re: How to print a graph

2012-08-01 Thread william ratcliff
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 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 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 
>> FigureCanvasAgg as FigureCanvasfrom matplotlib.figure import Figure
>> from matplotlib.dates import DateFormatterfig=Figure()
>> ax=fig.add_subplot(111)x=[]y=[]now=datetime.datetime.now()
>> delta=datetime.timedelta(days=1)for i in range(10):x.append(now) 
>>now+=deltay.append(random.randint(0, 1000))
>> ax.plot_date(x, y, '-')
>> ax.xaxis.set_major_formatter(DateFormatter('%Y-%m-%d'))
>> fig.autofmt_xdate()canvas=FigureCanvas(fig)
>> response=django.http.HttpResponse(content_type='image/png')
>> canvas.print_png(response)return response
>>
>>
>> On Wed, Aug 1, 2012 at 3:31 PM, Daniel Molina Wegener wrote:
>>
>>> 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 charts packages:
>>>
>>>   
>>> http://pypi.python.org/pypi/**django-googlecharts/1.0-alpha-**1
>>>
>>>   
>>> http://pypi.python.org/pypi/**django-google-charts/0.1.1
>>>
>>>


 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 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 the printer dialog, I'll
 let you know...

 William


 On Wed, Aug 1, 2012 at 2:05 PM, Peregil >>> > wrote:

  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
 mailto:william.ratcliff@**
 gmail.com >>

 wrote:

 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
 intranet, or external facing?  Do you have any restrictions
 on using javascript?

 William


 On Wed, Aug 1, 2012 at 12:58 PM, Peregil <
 pereg...@gmail.com
 > wrote:

 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 drawPlot(arrayGene1, arrayGene2):
  message = ''
  (m,b) = polyfit(arrayGene1,arrayGene2,**1)
  yp= polyval([m,b],arrayGene1)
  xlable('Gene 1')
  ylable('Gene 2')
  title('Correlation Graph')
  plot(arrayGene1, yp)
  scatter(arrayGene1,arrayGene2,**marker='>')
  show()
  return(message)



 On Wed, Aug 1, 2012 at 12:21 PM, william ratcliff
 >>> 
 

Re: Detecting browser type after login

2012-08-01 Thread Larry Martell
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 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 that context data. In short, put this logic in the view the user is
>>> sent to after they've logged in.
>>
>> What view they are redirected to is not consistent. It depends on what
>> the user is permissioned for and what features the customer has paid
>> for. But I may be able to do this in some common part of the code.
>> Thanks.
>
> Another issue with this is that I only want to display the pop up
> once, immediately after they login. I don't think I can tell if that's
> the case in the view, only in the code that is called after login().

So what I ended up doing was to add a session-cookie with the
popup-information. I can then access in the base template, but the
issue I am having now is that they want the popup to be on top of the
login screen, and it's displaying on a blank screen, after the login
screen is cleared. ARHG!

>
>>
>>
>>> On Wed, Aug 1, 2012 at 3: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 templates based upon the type of browser (for example, a 
 Mobile
 browser). Just a suggestion.


 On Wed, Aug 1, 2012 at 3:11 PM, Larry Martell 
 wrote:
>
> 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 have:
> >
> > (r'^accounts/login/$', login)
> >
> > In their views file they call login(request)
> >
> > What they want is, after the user has successfully logged in, I need
> > to detect which browser they are using, and depending on which it is,
> > potentially pop up a dialog box. I can't figure out where that code
> > would live. I'm not asking how to detect the browser type, but rather,
> > where that javascript code would go, and how I would cause it to get
> > invoked after the login.
>
> Someone suggested getting the browser type on the server side, and
> then adding a variable to my response and check it in the template. I
> like this solution, however I cannot figure out how to add the
> variable to the response. After the successful login, the code calls
> HttpResponseRedirect. How can I can I add a variable to that?
>
> --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

>>>
>>> --
>>> 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 to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: combobox prepopulated to only related objects to "self"

2012-08-01 Thread Ignacio Soto
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, 2012 at 1:17 AM, Ignacio Soto  wrote:
>
>> Hi everyone
>>
>> i have this model
>>
>> GROUP and Product
>>
>>
>> product has a group field thath is foreignkey to GROUP.
>>
>>
>> and Group has foreignKey to Product to select primary product.
>>
>> so i want to have a group with many products and one is the "primary
>> product".
>>
>>
>> so...i could do this by select inline products with "trough" and search
>> an intermediary Model (boolean field).
>>
>> but it let me select  more than one promary,
>>
>>
>> the solution is the model this way:.
>>
>> product has a group field thath is foreignkey to GROUP.
>>
>>
>> and Group has foreignKey to Product to select primary product.
>>
>> so i want to have a group with many products and one is the "primary
>> product".
>>
>> but the primaryproduct field in group will be prepopulated with only the
>> related products to this group.
>>
>>
>> how i prepopulate the select(combobox) with the reverse query ?
>>
>>
>>
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/d3UpfhONEWwJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Regards,
> Anton Baklanov
>
>  --
> 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 to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
__

Ignacio Soto Reveco
Staff IngeHost

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error in Brand New Django 1.4.1 released Yesterday

2012-08-01 Thread Russell Keith-Magee
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://www.djangoproject.com/download/
>
> On that same page (option number 2) are a couple of links for the
> "Latest Development Version". The zip file is named:
>
> django-django-1.4-616-g8d3e501.zip
>
> but indeed the version in the zip file is:
>
> VERSION = (1, 5, 0, 'alpha', 0)

That's because you've downloaded "Option 2: Latest development
version". 1.4 is our stable release. 1.5 is the version we are
currently developing

This means that the VERSION string is correct -- the latest
development version is a 1.5 pre-alpha. However, the file name is
misleading. The file name is auto generated by Github; I'll see what
can be done about correcting it.

Yours,
Russ Magee %-)

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



TinyMCE config

2012-08-01 Thread jondbaker
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 been installed via 
pip, and here are the relevant snippets of code:

*settings.py*
INSTALLED_APPS = (
...
'tinymce',
)
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
TINYMCE_JS_URL = os.path.join(PROJECT_ROOT, 
'templates/static/js/tiny_mce/tiny_mce.js')
TINYMCE_JS_ROOT = os.path.join(PROJECT_ROOT, 'templates/static/js/tiny_mce')
* I have a hunch that here is where I'm going wrong. The instructions 
indicate that the tiny_mce js dir should reside in MEDIA, but I was under 
the impression that MEDIA is to be used for user-uploaded content, while 
STATIC is for assets like JS and CSS. That's why I put the tiny_mce lib in 
STATIC instead of MEDIA.
*
urls.py*
urlpatterns = patterns(''
...
url(r'^tinymce/', include('tinymce.urls')),
)
* If i visit 'http://127.0.0.1:8000/tinymce/flatpages_link_list/' in the 
browser, 'var tinyMCELinkList = []' is rendered.

Any help would be greatly appreciated. Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/LzurKyPvBdAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Detecting browser type after login

2012-08-01 Thread Larry Martell
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 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 that context data. In short, put this logic in the view the user is
 sent to after they've logged in.
>>>
>>> What view they are redirected to is not consistent. It depends on what
>>> the user is permissioned for and what features the customer has paid
>>> for. But I may be able to do this in some common part of the code.
>>> Thanks.
>>
>> Another issue with this is that I only want to display the pop up
>> once, immediately after they login. I don't think I can tell if that's
>> the case in the view, only in the code that is called after login().
>
> So what I ended up doing was to add a session-cookie with the
> popup-information. I can then access in the base template, but the
> issue I am having now is that they want the popup to be on top of the
> login screen, and it's displaying on a blank screen, after the login
> screen is cleared. ARHG!

So it would appear there is no way to send data from django to the
browser that updates the page without first clearing it. Is that true?


 On Wed, Aug 1, 2012 at 3: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 templates based upon the type of browser (for example, a 
> Mobile
> browser). Just a suggestion.
>
>
> On Wed, Aug 1, 2012 at 3:11 PM, Larry Martell 
> wrote:
>>
>> 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 have:
>> >
>> > (r'^accounts/login/$', login)
>> >
>> > In their views file they call login(request)
>> >
>> > What they want is, after the user has successfully logged in, I need
>> > to detect which browser they are using, and depending on which it is,
>> > potentially pop up a dialog box. I can't figure out where that code
>> > would live. I'm not asking how to detect the browser type, but rather,
>> > where that javascript code would go, and how I would cause it to get
>> > invoked after the login.
>>
>> Someone suggested getting the browser type on the server side, and
>> then adding a variable to my response and check it in the template. I
>> like this solution, however I cannot figure out how to add the
>> variable to the response. After the successful login, the code calls
>> HttpResponseRedirect. How can I can I add a variable to that?
>>
>> --
>> 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 to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>

 --
 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 to
 django-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/django-users?hl=en.

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: TinyMCE config

2012-08-01 Thread Mike Dewhirst

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 TinyMCE to display. django-tinymce has been installed
via pip, and here are the relevant snippets of code:

*settings.py*
INSTALLED_APPS = (
 ...
 'tinymce',
)


I have tinyMCE working and no mention of it in settings.py. It isn't a 
Django app.


It needs to be served by your web server eg Apache. The important thing 
is to hang it somewhere off your STATIC_ROOT so your templates can use 
{{STATIC_URL}}/js/tinymce/ and if Apache has been set up with ...


  Alias /static/ /var/www//static/
or
  Alias /tiny_mce/ /var/www//static/js/tiny_mce/

... it should find it. If not, view the page source to see where Apache 
is actually looking.


It is different when you are using the Django development server. In my 
urls.py I detect when that is the case with ...


tinymcedir = os.path.join(settings.STATIC_ROOT, 'js/tiny_mce/')

if settings.DEBUG:
urlpatterns += patterns('',
(r'^media\/(?P.*)$',
'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
)
urlpatterns += patterns('',
(r'^static\/(?P.*)$',
'django.views.static.serve',
{'document_root': settings.STATIC_ROOT}),
)

from django.contrib.staticfiles.urls import staticfiles_urlpatterns

urlpatterns += staticfiles_urlpatterns()
urlpatterns += patterns('',
(r'^tiny_mce/(?P.*)$',
'django.views.static.serve',
{'document_root': tinymcedir}),
)

I'm not sure if this is the "right way" to do it but it works for me.

Mike



PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
TINYMCE_JS_URL = os.path.join(PROJECT_ROOT,
'templates/static/js/tiny_mce/tiny_mce.js')
TINYMCE_JS_ROOT = os.path.join(PROJECT_ROOT, 'templates/static/js/tiny_mce')
* I have a hunch that here is where I'm going wrong. The instructions
indicate that the tiny_mce js dir should reside in MEDIA, but I was
under the impression that MEDIA is to be used for user-uploaded content,
while STATIC is for assets like JS and CSS. That's why I put the
tiny_mce lib in STATIC instead of MEDIA.
*
urls.py*
urlpatterns = patterns(''
 ...
 url(r'^tinymce/', include('tinymce.urls')),
)
* If i visit 'http://127.0.0.1:8000/tinymce/flatpages_link_list/' in the
browser, 'var tinyMCELinkList = []' is rendered.

Any help would be greatly appreciated. Thanks.

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/LzurKyPvBdAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


--
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: TinyMCE config

2012-08-01 Thread Jonathan Baker
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 installed, the URLs are
configred correctly, and I can navigate to
http://127.0.0.1:8000/media/js/tiny_mce/tiny_mce.js and view the JS source.
Yet, the WYSIWYG still doesn't display. I'm a bit stumped at this point.

On Wed, Aug 1, 2012 at 7:59 PM, Mike Dewhirst  wrote:

> 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 TinyMCE to display. django-tinymce has been installed
>> via pip, and here are the relevant snippets of code:
>>
>> *settings.py*
>>
>> INSTALLED_APPS = (
>>  ...
>>  'tinymce',
>> )
>>
>
> I have tinyMCE working and no mention of it in settings.py. It isn't a
> Django app.
>
> It needs to be served by your web server eg Apache. The important thing is
> to hang it somewhere off your STATIC_ROOT so your templates can use
> {{STATIC_URL}}/js/tinymce/ and if Apache has been set up with ...
>
>   Alias /static/ /var/www//static/
> or
>   Alias /tiny_mce/ /var/www//static/js/**tiny_mce/
>
> ... it should find it. If not, view the page source to see where Apache is
> actually looking.
>
> It is different when you are using the Django development server. In my
> urls.py I detect when that is the case with ...
>
> tinymcedir = os.path.join(settings.STATIC_**ROOT, 'js/tiny_mce/')
>
> if settings.DEBUG:
> urlpatterns += patterns('',
> (r'^media\/(?P.*)$',
> 'django.views.static.serve',
> {'document_root': settings.MEDIA_ROOT}),
> )
> urlpatterns += patterns('',
> (r'^static\/(?P.*)$',
> 'django.views.static.serve',
> {'document_root': settings.STATIC_ROOT}),
> )
>
> from django.contrib.staticfiles.**urls import staticfiles_urlpatterns
>
> urlpatterns += staticfiles_urlpatterns()
> urlpatterns += patterns('',
> (r'^tiny_mce/(?P.*)$',
> 'django.views.static.serve',
> {'document_root': tinymcedir}),
> )
>
> I'm not sure if this is the "right way" to do it but it works for me.
>
> Mike
>
>
>  PROJECT_ROOT = os.path.abspath(os.path.**dirname(__file__))
>> TINYMCE_JS_URL = os.path.join(PROJECT_ROOT,
>> 'templates/static/js/tiny_mce/**tiny_mce.js')
>> TINYMCE_JS_ROOT = os.path.join(PROJECT_ROOT,
>> 'templates/static/js/tiny_mce'**)
>> * I have a hunch that here is where I'm going wrong. The instructions
>> indicate that the tiny_mce js dir should reside in MEDIA, but I was
>> under the impression that MEDIA is to be used for user-uploaded content,
>> while STATIC is for assets like JS and CSS. That's why I put the
>> tiny_mce lib in STATIC instead of MEDIA.
>> *
>> urls.py*
>>
>> urlpatterns = patterns(''
>>  ...
>>  url(r'^tinymce/', include('tinymce.urls')),
>> )
>> * If i visit 
>> 'http://127.0.0.1:8000/**tinymce/flatpages_link_list/'
>> in the
>> browser, 'var tinyMCELinkList = []' is rendered.
>>
>> Any help would be greatly appreciated. Thanks.
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/**msg/django-users/-/**LzurKyPvBdAJ
>> .
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscribe@**googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/**group/django-users?hl=en
>> .
>>
>
> --
> 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 to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>


-- 
Jonathan D. Baker
Developer
http://jonathandbaker.com

-- 
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 to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/

Re: How to print a graph

2012-08-01 Thread Peregil
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 Wed, Aug 1, 2012 at 5:41 PM, william ratcliff <
> william.ratcl...@gmail.com> 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 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 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 
>>> FigureCanvasAgg as FigureCanvasfrom matplotlib.figure import Figure
>>> from matplotlib.dates import DateFormatterfig=Figure()
>>> ax=fig.add_subplot(111)x=[]y=[]now=datetime.datetime.now()
>>> delta=datetime.timedelta(days=1)for i in range(10):
>>> x.append(now)now+=deltay.append(random.randint(0, 1000))
>>> ax.plot_date(x, y, '-')
>>> ax.xaxis.set_major_formatter(DateFormatter('%Y-%m-%d'))
>>> fig.autofmt_xdate()canvas=FigureCanvas(fig)
>>> response=django.http.HttpResponse(content_type='image/png')
>>> canvas.print_png(response)return response
>>>
>>>
>>> On Wed, Aug 1, 2012 at 3:31 PM, Daniel Molina Wegener wrote:
>>>
 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 charts packages:

   
 http://pypi.python.org/pypi/**django-googlecharts/1.0-alpha-**1

   
 http://pypi.python.org/pypi/**django-google-charts/0.1.1


>
>
> 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 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 the printer dialog, I'll
> let you know...
>
> William
>
>
> On Wed, Aug 1, 2012 at 2:05 PM, Peregil  > wrote:
>
>  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
> mailto:william.ratcliff@**
> gmail.com >>
>
> wrote:
>
> 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
> intranet, or external facing?  Do you have any restrictions
> on using javascript?
>
> William
>
>
> On Wed, Aug 1, 2012 at 12:58 PM, Peregil <
> pereg...@gmail.com
> > wrote:
>
> 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 drawPlot(arrayGene1, arrayGene2):
>  message = ''
>  (m,b) = polyfit(arrayGene1,arrayGene2,**1)
>  yp= polyval([m,b],arrayGene1)
>  xlable('Gene 1')
>  ylable('Gene 2')
>  title('Correlati

Re: TinyMCE config

2012-08-01 Thread Mike Dewhirst

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 - I didn't know it existed. I have actually disabled TinyMCE in my 
project for the time being until I can figure out how to selectively 
apply it to some textarea widgets (in contrib.admin) and not others. 
That's pretty low on my list at the moment. If the app lets that happen 
easily I'll give it a try.


Good luck

Mike



I've made a few adjustments to no avail. The app is installed, the URLs
are configred correctly, and I can navigate to
http://127.0.0.1:8000/media/js/tiny_mce/tiny_mce.js and view the JS
source. Yet, the WYSIWYG still doesn't display. I'm a bit stumped at
this point.

On Wed, Aug 1, 2012 at 7:59 PM, Mike Dewhirst mailto:mi...@dewhirst.com.au>> wrote:

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 TinyMCE to display. django-tinymce has been
installed
via pip, and here are the relevant snippets of code:

*settings.py*

INSTALLED_APPS = (
  ...
  'tinymce',
)


I have tinyMCE working and no mention of it in settings.py. It isn't
a Django app.

It needs to be served by your web server eg Apache. The important
thing is to hang it somewhere off your STATIC_ROOT so your templates
can use {{STATIC_URL}}/js/tinymce/ and if Apache has been set up
with ...

   Alias /static/ /var/www//static/
or
   Alias /tiny_mce/ /var/www//static/js/__tiny_mce/

... it should find it. If not, view the page source to see where
Apache is actually looking.

It is different when you are using the Django development server. In
my urls.py I detect when that is the case with ...

tinymcedir = os.path.join(settings.STATIC___ROOT, 'js/tiny_mce/')

if settings.DEBUG:
 urlpatterns += patterns('',
 (r'^media\/(?P.*)$',
 'django.views.static.serve',
 {'document_root': settings.MEDIA_ROOT}),
 )
 urlpatterns += patterns('',
 (r'^static\/(?P.*)$',
 'django.views.static.serve',
 {'document_root': settings.STATIC_ROOT}),
 )

 from django.contrib.staticfiles.__urls import
staticfiles_urlpatterns

 urlpatterns += staticfiles_urlpatterns()
 urlpatterns += patterns('',
 (r'^tiny_mce/(?P.*)$',
 'django.views.static.serve',
 {'document_root': tinymcedir}),
 )

I'm not sure if this is the "right way" to do it but it works for me.

Mike


PROJECT_ROOT = os.path.abspath(os.path.__dirname(__file__))
TINYMCE_JS_URL = os.path.join(PROJECT_ROOT,
'templates/static/js/tiny_mce/__tiny_mce.js')
TINYMCE_JS_ROOT = os.path.join(PROJECT_ROOT,
'templates/static/js/tiny_mce'__)
* I have a hunch that here is where I'm going wrong. The
instructions
indicate that the tiny_mce js dir should reside in MEDIA, but I was
under the impression that MEDIA is to be used for user-uploaded
content,
while STATIC is for assets like JS and CSS. That's why I put the
tiny_mce lib in STATIC instead of MEDIA.
*
urls.py*

urlpatterns = patterns(''
  ...
  url(r'^tinymce/', include('tinymce.urls')),
)
* If i visit
'http://127.0.0.1:8000/__tinymce/flatpages_link_list/
' in the
browser, 'var tinyMCELinkList = []' is rendered.

Any help would be greatly appreciated. Thanks.

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/__msg/django-users/-/__LzurKyPvBdAJ
.
To post to this group, send email to
django-users@googlegroups.com
.
To unsubscribe from this group, send email to
django-users+unsubscribe@__googlegroups.com
.
For more options, visit this group at
http://groups.google.com/__group/django-users?hl=en