Re: Using Django without templates?

2014-02-27 Thread Mario Gudelj
You do have to be careful with templates if you're using too many
inclusions or if you have too much logic in them. There's a good django
debug toolbar add-on that informs you about the time a template takes to
compile.
On 27/02/2014 9:47 am, "ApathyBear"  wrote:

> I was briefly talking with a developer from Google whom I had met.
>
> He mentioned something that I hadn't really gotten a chance to ask him
> more about
>
> He told me to be careful with django templates because in terms of scale,
> they can cause problems and almost always need to be re-written. Rather he
> mentioned something like using a 'full stack'.
>
> I think back, and I don't exactly follow what he means by that. Is their a
> way to use Django without templates? Is it better ? Why or why not?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2aa3d77a-da31-460e-b472-204e2548b69a%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbjn1AXCykZT9ggtvj4Z7%2BcEsR_CqpA2TC9wXKDURaR3wUw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Javascript and sessions

2014-02-27 Thread Camilo Torres
On Wednesday, February 26, 2014 10:41:38 PM UTC-4:30, Luke Baker wrote:
>
> My web application is heavily based around form input. I'd like to update 
> the user's session with each form input that they update or change while 
> working with a form. I'm thinking of implementing some simple javascript 
> that listens for 'change' events on each form input. When the 'change' 
> event fires, I'd like to make an ajax request to update the users session 
> with that form input name and value. To do this, I would have to write a 
> view that would allow the user to POST any thing they wanted (essentially) 
> to their session - is this safe? It makes me think twice.
>

Yes you must write that view. Sanitize the inputs.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/187995d9-0a47-4e00-9b93-f17490d7ba96%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Using Django without templates?

2014-02-27 Thread Camilo Torres
On Wednesday, February 26, 2014 6:16:39 PM UTC-4:30, ApathyBear wrote:
>
> He mentioned something that I hadn't really gotten a chance to ask him 
> more about
> He told me to be careful with django templates because in terms of scale, 
> they can cause problems and almost always need to be re-written. Rather he 
> mentioned something like using a 'full stack'.
> I think back, and I don't exactly follow what he means by that. Is their a 
> way to use Django without templates? Is it better ? Why or why not?
>
Hello,

A web application is based on the HTTP protocol, that is text based. The 
purpose of the protocol is that a web browser request a document, and the 
server responds with a document text (may be other kind of content types, 
like images). Django manages this protocol through the use of views and url 
configurations: each url is managed by a view. The view responsibility is 
to deliver a (text) document, and do so via a 
django.http.response.HttpResponse object. So you only need to return, in 
your views, HttpResponse objects.

You can simply return in every view something like this:
return HttpResponse('hello world')

and it will work, without using templates. This is faster than loading a 
template with the text 'hello world', render and pass it to the view.

You can do that to return complex HTML (or other types of) documents of 
your site. Or you can use a template system and manage the HTML more easily 
with a bit more processing overhead. You can use other template systems 
besides the provided by Django, like Jinja (that has shown to be faster in 
some benchmarks compared to Django's).

Regards,
Camilo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4f03f506-202a-4fce-92d4-e3dceb832ffa%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django with rabbit (but without async celery) - can be done?

2014-02-27 Thread Camilo Torres

On Tuesday, February 25, 2014 10:58:47 AM UTC-4:30, Alon Nisser wrote:
>
> I need to implement a quite simple Django server that server some http 
> requests *and *listens to a rabbitmq message queue that streams 
> information into the Django app (that should be written to the db). the 
> data *must* be written to the db in a synchronized order , So I can't use 
> the obvious celery/rabbit configuration.  I was told that there is no way 
> to do this in the same Django project. since Django would listen to http 
> requests on It's process. and It can't handle another process to listen for 
> Rabbit - forcing me to to add Another python/django project for the 
> rabbit/db writes part - working with the same models The http bound django 
> project works with.. You can smell the trouble with this config from here. 
> .. Any Ideas how to solve this?
>
Hello,

What you has been told seems to be the right way of solving this. You 
should have another python (not Django) application listening to the queue 
to process incoming messages. You can use Django models to insert the data 
into the database. That queue does not really streams data to _the 
application_ but to _the database_ via a third running application. I don't 
have any smell here, only curious of what 'written to the db in a 
_synchronized order_' means ;)

If you are going to receive a stream of data, split in messages in a queue, 
then I assume you may need to store the data in the DB in an ordered 
fashion, in a way that can then easily be retrieved in the right order or 
sequence to play or use the data. That is a different problem with many 
solutions with the tools you have, and has nothing to do with Django, but 
programming in general :) You can have an order field in your models. You 
can cache the data in your queue listener application and write to the DB 
only portions that make sense according to order and keep the data that is 
out of order in memory until it can be written.

Regards,
Camilo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3f50643c-fc7a-45f6-9ef8-a51ad74c3452%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: View function and URL Conf basic question

2014-02-27 Thread Camilo Torres
On Wednesday, February 26, 2014 9:24:51 AM UTC-4:30, Daniel Roseman wrote:
>
> On Wednesday, 26 February 2014 08:10:40 UTC, ApathyBear wrote:
>>
>> Here is my urls.py:
>>
>> from django.conf.urls.defaults import *from mysite.views import hello, 
>> current_datetime, hours_ahead
>> urlpatterns = patterns('',
>> url(r'^hello/$', hello),
>> url(r'^time/$', current_datetime),
>> url(r'^time/plus/(\d{1,2})/$', hours_ahead),)
>>
>> And here is my View function associated with hours_ahead
>>
>> from django.http import Http404, HttpResponseimport datetime
>> def hours_ahead(request, offset):
>> try:
>> offset = int(offset)
>> except ValueError:
>> raise Http404()
>> dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
>> html = "In %s hour(s), it will be %s." % 
>> (offset, dt)
>> return HttpResponse(html)
>>
>> Now what is throwing me off is how 'offset' is a second argument to  the 
>> hours_ahead function. Yet I am not quite sure how it being the second 
>> argument makes it the case that it is associated with whatever is entered 
>> as a URL. Let me use an example to illustrate my confusion.
>>
>> Say I request the URL:  http://127.0.0.1:8000/time/plus/2/ . Why is it 
>> the case that offset is '2'? I am not seeing why '2' is plucked out? What 
>> happened with 'time' and 'plus'? How does python/django know that the '2' 
>> is referring to offset?
>>
> That is what the regular expression does in your first snippet. `time` and 
> `plus` are just matched, but not captured: the only thing that is captured 
> is `(\d{1,2})`, because it is surrounded in parentheses.
>
> If that's not clear for you, you should read a guide to regexes: 
> http://regular-expressions.info  is a good one.
>
Hello,

As Daniel points out, this is related to regular expressions. You can read 
a full explanation here:
https://docs.djangoproject.com/en/1.6/topics/http/urls/#how-django-processes-a-request

You sholud also take a look at the 're' Python module. 

Regards,
Camilo.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e7e7aace-49f6-47e4-8094-8c492c0987d4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


django-php - yeah, it happened.

2014-02-27 Thread Cal Leeming [Simplicity Media Ltd]
Clearly this should be considered for merge into the core;
https://github.com/mvasilkov/django-php

The really sad part: someone somewhere *will* use this in production, and
be totally srs about it.

Excuse me whilst I cry myself to sleep.

Cal

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKQagH-dFwiwSePpKoSGzUKR71CF92s8g%3DfVRpiiBS-2w1vdA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Accessing a python function from a blog post stored in the db?

2014-02-27 Thread Dennis Marwood
OK I think you are talking about something like 
https://docs.djangoproject.com/en/dev/intro/tutorial02/#adding-related-objects 
where I could just insert a slider type of entry and then a text entry and 
so on. Is that it?

On Wednesday, 26 February 2014 14:49:55 UTC-8, C. Kirby wrote:
>
> It doesn't have to, I guess it depends on how involved the creation tools 
> are that you create. Quick and dirty idea off the top of my head:
> If the authoring tools define post widgets (body, text, scroller, video, 
> etc) you could let authors drag and drop the elements as they wish. On the 
> model side, make all resources extend a base class of BlogResource type, 
> then for each blog post have a many to many through table that stores 
> ordering:
> PostID(foriegn=blog)
> ResourceID(genericforeignkey to blog resource)
> OrderID(int)
>
> or somthing like that.
>
> Regards,
> ~CK
>
> On Wednesday, February 26, 2014 4:18:14 PM UTC-6, Dennis Marwood wrote:
>>
>> Won't this force my blog posts to all be the same. i.e. Text then a image 
>> scroller? 
>> How would I handle the case where a blog post was Text, image scroller, 
>> text, image scroller?
>>
>> On Wednesday, 26 February 2014 13:35:01 UTC-8, C. Kirby wrote:
>>>
>>> It sounds like your implementation is a little skewed.
>>> If a blog post is made of multiple resources (summary, body, multiple 
>>> image collections, etc.) You should probably have a model or models with 
>>> the appropriate fields/relationships.  That way your template can house all 
>>> of the template language, and you build a single, user facing blog post 
>>> from the elements in the blog post model(s).
>>> This also gives you the benefit of making the various resources 
>>> available in other ways (eg. Show all my image collections, share 
>>> collections, etc) as well as change your layout in the future without 
>>> having hard-coded template calls in your content.
>>>
>>> Regards
>>> ~CK
>>>
>>> On Wednesday, February 26, 2014 3:18:54 PM UTC-6, Dennis Marwood wrote:

 Thanks. I look forward to trying this soon.

 I feel like I may be trying to swim against the current with this. Is 
 this a problem with the way that I have decided to implement my blog or 
 are 
 these workarounds typical for django applications?

 On Wednesday, 26 February 2014 04:15:15 UTC-8, Tom Evans wrote:
>
> On Wed, Feb 26, 2014 at 5:29 AM, Dennis Marwood  
> wrote: 
> > Thanks. I believe this is what I am looking for. However I am still 
> running 
> > into an issue w/ the fact that I am pulling my blog entries from the 
> db. 
> > This is causing the template to interpret the {% image_slider %} as 
> a 
> > string. 
> > 
> > From view.py: 
> > def blog(request): 
> > entries = 
> > 
> Project.objects.filter(destination="blog").order_by('-creation_date') 
> > return render(request, 'content.html', {"entries": entries, 
> >"page_title": "Blog", 
> >"description": 
> "Blog"}) 
> > 
> > And in content.html: 
> > {% for each in entries %} 
> > {{ each.entry }} 
> > {% endfor %} 
> > 
> > And a blog entry: 
> > Hello! Check out this collection of images. {% image_slider %} And 
> this 
> > collection! {% image_slider %} 
> > 
> > 
> > I don't want to hard code the inclusion tag in the content.html. 
> Instead I 
> > want to call it from the blog post. Is this possible? 
>
> Yes. You will need to write a custom template tag to parse the 
> contents of the object as a template, render it within the current 
> context and return the generated data. 
>
> Writing a custom template tag: 
>
>
> https://docs.djangoproject.com/en/1.6/howto/custom-template-tags/#writing-custom-template-tags
>  
>
> Rendering templates to string: 
>
>
> https://docs.djangoproject.com/en/1.6/ref/templates/api/#rendering-a-context
>  
>
> Your content.html would then look something like this, assuming you 
> called the custom tag 'render': 
>
> {% for each in entries %} 
> {% render each.entry %} 
> {% endfor %} 
>
> Beware the massive security holes if you allow users to generate 
> content that your site then renders as a template. 
>
> Cheers 
>
> Tom 
>


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 

Re: Django Windows Install Issues

2014-02-27 Thread Joe Buty
Thanks I got django and pip installed. I also got the community version of 
pyCharm and its is awesome. Thanks for all of the relevant comments and 
suggestions.

On Tuesday, February 25, 2014 1:23:49 PM UTC-8, Joe Buty wrote:
>
> Hello, I am having trouble getting Django to work. I have installed python 
> and downloaded and unzipped the .tar file for django. I am using windows 8 
> ugh and can not open the instal file. I read through the setup.py and I 
> think I need help setting the correct path. Either moving the Django unzip 
> folder or declare where it is. 
>
> If any one can offer me advice or even just describe how they got Django 
> to work, whether its on Win8 or something more useful.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1c26df4c-dbf1-449d-bd0f-a6623b8ed24f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Controlling admin ManyToManyField widget with keyboard

2014-02-27 Thread Ram Rachum
Ah, that works. It's not as nice as being able to move them without a tab
dance, but it works.


On Thu, Feb 27, 2014 at 12:40 AM, C. Kirby  wrote:

> Oh, sorry. That widget uses ModelAdmin.filter_horizontal (
> https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.filter_horizontal),
> it is not the standard admin ManyToMany widget. I just tested it in user
> permissions. I just got it to work by selecting(multiple) elements in one
> widget, tabbing to the move arrow, and clicking enter.
> Maybe that will work for you?
>
> Regards,
> ~CK
>
> On Wednesday, February 26, 2014 4:03:41 PM UTC-6, cool-RR wrote:
>
>> The widget is a combination of two multiple select boxes and arrows to
>> move items between boxes. I have no issues with the selecting part. I have
>> an issue with the moving part.
>>
>>
>> On Wed, Feb 26, 2014 at 11:58 PM, C. Kirby  wrote:
>>
>>>  I don't think I am. A ManyToMany relation in admin is represented as a
>>> select-multiple html widget - is that what we are talking about?
>>>
>>> The action that I described in my first message to select multiple
>>> elements in a select-multiple widget works in Firefox, Opera, and with a
>>> modifier in IE. It does not work in Chromium as indicated by the issue I
>>> linked to in the last message.
>>>
>>> Please let me know if I am missing something in your question.
>>>
>>> Regards,
>>> ~CK
>>>
>>>
>>> On Wednesday, February 26, 2014 3:48:25 PM UTC-6, cool-RR wrote:
>>>
 Are you sure that you're not confusing the behavior of the select box
 with the toggle action? Because I'm having trouble with the toggle action,
 not the select box.


 On Wed, Feb 26, 2014 at 8:08 PM, C. Kirby  wrote:

>  It appears that multi-select form widgets cannot be keyboard
> controlled in chromium, and it is a known bug/non-implementation:
>
> http://code.google.com/p/chromium/issues/detail?id=90172
>
>
> On Wednesday, February 26, 2014 11:28:05 AM UTC-6, cool-RR wrote:
>
>> Sorry, space doesn't do the toggle. (Windows 7 Chrome.)
>>
>>
>> On Wed, Feb 26, 2014 at 6:43 PM, C. Kirby  wrote:
>>
>>> While holding Ctrl (Command on a Mac), click the spacebar on the
>>> relations you want to select.
>>> Spacebar handles the toggle action, ctrl(command) keeps you in
>>> multi-select mode
>>>
>>> On Wednesday, February 26, 2014 6:12:09 AM UTC-6, cool-RR wrote:

 Hi,

  How do I control the admin ManyToManyField widget with the
 keyboard?


 Thanks,
 Ram.

>>>  --
>>> You received this message because you are subscribed to a topic in
>>> the Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/django-users/VxFrne7x92E/unsubscribe.
>>>  To unsubscribe from this group and all its topics, send an email to
>>> django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>>
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/f8d87dca-9ee6
>>> -44f3-b9bc-da7eef05fccc%40googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/to
> pic/django-users/VxFrne7x92E/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/553dcff5-6c89-449a-af29-adfaf24a2996%40goog
> legroups.com.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

  --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>> topic/django-users/VxFrne7x92E/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/6f425681-d3ec-45c4-9157-32047554d759%
>>> 40googlegroups.com.
>>>
>>> For more options, visit 

Re: How to host multiple instances of the same app with Windows Apache & WSGI?

2014-02-27 Thread C. Kirby
You can get a wildcard cert that captures all of *.site.com|org|net|etc

On Thursday, February 27, 2014 9:18:57 AM UTC-6, DJ-Tom wrote:
>
>
>
> Am Dienstag, 25. Februar 2014 13:50:11 UTC+1 schrieb Tom Evans:
>>
>>
>> Use different STATIC_ROOT for each site, eg /static2013 and /static2014. 
>>
>> But what you should really be doing is putting this in to a separate 
>> vhost. Domain names are cheap, sub-domains are even cheaper. 
>>
>> Cheers 
>>
>> Tom 
>>
>
> The access to the application has to be made via HTTPS - so I would have 
> to get proper SSL certificates for each new domain. Which isn't cheap... 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bc654af2-166a-4e5d-be3d-29700f9a4c3a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Javascript and sessions

2014-02-27 Thread C. Kirby
It sounds like you are trying to implement a wizard. If you are, Django has 
one built in:

https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/

On Wednesday, February 26, 2014 9:11:38 PM UTC-6, Luke Baker wrote:
>
> Hey there,
>
> (Forgive my ignorance)
>
> My web application is heavily based around form input. I'd like to update 
> the user's session with each form input that they update or change while 
> working with a form. I'm thinking of implementing some simple javascript 
> that listens for 'change' events on each form input. When the 'change' 
> event fires, I'd like to make an ajax request to update the users session 
> with that form input name and value. To do this, I would have to write a 
> view that would allow the user to POST any thing they wanted (essentially) 
> to their session - is this safe? It makes me think twice.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/927abb45-cfc2-4661-bbcb-27e70bb84451%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django i18n url is not working with en-us sublanguage

2014-02-27 Thread Eliecer Daza
Hi, I just have the same error
could you solved it!!
thanks

On Monday, May 7, 2012 4:57:52 AM UTC-5, Suteepat Damrongyingsupab wrote:
>
> My django app's using i18n_patterns in urls.py and when I go to my app 
> with the url like: 
>
> myapp.com/en/
>
> myapp.com/de/
>
> myapp.com/en-gb/
>
> The urls above works fine but the url *myapp.com/en-us/ 
> * gave me an 404 error.
>
> I think the problem is that (
> https://code.djangoproject.com/browser/django/trunk/django/conf/global_settings.py)
>  
> Django's default LANGUAGE_CODE is 'en-us' but there is no 'en-us' in the 
> default LANGUAGES setting. That's why I got 404 page.
>
> Should I just change the LANGUAGE_CODE to 'en' or add 'en-us' to the 
> LANGUAGES setting?
>
> Is the default 'en-us' LANGUAGE_CDE setting useless when using with i18n 
> URL?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d0ce9023-f9dd-4e55-890b-42c7490fc904%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Question about populating user data with Django-cas

2014-02-27 Thread wasingej
Hi guys,

I'm having trouble getting the example code that is posted in the overview 
document for django-cas to work.  Here is my relevant code:



*cas_backend.py:*from django_cas.backends import CASBackend

class PopulatedCASBackend(CASBackend):

def authenticate(self, ticket, service):
user = super(PopulatedCASBackend, self).authenticate(ticket, 
service)
print("hello world!")

return user



*settings.py:*...

AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
#'django_cas.backends.CASBackend',
'mail_site.cas_backend.PopulatedCASBackend',
)

...

When I run my website and try to log in to the cas server, I get a 403 
error after entering my username/password and clicking log in.  Why would 
this be happening?

Jared

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/51237db1-19e7-42d1-b184-f28f51dfd6a4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: erreur django.core.management

2014-02-27 Thread Tom Evans
On Thu, Feb 27, 2014 at 1:10 PM, Grimaud Florent
 wrote:
> bonjour,
> quand j'installe updatengine j'ai un problème avec Django
>
> "file  /var/www/UE-environment/updatengine-server/manage.py", line 8, in
> module
> from Django.core.management importe exécute from_commande_line
> import error: no module name Django.core.management "
>
> merci de votre aide
>

Il faut dit "django.core.management", ce n'est pas "Django.core.management"

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1KqQHAFPJo8-_o_sMbqQMCDxt3NUSR7mUnxvHjFJWY%2BHg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Terrible performance when dropping into raw SQL Oracle

2014-02-27 Thread Shawn H
The cursor.execute specifically.  I'm printing a timestamp immediately 
before and immediately after that line.  I'm positive it is ONLY the query 
that takes 16 seconds, whether using django.cursor or a cx_Oracle cursor.

On Thursday, February 27, 2014 9:27:48 AM UTC-6, Scott Anderson wrote:
>
> Are you timing the query in the view specifically, or the entire view? 
> That is, do you know for sure that it is *only* the query that is taking 16 
> seconds and not the rest of the view?
>
> -scott
>
> On Wednesday, February 26, 2014 5:53:15 PM UTC-5, Shawn H wrote:
>>
>> I said that before testing it.  The exact same code using cx_Oracle takes 
>> ~4 seconds outside of the django environment, but still takes ~16 seconds 
>> when running in the django view.  What the heck is going on?  Updated 
>> portion of code below
>>
>> cnxn = cx_Oracle.connect('notification/notifydev@landmgm')
>> cursor = cx_Oracle.Cursor(cnxn) #connections['landtest_11'].cursor()
>> print datetime.datetime.now()
>> cursor.execute('SELECT count(1) from (SELECT DISTINCT RECORDNUMB FROM 
>> DEVGIS.NOTICED_PARCELS WHERE CASE_NUMBER =  AND RECORDNUMB > 0 UNION \
>> SELECT DISTINCT RECORDNUMB FROM DEVGIS.CONDONOTICE WHERE CASE_NUMBER =  
>> AND RECORDNUMB > 0)', [case_number, case_number])
>>  print datetime.datetime.now()
>> number_count = cursor.fetchone()
>>
>>
>> On Wednesday, February 26, 2014 4:41:06 PM UTC-6, Shawn H wrote:
>>>
>>> Because this worked so well, I've gone directly to cx_Oracle in my 
>>> django view and used that to get the result in the 4 seconds.  There is 
>>> definitely a problem with the Django implementation - I wonder if perhaps 
>>> the indexes on the tables aren't being used properly.
>>>
>>> On Wednesday, February 26, 2014 3:49:47 PM UTC-6, Shawn H wrote:

 3.8 seconds.  It seems to be django, not cx_Oracle.

 On Wednesday, February 26, 2014 2:50:58 PM UTC-6, Shawn H wrote:
>
> Good idea.  I'll try that and report back
>
> On Wednesday, February 26, 2014 1:22:52 PM UTC-6, Tom Evans wrote:
>>
>> On Wed, Feb 26, 2014 at 6:16 PM, Shawn H  
>> wrote: 
>> > Yes.  I've tested with several case numbers, and I'm using a 
>> similar 
>> > parameterized approach in my gui Oracle client as well, with the 
>> same 
>> > results.  It's always about 3 to 4 times slower running via django. 
>>  I've 
>> > tried it both on my local development web server as well as my 
>> production 
>> > apache linux box, and it always takes much longer running via 
>> django. 
>> > 
>> > 
>>
>> If you write a standard python program, ie not using django, but 
>> still 
>> using whatever oracle DB adapter Django uses, that connects to your 
>> oracle server and executes the query, is it still slow? 
>>
>> IE is the problem something django does, or how the adapter works. 
>>
>> Cheers 
>>
>> Tom 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8bfdecd7-e679-4f8a-8b70-58495f467667%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


How to detect clear checkbox chequed on ClearableFileInput

2014-02-27 Thread Héctor Urbina
Hello,

I have a edit view to modify an object. The model includes an inline 
formset of insumoRecurso objects, for including files associated with the 
main object. These files appear with a checkbox for clearing files 
(ClearableFileInput widget). What should I test on my view to detect that 
the checkbox has been selected?

Here's the code of my view:

@login_required
def editarRecurso(request, recurso_id):
  recurso = get_object_or_404(Recurso, pk=recurso_id)
  objetos = {}
  objetos["recurso"] = recurso
  u = request.user
  if recurso.creador != u and not (usuarioEsSupervisor(u) or 
usuarioEsCoordinador(u)):
  objetos["mensaje_de_error"] = "Usted no puede editar este recurso."
  else:
InsumoFormset = inlineformset_factory(Recurso, InsumoRecurso, extra=1)
if request.method == 'POST':
  recursoForm = RecursoForm(request.POST, instance=recurso)
  insumoFormset = InsumoFormset(request.POST, request.FILES, instance = 
recurso)
  if recursoForm.is_valid():
recurso = recursoForm.save(commit=False)
recurso.save()
notificarCreacionRecurso(request, recurso)
for insumoForm in insumoFormset:
  if insumoForm.is_valid():
insumoRecurso = insumoForm.save(commit=False)
if not insumoRecurso.archivo.name: #This is the way I found for 
not saving objects that doesn't have an uploaded file (i.e., when user 
doesn't choose a file to upload)!!! is there a better way?
  continue
ir = insumoRecurso.save()
if insumoRecurso.archivo.remove: #This is not working, "remove" 
attribute doesn't exist... but here is where I expect a way of detecting 
clear checkbox selection. If there is no file, then the whole insumoRecurso 
object must be deleted.
  ir.delete()
return redirect(reverse('recursos:detalle', args=(recurso.id,)))
  else:
objetos["recursoForm"] = recursoForm
objetos["insumoFormset"] = insumoFormset
else:
  objetos["recursoForm"] = RecursoForm(instance=recurso)
  objetos["recursoForm"].fields["curso"].queryset = 
Curso.objects.filter(owner=request.user)
  objetos["insumoFormset"] = InsumoFormset(instance=recurso)

  template = loader.get_template('recursos/editarRecurso.html')
  context = RequestContext(request, objetos)
  return HttpResponse(template.render(context))

I would appreciate any help, By the way, even though I check the clear 
checkbox, the file is never deleted (I would assume that would happen on 
insumoRecurso.save(), but the files always remain there)

Thanks,
Hector.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2bbe12a5-c070-4b10-85d4-406c9053a8c3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Terrible performance when dropping into raw SQL Oracle

2014-02-27 Thread Scott Anderson
Are you timing the query in the view specifically, or the entire view? That 
is, do you know for sure that it is *only* the query that is taking 16 
seconds and not the rest of the view?

-scott

On Wednesday, February 26, 2014 5:53:15 PM UTC-5, Shawn H wrote:
>
> I said that before testing it.  The exact same code using cx_Oracle takes 
> ~4 seconds outside of the django environment, but still takes ~16 seconds 
> when running in the django view.  What the heck is going on?  Updated 
> portion of code below
>
> cnxn = cx_Oracle.connect('notification/notifydev@landmgm')
> cursor = cx_Oracle.Cursor(cnxn) #connections['landtest_11'].cursor()
> print datetime.datetime.now()
> cursor.execute('SELECT count(1) from (SELECT DISTINCT RECORDNUMB FROM 
> DEVGIS.NOTICED_PARCELS WHERE CASE_NUMBER =  AND RECORDNUMB > 0 UNION \
> SELECT DISTINCT RECORDNUMB FROM DEVGIS.CONDONOTICE WHERE CASE_NUMBER =  
> AND RECORDNUMB > 0)', [case_number, case_number])
>  print datetime.datetime.now()
> number_count = cursor.fetchone()
>
>
> On Wednesday, February 26, 2014 4:41:06 PM UTC-6, Shawn H wrote:
>>
>> Because this worked so well, I've gone directly to cx_Oracle in my django 
>> view and used that to get the result in the 4 seconds.  There is definitely 
>> a problem with the Django implementation - I wonder if perhaps the indexes 
>> on the tables aren't being used properly.
>>
>> On Wednesday, February 26, 2014 3:49:47 PM UTC-6, Shawn H wrote:
>>>
>>> 3.8 seconds.  It seems to be django, not cx_Oracle.
>>>
>>> On Wednesday, February 26, 2014 2:50:58 PM UTC-6, Shawn H wrote:

 Good idea.  I'll try that and report back

 On Wednesday, February 26, 2014 1:22:52 PM UTC-6, Tom Evans wrote:
>
> On Wed, Feb 26, 2014 at 6:16 PM, Shawn H  wrote: 
> > Yes.  I've tested with several case numbers, and I'm using a similar 
> > parameterized approach in my gui Oracle client as well, with the 
> same 
> > results.  It's always about 3 to 4 times slower running via django. 
>  I've 
> > tried it both on my local development web server as well as my 
> production 
> > apache linux box, and it always takes much longer running via 
> django. 
> > 
> > 
>
> If you write a standard python program, ie not using django, but still 
> using whatever oracle DB adapter Django uses, that connects to your 
> oracle server and executes the query, is it still slow? 
>
> IE is the problem something django does, or how the adapter works. 
>
> Cheers 
>
> Tom 
>


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/23506457-089b-4b1c-815c-c5ddbad79e32%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to host multiple instances of the same app with Windows Apache & WSGI?

2014-02-27 Thread DJ-Tom


Am Dienstag, 25. Februar 2014 13:50:11 UTC+1 schrieb Tom Evans:
>
>
> Use different STATIC_ROOT for each site, eg /static2013 and /static2014. 
>
> But what you should really be doing is putting this in to a separate 
> vhost. Domain names are cheap, sub-domains are even cheaper. 
>
> Cheers 
>
> Tom 
>

The access to the application has to be made via HTTPS - so I would have to 
get proper SSL certificates for each new domain. Which isn't cheap... 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5e36d9fc-651b-42dd-a51d-d0ecf65de6b5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Template/Form Errors and DynaTree.js

2014-02-27 Thread Timothy W. Cook
Thanks Andreas.

I'll poke around with this and see if I can figure it out.

If not;  I'll Be Back!   :-)

Cheers,
Tim



On Thu, Feb 27, 2014 at 10:18 AM, Andreas Kuhne
wrote:

> Hi again Timothy,
>
> Actually it's much easier than you think.
>
> The error you showed is a validation error, is it not?
>
> What you do is that you submit the form via jquery ajax, something like
> this should work:
>
>   $.ajax({ type: 'POST', url: the_form_url, dataType: 'html', data: {
> email : $('#id_email').val(), name : $('#id_name').val(), phone :
> $('#id_phone').val() }, success: function(data){
> $("#old_div_content").html(data); }, error: function(xhr, textStatus,
> errorThrown) { console.log('AJAX communication failed:',
> textStatus, errorThrown); } });
>
> Now you will have to change the function so that the parameters sent to
> your view are correct (in the data map), the url is correct and the success
> method changes the correct div. You won't have to do any error handling in
> jquery at all, because the validation is on the server. When you replace
> the html in the div that you want to replace, the user will just get the
> validation errors that django creates for you.
>
> You really don't have to change anything in the view that you are using at
> the moment, because it already returns the information that you want in the
> div, all you have to do is get in into the div :-)
>
> Regards,
>
> Andréas
>
>
> 2014-02-27 14:06 GMT+01:00 Timothy W. Cook :
>
>> Hi Andreas,
>>
>> Thanks for the reply.
>>
>>
>> On Thu, Feb 27, 2014 at 9:42 AM, Andreas Kuhne <
>> andreas.ku...@suitopia.com> wrote:
>>
>>> Hi Timothy,
>>>
>>> What you probably have to do is submit the form in a ajax call via
>>> jquery for example. https://api.jquery.com/jQuery.ajax/
>>>
>>> You create a request via the ajax method in jquery and then add a
>>> success and error handler. They only have to update the div you want to
>>> replace: $("#div_id").html(response).
>>>
>>>
>>
>> This certainly seems like a reasonable approach.  The points I am unsure
>> of is:
>>
>> 1)  how do I catch the template error in jQuery?
>>
>> 2) I suppose that I have to (somehow) catch the error in the ModelForm?
>>
>> 3) then send that request to jQuery, somehow?
>>
>> My forms and views are pretty simple at this point.  Here are examples:
>>
>> class DvCodedStringCreateView(CreateView):
>> template_name = 'dvcodedstring_create.html'
>> success_url = '/dashboard'
>> model = DvCodedString
>> form_class = DvCodedStringCreateForm
>> fields =
>> ['published','prj_name','data_name','lang','description','sem_attr','resource_uri','asserts',
>>
>> 'terminology','term_subset','codes','t_code','t_string','t_name','t_abbrev','t_version',
>>
>> 'min_length','max_length','exact_length','enums','enums_annotations','default_value',]
>>
>>
>>
>>
>> class DvCodedStringCreateForm(forms.ModelForm):
>> class Meta:
>> model = DvCodedString
>> widgets = {
>> 'data_name': TextInput(attrs={'size':90}),
>> 'description': Textarea(attrs={'cols':80,
>> 'rows':5,'wrap':'off'}),
>> 'sem_attr': Textarea(attrs={'cols':15,
>> 'rows':3,'wrap':'off'}),
>> 'resource_uri': Textarea(attrs={'cols':60,
>> 'rows':3,'wrap':'off'}),
>> 'asserts': Textarea(attrs={'cols':80,
>> 'rows':2,'wrap':'off'}),
>> 'enums': Textarea(attrs={'cols':30,
>> 'rows':5,'wrap':'off'}),
>> 'enums_annotations': Textarea(attrs={'cols':50,
>> 'rows':5,'wrap':'off'}),
>> 't_code': Textarea(attrs={'cols':15,
>> 'rows':5,'wrap':'off'}),
>> 't_string': Textarea(attrs={'cols':30,
>> 'rows':5,'wrap':'off'}),
>> 't_abbrev': Textarea(attrs={'cols':10,
>> 'rows':5,'wrap':'off'}),
>> 't_version': Textarea(attrs={'cols':10,
>> 'rows':5,'wrap':'off'}),
>> 't_name': Textarea(attrs={'cols':40,
>> 'rows':5,'wrap':'off'}),
>>
>>}
>>
>>
>>
>> Thanks in advance for any further guidance.
>>
>> --Tim
>>
>>
>>
>>
>>> 2014-02-27 12:38 GMT+01:00 Timothy W. Cook :
>>>
 I have no idea where to start on this problem.
 My application is work great using the admin UI but to enhance
 usability it is time for a new user interface.

 I am using dynatree.js to create a 'Project' tree with subelements
 (called PcTs) grouped into types;  IOW:  There are three levels before you
 get to an editable component.  Hence the reason to use a tree instead of
 paging through the admin UI.

 So my  UI (Selection_001.png)  uses  tags to layout the spaces.
  Basically tree on the left and a larger editing space next to it.  My
 forms a re properly placed inside the scrollable .  My problem is when
 I get an error in the form, how do I control it so that it is only

Re: Template/Form Errors and DynaTree.js

2014-02-27 Thread Andreas Kuhne
Hi again Timothy,

Actually it's much easier than you think.

The error you showed is a validation error, is it not?

What you do is that you submit the form via jquery ajax, something like
this should work:

  $.ajax({ type: 'POST', url: the_form_url, dataType: 'html', data: { email
: $('#id_email').val(), name : $('#id_name').val(), phone :
$('#id_phone').val() }, success: function(data){
$("#old_div_content").html(data); }, error: function(xhr, textStatus,
errorThrown) { console.log('AJAX communication failed:',
textStatus, errorThrown); } });

Now you will have to change the function so that the parameters sent to
your view are correct (in the data map), the url is correct and the success
method changes the correct div. You won't have to do any error handling in
jquery at all, because the validation is on the server. When you replace
the html in the div that you want to replace, the user will just get the
validation errors that django creates for you.

You really don't have to change anything in the view that you are using at
the moment, because it already returns the information that you want in the
div, all you have to do is get in into the div :-)

Regards,

Andréas


2014-02-27 14:06 GMT+01:00 Timothy W. Cook :

> Hi Andreas,
>
> Thanks for the reply.
>
>
> On Thu, Feb 27, 2014 at 9:42 AM, Andreas Kuhne  > wrote:
>
>> Hi Timothy,
>>
>> What you probably have to do is submit the form in a ajax call via jquery
>> for example. https://api.jquery.com/jQuery.ajax/
>>
>> You create a request via the ajax method in jquery and then add a success
>> and error handler. They only have to update the div you want to replace:
>> $("#div_id").html(response).
>>
>>
>
> This certainly seems like a reasonable approach.  The points I am unsure
> of is:
>
> 1)  how do I catch the template error in jQuery?
>
> 2) I suppose that I have to (somehow) catch the error in the ModelForm?
>
> 3) then send that request to jQuery, somehow?
>
> My forms and views are pretty simple at this point.  Here are examples:
>
> class DvCodedStringCreateView(CreateView):
> template_name = 'dvcodedstring_create.html'
> success_url = '/dashboard'
> model = DvCodedString
> form_class = DvCodedStringCreateForm
> fields =
> ['published','prj_name','data_name','lang','description','sem_attr','resource_uri','asserts',
>
> 'terminology','term_subset','codes','t_code','t_string','t_name','t_abbrev','t_version',
>
> 'min_length','max_length','exact_length','enums','enums_annotations','default_value',]
>
>
>
>
> class DvCodedStringCreateForm(forms.ModelForm):
> class Meta:
> model = DvCodedString
> widgets = {
> 'data_name': TextInput(attrs={'size':90}),
> 'description': Textarea(attrs={'cols':80,
> 'rows':5,'wrap':'off'}),
> 'sem_attr': Textarea(attrs={'cols':15,
> 'rows':3,'wrap':'off'}),
> 'resource_uri': Textarea(attrs={'cols':60,
> 'rows':3,'wrap':'off'}),
> 'asserts': Textarea(attrs={'cols':80,
> 'rows':2,'wrap':'off'}),
> 'enums': Textarea(attrs={'cols':30,
> 'rows':5,'wrap':'off'}),
> 'enums_annotations': Textarea(attrs={'cols':50,
> 'rows':5,'wrap':'off'}),
> 't_code': Textarea(attrs={'cols':15,
> 'rows':5,'wrap':'off'}),
> 't_string': Textarea(attrs={'cols':30,
> 'rows':5,'wrap':'off'}),
> 't_abbrev': Textarea(attrs={'cols':10,
> 'rows':5,'wrap':'off'}),
> 't_version': Textarea(attrs={'cols':10,
> 'rows':5,'wrap':'off'}),
> 't_name': Textarea(attrs={'cols':40,
> 'rows':5,'wrap':'off'}),
>
>}
>
>
>
> Thanks in advance for any further guidance.
>
> --Tim
>
>
>
>
>> 2014-02-27 12:38 GMT+01:00 Timothy W. Cook :
>>
>>> I have no idea where to start on this problem.
>>> My application is work great using the admin UI but to enhance usability
>>> it is time for a new user interface.
>>>
>>> I am using dynatree.js to create a 'Project' tree with subelements
>>> (called PcTs) grouped into types;  IOW:  There are three levels before you
>>> get to an editable component.  Hence the reason to use a tree instead of
>>> paging through the admin UI.
>>>
>>> So my  UI (Selection_001.png)  uses  tags to layout the spaces.
>>>  Basically tree on the left and a larger editing space next to it.  My
>>> forms a re properly placed inside the scrollable .  My problem is when
>>> I get an error in the form, how do I control it so that it is only
>>> displayed in the same  where the form was displayed?  What I get now
>>> is a full page reload. See Selection_002.png
>>>
>>> The template does not use any extend or include directives.  It is a
>>> completely self contained HTML file.
>>> There are forms and views for each of the PcTs.
>>>
>>>
>>>  Any ideas on where to start working on this?
>>>
>>>
>>>

Re: collectstatic is not working

2014-02-27 Thread Robin Lery
ohh my god..it should be

STATICFILES_DIRS

! And not STATIC_DIRS? Thank you so much!!!


On Thu, Feb 27, 2014 at 6:38 PM, Robin Lery  wrote:

>
> if DEBUG:
> MEDIA_URL = '/media/'
> STATIC_ROOT = os.path.join(os.path.dirname(
> BASE_DIR), "static", "static-only")
> MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static", "media")
> STATIC_DIRS = (
> *os.path.join(os.path.dirname(**BASE_DIR), "static", "static"),*
> )
>
>
> On Thu, Feb 27, 2014 at 6:35 PM, Robin Lery  wrote:
>
>> Hello,
>> I have been trying to collect statics from the static folder but, its not
>> collecting any files. But it did collect the admin files. What's wrong.
>> Please help me.
>>
>> Thank you.
>>
>> *settings:*
>>
>> import os
>> BASE_DIR = os.path.dirname(os.path.dirname(__file__))
>>
>> STATIC_URL = '/static/'
>>
>> # Template location
>> TEMPLATE_DIRS = (
>> os.path.join(os.path.dirname(BASE_DIR), "static", "templates"),
>> )
>>
>> if DEBUG:
>> MEDIA_URL = '/media/'
>> STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static",
>> "static-only")
>> MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static",
>> "media")
>> STATIC_DIRS = (
>> os.path.join(os.path.dirname(BASE_DIR), "static", "static-only"),
>> )
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B4-nGrT8TcVF9Wr4F%3Di3yq7PG4iKAc-SqypvL1A7cFg0QHhVw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


erreur django.core.management

2014-02-27 Thread Grimaud Florent
bonjour,
quand j'installe updatengine j'ai un problème avec Django

"file  /var/www/UE-environment/updatengine-server/manage.py", line 8, in 
module
from Django.core.management importe exécute from_commande_line
import error: no module name Django.core.management "

merci de votre aide

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/21f20973-c28f-4895-8521-bcfc9e3961a4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Tools to document api

2014-02-27 Thread Timothy W. Cook
Are you using the django-rest-framework?

See:  http://www.django-rest-framework.org/topics/documenting-your-api

Swagger works great.




On Thu, Feb 27, 2014 at 3:41 AM,  wrote:

> I have a Django project in which i have written api interface to which i
> want to document.
> what are the best tools for documenting the api  ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/50129fcb-772e-4f0d-b920-28814e5aa196%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 994711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3WBK1XtYAWRFHfQ_JqPGcuY6U56gccup6PJbsXP7no_OA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: collectstatic is not working

2014-02-27 Thread Robin Lery
if DEBUG:
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(os.path.dirname(
BASE_DIR), "static", "static-only")
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static", "media")
STATIC_DIRS = (
*os.path.join(os.path.dirname(**BASE_DIR), "static", "static"),*
)


On Thu, Feb 27, 2014 at 6:35 PM, Robin Lery  wrote:

> Hello,
> I have been trying to collect statics from the static folder but, its not
> collecting any files. But it did collect the admin files. What's wrong.
> Please help me.
>
> Thank you.
>
> *settings:*
>
> import os
> BASE_DIR = os.path.dirname(os.path.dirname(__file__))
>
> STATIC_URL = '/static/'
>
> # Template location
> TEMPLATE_DIRS = (
> os.path.join(os.path.dirname(BASE_DIR), "static", "templates"),
> )
>
> if DEBUG:
> MEDIA_URL = '/media/'
> STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static",
> "static-only")
> MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static", "media")
> STATIC_DIRS = (
> os.path.join(os.path.dirname(BASE_DIR), "static", "static-only"),
> )
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B4-nGp7QhKE%2BE7zPiBmj3TZTYB4Ph3CYcfM5AFL16SM%2BHh-_A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: collectstatic is not working

2014-02-27 Thread Timothy W. Cook
I think you need to set STATICFILES_DIRS  as well




On Thu, Feb 27, 2014 at 10:05 AM, Robin Lery  wrote:

> Hello,
> I have been trying to collect statics from the static folder but, its not
> collecting any files. But it did collect the admin files. What's wrong.
> Please help me.
>
> Thank you.
>
> *settings:*
>
> import os
> BASE_DIR = os.path.dirname(os.path.dirname(__file__))
>
> STATIC_URL = '/static/'
>
> # Template location
> TEMPLATE_DIRS = (
> os.path.join(os.path.dirname(BASE_DIR), "static", "templates"),
> )
>
> if DEBUG:
> MEDIA_URL = '/media/'
> STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static",
> "static-only")
> MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static", "media")
> STATIC_DIRS = (
> os.path.join(os.path.dirname(BASE_DIR), "static", "static-only"),
> )
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2B4-nGrMV-y3YnSGnDVstKMu9h4f0kLH4qjSjwfQJOyGPxV5qw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 994711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3V-%3DabAkEW8fTK%3DFxKcZH47u4HR5%2B7FDqhWTk-kFQCn6w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Template/Form Errors and DynaTree.js

2014-02-27 Thread Timothy W. Cook
Hi Andreas,

Thanks for the reply.


On Thu, Feb 27, 2014 at 9:42 AM, Andreas Kuhne
wrote:

> Hi Timothy,
>
> What you probably have to do is submit the form in a ajax call via jquery
> for example. https://api.jquery.com/jQuery.ajax/
>
> You create a request via the ajax method in jquery and then add a success
> and error handler. They only have to update the div you want to replace:
> $("#div_id").html(response).
>
>

This certainly seems like a reasonable approach.  The points I am unsure of
is:

1)  how do I catch the template error in jQuery?

2) I suppose that I have to (somehow) catch the error in the ModelForm?

3) then send that request to jQuery, somehow?

My forms and views are pretty simple at this point.  Here are examples:

class DvCodedStringCreateView(CreateView):
template_name = 'dvcodedstring_create.html'
success_url = '/dashboard'
model = DvCodedString
form_class = DvCodedStringCreateForm
fields =
['published','prj_name','data_name','lang','description','sem_attr','resource_uri','asserts',

'terminology','term_subset','codes','t_code','t_string','t_name','t_abbrev','t_version',

'min_length','max_length','exact_length','enums','enums_annotations','default_value',]




class DvCodedStringCreateForm(forms.ModelForm):
class Meta:
model = DvCodedString
widgets = {
'data_name': TextInput(attrs={'size':90}),
'description': Textarea(attrs={'cols':80,
'rows':5,'wrap':'off'}),
'sem_attr': Textarea(attrs={'cols':15,
'rows':3,'wrap':'off'}),
'resource_uri': Textarea(attrs={'cols':60,
'rows':3,'wrap':'off'}),
'asserts': Textarea(attrs={'cols':80,
'rows':2,'wrap':'off'}),
'enums': Textarea(attrs={'cols':30,
'rows':5,'wrap':'off'}),
'enums_annotations': Textarea(attrs={'cols':50,
'rows':5,'wrap':'off'}),
't_code': Textarea(attrs={'cols':15,
'rows':5,'wrap':'off'}),
't_string': Textarea(attrs={'cols':30,
'rows':5,'wrap':'off'}),
't_abbrev': Textarea(attrs={'cols':10,
'rows':5,'wrap':'off'}),
't_version': Textarea(attrs={'cols':10,
'rows':5,'wrap':'off'}),
't_name': Textarea(attrs={'cols':40,
'rows':5,'wrap':'off'}),

   }



Thanks in advance for any further guidance.

--Tim




> 2014-02-27 12:38 GMT+01:00 Timothy W. Cook :
>
>> I have no idea where to start on this problem.
>> My application is work great using the admin UI but to enhance usability
>> it is time for a new user interface.
>>
>> I am using dynatree.js to create a 'Project' tree with subelements
>> (called PcTs) grouped into types;  IOW:  There are three levels before you
>> get to an editable component.  Hence the reason to use a tree instead of
>> paging through the admin UI.
>>
>> So my  UI (Selection_001.png)  uses  tags to layout the spaces.
>>  Basically tree on the left and a larger editing space next to it.  My
>> forms a re properly placed inside the scrollable .  My problem is when
>> I get an error in the form, how do I control it so that it is only
>> displayed in the same  where the form was displayed?  What I get now
>> is a full page reload. See Selection_002.png
>>
>> The template does not use any extend or include directives.  It is a
>> completely self contained HTML file.
>> There are forms and views for each of the PcTs.
>>
>>
>>  Any ideas on where to start working on this?
>>
>>
>>
>>
>>
>> --
>> MLHIM VIP Signup: http://goo.gl/22B0U
>> 
>> Timothy Cook, MSc   +55 21 994711995
>> MLHIM http://www.mlhim.org
>> Like Us on FB: https://www.facebook.com/mlhim2
>> Circle us on G+: http://goo.gl/44EV5
>> Google Scholar: http://goo.gl/MMZ1o
>> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3UZppis4c8rr_Ok9rQ_SO6uXK6iii8HG7cPHE9qq1CWLw%40mail.gmail.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> 

collectstatic is not working

2014-02-27 Thread Robin Lery
Hello,
I have been trying to collect statics from the static folder but, its not
collecting any files. But it did collect the admin files. What's wrong.
Please help me.

Thank you.

*settings:*

import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))

STATIC_URL = '/static/'

# Template location
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(BASE_DIR), "static", "templates"),
)

if DEBUG:
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static",
"static-only")
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static", "media")
STATIC_DIRS = (
os.path.join(os.path.dirname(BASE_DIR), "static", "static-only"),
)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B4-nGrMV-y3YnSGnDVstKMu9h4f0kLH4qjSjwfQJOyGPxV5qw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Tools to document api

2014-02-27 Thread naveen
I have a Django project in which i have written api interface to which i 
want to document. 
what are the best tools for documenting the api  ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/50129fcb-772e-4f0d-b920-28814e5aa196%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Admin and search_fields

2014-02-27 Thread ReneMarxis
Hello
 
does anyone know some app similar to 
https://pypi.python.org/pypi/django-admin-visualsearch that is able to 
filter over more than one related (foreign key) level?
Would be great to define just some fields i'd like to search on (in 
admin.py), and get one input field for every search_field...
 
_thanks
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a480c11f-948a-4377-94ad-3c9de0b29750%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Template/Form Errors and DynaTree.js

2014-02-27 Thread Andreas Kuhne
Hi Timothy,

What you probably have to do is submit the form in a ajax call via jquery
for example. https://api.jquery.com/jQuery.ajax/

You create a request via the ajax method in jquery and then add a success
and error handler. They only have to update the div you want to replace:
$("#div_id").html(response).

That way you will be able to acheive what you are looking for.

Regards,

Andréas

2014-02-27 12:38 GMT+01:00 Timothy W. Cook :

> I have no idea where to start on this problem.
> My application is work great using the admin UI but to enhance usability
> it is time for a new user interface.
>
> I am using dynatree.js to create a 'Project' tree with subelements (called
> PcTs) grouped into types;  IOW:  There are three levels before you get to
> an editable component.  Hence the reason to use a tree instead of paging
> through the admin UI.
>
> So my  UI (Selection_001.png)  uses  tags to layout the spaces.
>  Basically tree on the left and a larger editing space next to it.  My
> forms a re properly placed inside the scrollable .  My problem is when
> I get an error in the form, how do I control it so that it is only
> displayed in the same  where the form was displayed?  What I get now
> is a full page reload. See Selection_002.png
>
> The template does not use any extend or include directives.  It is a
> completely self contained HTML file.
> There are forms and views for each of the PcTs.
>
>
> Any ideas on where to start working on this?
>
>
>
>
>
> --
> MLHIM VIP Signup: http://goo.gl/22B0U
> 
> Timothy Cook, MSc   +55 21 994711995
> MLHIM http://www.mlhim.org
> Like Us on FB: https://www.facebook.com/mlhim2
> Circle us on G+: http://goo.gl/44EV5
> Google Scholar: http://goo.gl/MMZ1o
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3UZppis4c8rr_Ok9rQ_SO6uXK6iii8HG7cPHE9qq1CWLw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUbno2-CvWgs%2BZjTWO7zU0C3YkvnzLCs3S0stiPGvDvBPBA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.