Re: Avoiding code repetition in views

2012-06-29 Thread Timothy Makobu
@grimmus I have a file called shared.py, and In it, i have created a dict template_dict { } which has stuff that all the views share. I import it into views.py and any app that will use that dict. I can then add more items or alter existing ones via template_dict.update(). On Fri, Jun 29, 2012 a

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Jon Black
I understand that institue_hours_of_operation is a count of the hours the user has worked, is that correct? If so, I suppose you just need to count the hours with each form submition and add that to the current institue_hours_of_operation value. You can do that logic in a few places. In class-based

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Nikhil Verma
Hi Jon Yes it is the count of the hours.They will enter in the following manner "- Monday : 0900-1800, Tuesday and so on ... This will be entered by the user who is filling the form. Now the text Moday(weekdays can be hardcoded but i personally don't want.) Now if you see this is a simple CharFi

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Jon Black
If the days have to be hardcoded (I imagine you have a row/field for each day), then you could use a hardcoded string for the day (not editable nor related to your model), and provide two Time fields. Using Time gives you advantages: * You can use python's DateTime module to calculate the hours *

Re: WebService WSDL

2012-06-29 Thread Tim Sawyer
I did it manually, not using the WSDL. http://drumcoder.co.uk/blog/2009/nov/23/running-soap-webservice-without-library/ Tim. On 28/06/12 20:51, Anurag Chourasia wrote: Try using gSOAP if that fits your needs. http://www.cs.fsu.edu/~engelen/soap.html Regards, Guddu On Thu, Jun 28, 2012 at 2:

Re: Avoiding code repetition in views

2012-06-29 Thread Melvyn Sopacua
On 29-6-2012 5:45, Ryan Nowakowski wrote: > Or a custom template context processor that adds gigs to every request > context. Or just use an iframe in your template that loads the gigs rendering view. Iframe bad, yes, and all that, but the simplest solution in this case if your layout can handle i

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Melvyn Sopacua
On 29-6-2012 11:01, Nikhil Verma wrote: > Yes it is the count of the hours.They will enter in the following manner "- > > Monday : 0900-1800, Tuesday and so on ... This will be entered by the user > who is filling the form. > > Now the text Moday(weekdays can be hardcoded but i personally don't

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread jonas
Nikhil Verma wrote: How can i design this form field as well in models or What should be the type of this field both in models and forms such that weekdays remain dynamic(i can simply generate them from loop) and the user can fill the time  and when he hits submit it will get saved. I would c

Re: have an object available in every templates

2012-06-29 Thread bruno desthuilliers
On Thursday, June 28, 2012 5:53:46 PM UTC+2, Bastian wrote: > > Well, I was curious to see if it worked with a context processor so I > tried and indeed it works. After all it's only returning an object or list > of objects in a dictionary. Now I don't know which method is the most > efficient

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Sunny Nanda
One way to store such information can be like this: Create a model "Day". This will hold entries for each day i.e. from Monday till Sunday In the UserProfile model, create a ManyToMany relation to the above defined Day model through an intermediate table (say WorkingHours) which can hold the "fr

Re: settings and constants on a reusable app

2012-06-29 Thread Thomas Rega
Am 28.06.12 17:30, schrieb Marc Aymerich: Hi, I'm developing a reusable application and I'm having troubles with constant values on settings. Imagine that the reusable application comes with the following settings.py # MY_APP/settings.py from django.conf import settings MY_CONSTANT = 'C1' MY_OT

How to run a django app in a subdirectory alias

2012-06-29 Thread Sven Grunewaldt
Hi, I want to run a simple test project in a subdirectory alias on our development server. The basic setup is an nginx with a location that passes everything in a subdirectory to the wsgi application. Django obviously does not understand that it runs in an subdirectory alias, which completely

Re: settings and constants on a reusable app

2012-06-29 Thread Marc Aymerich
On Fri, Jun 29, 2012 at 11:08 AM, Thomas Rega wrote: > Am 28.06.12 17:30, schrieb Marc Aymerich: > >> Hi, >> I'm developing a reusable application and I'm having troubles with >> constant values on settings. >> >> Imagine that the reusable application comes with the following settings.py >> >> # M

Django CMS 2.3 Released!

2012-06-29 Thread Jonas Obrist
Today I am very excited that we just released Django CMS 2.3, with Django 1.4 support. You can read the release notes at Django at http://bit.ly/django-cms-23. Best regards, Jonas 'ojii' Obrist -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: how to manage range of hours in models and forms in django1.4

2012-06-29 Thread Nikhil Verma
Thanks for the help guys. On Fri, Jun 29, 2012 at 11:37 AM, Sunny Nanda wrote: > One way to store such information can be like this: > Create a model "Day". This will hold entries for each day i.e. from Monday > till Sunday > In the UserProfile model, create a ManyToMany relation to the above >

Redirect question

2012-06-29 Thread ivanb
I'm still learning django so please forgive if I write anything silly. On my site I'm having something like: on url mysite/list/ I have list of something. On it I have link that leads to another view if you want to add new element to it let's say: mysite/list/add_item/ On that url I have form

Re: Redirect question

2012-06-29 Thread Daniel Roseman
On Friday, 29 June 2012 15:45:16 UTC+1, ivanb wrote: > > I'm still learning django so please forgive if I write anything silly. > > On my site I'm having something like: on url mysite/list/ I have list of > something. On it I have link that leads to another view if you want to add > new element t

Re: Redirect question

2012-06-29 Thread Kurtis Mullins
> > [...] Also I would like you to point out if I did something here that could have > been done in better way so I can do it right and learn for the future. If you're using Class Based Views, you can use a mixin to achieve this. Here's mine if you want to check it out: http://stackoverflow.com/

Re: have an object available in every templates

2012-06-29 Thread Bastian
Good point, thanks for your input. On Friday, June 29, 2012 12:51:09 PM UTC+2, bruno desthuilliers wrote: > > > > On Thursday, June 28, 2012 5:53:46 PM UTC+2, Bastian wrote: >> >> Well, I was curious to see if it worked with a context processor so I >> tried and indeed it works. After all it's on

am new to use forms in django..

2012-06-29 Thread rick
i dont knw where to make a form...right now i am making form in model.py ,with the name Student_loginForm class..and when i make a template to run on servererror comes is TypeError at /record_system/studentid 'DeclarativeFieldsMetaclass' object is not iterable thanks in advance.

Re: Affordable Django hosting solution in India/around?

2012-06-29 Thread Bjarni Rúnar Einarsson
On Tue, Jun 26, 2012 at 4:56 AM, Kartik Singhal wrote: > > If nothing else works out our last option will be to host in college > servers, but that involves additional headache being unreliable. Out of curiosity, what is it that makes your college servers unreliable? Poor networks or power fluct

Re: am new to use forms in django..

2012-06-29 Thread manish girdhar
On Sat, Jun 30, 2012 at 12:09 AM, rick wrote: > i dont knw where to make a form...right now i am making form in model.py > ,with the name Student_loginForm class..and when i make a template to > run on servererror comes is > > TypeError at /record_system/studentid > > 'DeclarativeFiel

javascript in django template not executed when request is sent via ajax

2012-06-29 Thread Larry Martell
I have a django template that has some javascript/jQuery code in it that defines some keyup event handers. If a user goes to the URL directly the javascript is executed, and the event handers all work fine. There is also a field that they can type in that triggers the same URL request to be sent vi

Re: Django CMS 2.3 Released!

2012-06-29 Thread Kurdy
Installed 2.3rc2 this afternoon. Happily surprised by new release. Upgraded to django1.4 and cms2.3. I'm only still struggling with django-filer. What would be the advise? Is a new version of filer expected soon? Or is the development-version enough for production? Thanks for all the nice work.

Re: Render time

2012-06-29 Thread Larry Martell
On Mon, Jun 25, 2012 at 9:04 PM, Andy McKay wrote: >> Now they want me to add to that how long >> the browser takes to render the page after it gets the data. > > You can use the navigation timing API: > > https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html > > We use

Re: Render time

2012-06-29 Thread John
Look at Boomerang: http://lognormal.github.com/boomerang/doc/ John On 25/06/12 12:34, Larry Martell wrote: > This is not strictly a django question, but I'm hoping someone here > has solved this and can help me. I have a client that has a django app > that collects a bunch of server side statist

Re: javascript in django template not executed when request is sent via ajax

2012-06-29 Thread Jani Tiainen
It's known limitation of your ajax request and has nothing to do with Django nor templates. Or well it might do. Most of the javascript frameworks can extract script and inject it correctly to current DOM. Since you mention jquery I guess that you're using that for ajax queries so make sure that y

Re: javascript in django template not executed when request is sent via ajax

2012-06-29 Thread Jani Tiainen
I meant that if for some reason Django sends incorrect content type from a view or something like that your javascript framework might guess incorrectly your ajax request content type and not parse script tags. On Sat, Jun 30, 2012 at 1:51 AM, Jani Tiainen wrote: > It's known limitation of your

Re: javascript in django template not executed when request is sent via ajax

2012-06-29 Thread Larry Martell
On Fri, Jun 29, 2012 at 4:51 PM, Jani Tiainen wrote: > It's known limitation of your ajax request and has nothing to do with Django > nor templates. Or well it might do. Not really sure what you mean here. Are you saying this is a known problem, and I should not expect it to work? > Most of the

Re: javascript in django template not executed when request is sent via ajax

2012-06-29 Thread Larry Martell
On Fri, Jun 29, 2012 at 4:54 PM, Jani Tiainen wrote: > I meant that if for some reason Django sends incorrect content type from a > view or something like that your javascript framework might guess > incorrectly your ajax request content type and not parse script tags. Is there a way I can test t

advantages and disadvantages of Raw sql queries in django

2012-06-29 Thread vijay shanker
hi i want to know pros and cons associated with running raw sql queries over django's ORM . googled it out but couldn find many useful links. -- 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@googl

Re: advantages and disadvantages of Raw sql queries in django

2012-06-29 Thread Mike Dewhirst
I firmly believe in using the ORM for everything until i am forced to use handwritten SQL. The main reason is transparency of intentions when the source is examined by a non-DBA. I want my code to be maintainable by other people and provably correct. I suppose you can unit-test code with

Re: 'CSRF verification failed." from django.contrib.comments. can you help solve it? django 1.3

2012-06-29 Thread brycenesbitt
The "security_hash" field that you see is part of the comments app, and is > not the CSRF token. That needs to be output by a {% csrf_token %} tag (or > its equivalent). If it's working, you should see another hidden input > field, which looks like this: > > > value="36d43c1652d5676d6d41

Re: 'CSRF verification failed." from django.contrib.comments. can you help solve it? django 1.3

2012-06-29 Thread brycenesbitt
On Thursday, June 28, 2012 10:43:58 AM UTC-7, jonas wrote: > > After the starting form tag add {% csrf_token %} > I can't. It is rendered for me by {% render_comment_form for entry %} -- You received this message because you are subscribed to the Google Groups "Django users" group. To view thi

Re: advantages and disadvantages of Raw sql queries in django

2012-06-29 Thread Jon Black
Also, using ORM means you're less likely to be tied to a specific database...or in other words, your hand-crafted SQL is likely to be specific to certain databases. On 06/30/2012 08:33 AM, Mike Dewhirst wrote: > I firmly believe in using the ORM for everything until i am forced to > use handwritte