Starting a Django Project the Right Way

2012-07-26 Thread Frankline
Hi all, I found this on the internet and thought I should share it. http://www.jeffknupp.com/blog/2012/02/09/starting-a-django-project-the-right-way/ By the end of it all, you should have: 1. A fully functional Django project 2. All resources under source control (with git) 3. An environment in

Re: Models: Referencing A Model In Another App and Different Project

2012-07-26 Thread JJ Zolper
You are probably right to be honest. I might be overdoing it with seperating things apart. I guess sometimes I'm too efficient! Here's some more to chew on though: I also want to point out the reason why I am trying to bring one model into another. MadTrak/ manage.py MadTrak/

Add a form to admin side

2012-07-26 Thread TRAN PHONG PHU
I need to create a form to admin-side with two fields 1. Number of code: integer 2. Value of code: float How can I do that. This form is not related to any model. Thank you so much. -- You received this message because you are subscribed to the Google Groups "Django users" group. To v

The idle process does not destroy when request finished

2012-07-26 Thread DanYun Liu
As the visit user is growing fast, I switch the method=threaded to method=prefork to handle more quest. But the service then become not available sometimes, I found that one or two processes were created every minute and the old ones still here with CPU usage 0%, idled. I don't have any idea whe

"Django Django" - a band for the next DjangoCon?

2012-07-26 Thread Dave Lampton
We missed them for this upcoming conference, but we gotta get these guys for the next one, you know, some evening entertainment. :) Check them out. They're actually pretty good. http://www.djangodjango.co.uk/ http://twitter.com/thedjangos http://soundcloud.com/djangodjango -- Dave Lampton htt

Re: ignore field during form validation

2012-07-26 Thread Zoltan Szalai
In the end I came up with a solution which seems a bit hacky but does exactly what I want. It looks like this: def clean(self): cleaned_data = super(Form, self).clean() check = cleaned_data.get("check", None) # ignore 'len' when 'check' is False if not checkand "len" in self._errors:

Re: html compress advice

2012-07-26 Thread Phil
ah, thank you. I'll take a look now. On Thursday, July 26, 2012 10:34:49 PM UTC+1, mhulse wrote: > > Hi, > > > Just looking for some advice/ wisdom really. > > While not a direct answer to your question, there was a discussion on > the group recently on the topic of the spaceless tag: > > "{%

Re: html compress advice

2012-07-26 Thread Micky Hulse
Hi, On Thu, Jul 26, 2012 at 2:29 PM, Phil wrote: > Just looking for some advice/ wisdom really. While not a direct answer to your question, there was a discussion on the group recently on the topic of the spaceless tag: "{% spaceless %} abuse (?)"

html compress advice

2012-07-26 Thread Phil
Hi, Just looking for some advice/ wisdom really. I have compressed my css/js files and am now looking to strip all the white space from the html in the templates to help speed things up as much as possible. Is putting my hole base.html file between django's "spaceless" template tag an ok way o

Re: newbie URL problem

2012-07-26 Thread Felipe Sitta
I did what you said and put an third parameter on the track view and it worked. I think it's not an good practice, because is maintaining useless data, but for now its ok, at least the listing is done :D I still have to learn to use those regular expressions, its kinda tricky =/ Anyway, thanks

Re: Prefetch related data when using raw()

2012-07-26 Thread akaariai
On 26 heinä, 19:12, Sencha wrote: > I want to prefetch related data (ideally through the > prefetch_related()method), however I need to use the > raw() mapper method that will map a custom query (complicated table joins > to filter my query properly) to my model. However when I try this I get: >

Re: form.save() fails silently - how to debug?

2012-07-26 Thread Jirka Vejrazka
Sorry, I should have read your code before answering. I'm struggling to understand what you do in your clean() method. Are you sure you're returning the right set of data? Jirka -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: form.save() fails silently - how to debug?

2012-07-26 Thread Jirka Vejrazka
> Thank you for the suggestion, but unfortunately that too does not work. > > I really need to find a way to get at the source of the problem; I would > think an error message should be generated but none shows up... Are you doing some magic in model's save() by any chance? Jirka -- You recei

Re: form.save() fails silently - how to debug?

2012-07-26 Thread Derek
Thank you for the suggestion, but unfortunately that too does not work. I really need to find a way to get at the source of the problem; I would think an error message should be generated but none shows up... On Thursday, July 26, 2012 9:47:00 AM UTC+2, Karl Sutt wrote: > > I think > >> result

Prefetch related data when using raw()

2012-07-26 Thread Sencha
I want to prefetch related data (ideally through the prefetch_related()method), however I need to use the raw() mapper method that will map a custom query (complicated table joins to filter my query properly) to my model. However when I try this I get: AttributeError: 'RawQuerySet' object has n

Re: ignore field during form validation

2012-07-26 Thread Kurtis Mullins
You could remove "required=True" from 'len' and override clean() to perform a multiple-field validation. (pretty much what Thomas mentioned) len() will execute -- it will check to see if it's an integer. If you just want to completely ignore it, then do exactly as Thomas said, override. But you'll

Re: ignore field during form validation

2012-07-26 Thread Zoltan Szalai
On 2012.07.26. 17:44, Tomas Neme wrote: class Form(forms.Form): check = forms.BooleanField( required=False, ) # take into account only when 'check' is True len = forms.IntegerField( min_value=3, max_value=5, required=True, ) What I w

Re: ignore field during form validation

2012-07-26 Thread Tomas Neme
> class Form(forms.Form): > > check = forms.BooleanField( > required=False, > ) > # take into account only when 'check' is True > len = forms.IntegerField( > min_value=3, > max_value=5, > required=True, > ) > > > What I want is to validate the 'le

ignore field during form validation

2012-07-26 Thread Zoltan Szalai
Hi all, Let's assume i have to the following simple form: class Form(forms.Form): check = forms.BooleanField( required=False, ) # take into account only when 'check' is True len = forms.IntegerField( min_value=3, max_value=5, required=True, )

Re: 'QuerySet' object has no attribute '_meta' ... but I'm not using a QuerySet!

2012-07-26 Thread Tomas Neme
The ArtworkForm AND the full view code would be helpful, yes also, maybe you'll want to install django-extensions, werkzeug, and run your devserver with runserver_plus, that'll give you full debugging capabilities on your browser, and will be able to see what's each object (that instace object, sp

Url regex keeps django busy/crashing

2012-07-26 Thread Joe
Hey, I have a url regex like this which is keeping django extremely busy (20secs to 1min to handle a request). On some urls it even crashes. my regex: url(r'^(?P(\w+-?)*)/$', 'detail'), view: def detail(request, item_url): i = get_object_or_404(Page, url=item_url,published=True) return

Re: Automated updating of data across staging and production environments?

2012-07-26 Thread Victor Rocha
I partly agree with the above question. It's a solution, but you usually never want to use your production database on a development server. As for his problem, I would look into fabric. You can easily write a function that dumps data from one database and into another. On Thursday, July 26,

Re: Automated updating of data across staging and production environments?

2012-07-26 Thread Kevin Daum
Sithembewena, Have you considered using the same database for staging and production? Then the problem would be solved by purging the old test data they no longer want, which I think would be much easier than partial, conditional synchronization. Kevin On Thursday, July 26, 2012 6:10:33 AM UT

RE: Models: Referencing A Model In Another App and Different Project

2012-07-26 Thread michael.pimmer.ext
I'm not sure whether there is a good solution for this problem with the prerequisites you mentioned. Just because you import onde model doesn't mean you have full access to the underlying database of another project. If nobody comes up with a better idea (I never tried something similar), here is

Re: newbie URL problem

2012-07-26 Thread Karen Tracey
On Thu, Jul 26, 2012 at 8:32 AM, Karen Tracey wrote: > On Thu, Jul 26, 2012 at 12:20 AM, Felipe Sitta wrote: > >> >> I messed up with the code and figured that the problem is with the urls >> patterns. Here are the codes: >> >> the url patterns from urls.py >> url(r'^Track List/(?P(.*)\w+)/$'

Re: newbie URL problem

2012-07-26 Thread Karen Tracey
On Thu, Jul 26, 2012 at 12:20 AM, Felipe Sitta wrote: > I'm new to programming and I'm designing an demo website to get used to > django, web and database stuff. It's about racetracks. > > The structure is the following: > There's a menu with a link "Track List", it leads to a page with an > coun

Re: newbie URL problem

2012-07-26 Thread Daniel Roseman
On Thursday, 26 July 2012 05:20:34 UTC+1, Felipe Sitta wrote: > > I'm new to programming and I'm designing an demo website to get used to > django, web and database stuff. It's about racetracks. > > The structure is the following: > There's a menu with a link "Track List", it leads to a page with

Re: Prevent direct access to some URLs

2012-07-26 Thread Blaxton
I just figured the solution is using @login_required decorator. Thanks From: Blaxton To: "django-users@googlegroups.com" Sent: Wednesday, July 25, 2012 10:42:31 PM Subject: Prevent direct access to some URLs Hi I have set up a login page, using "django.co

newbie URL problem

2012-07-26 Thread Felipe Sitta
I'm new to programming and I'm designing an demo website to get used to django, web and database stuff. It's about racetracks. The structure is the following: There's a menu with a link "Track List", it leads to a page with an country list each one as a link. Each link leads to an list with the

Re: render a models slug field as a url

2012-07-26 Thread Matthew Meyer
That was it, it is working now. Thank you so much Daniel! :) On Thursday, July 26, 2012 4:25:10 AM UTC-4, Daniel Roseman wrote: > > On Thursday, 26 July 2012 03:45:41 UTC+1, Matthew Meyer wrote: >> >> HI daniel, thanks for the reply >> >> After your comments, I have used ModelForm to simplify my c

Automated updating of data across staging and production environments?

2012-07-26 Thread Sithembewena Lloyd Dube
Hi all, We have an Ubuntu Linux server which is running virtual environments (one for staging, one for prod.). Our clients test their sites on the staging environment and then proceed to capture the same data on the live sites. They want to be able to, at the click of a button, migrate only the la

Re: Overriding save to create and save related entity

2012-07-26 Thread Sithembewena Lloyd Dube
Thanks guys :) On Wed, Jul 25, 2012 at 6:49 PM, Mattias Linnap wrote: > It is possible to override the save() method in a model to add > functionality: > > https://docs.djangoproject.com/en/dev/topics/db/models/#overriding-model-methods > > Another choice would be to register a receiver for the

Re: render a models slug field as a url

2012-07-26 Thread Daniel Roseman
On Thursday, 26 July 2012 03:45:41 UTC+1, Matthew Meyer wrote: > > HI daniel, thanks for the reply > > After your comments, I have used ModelForm to simplify my code. I have > also achieved redirecting the desired url by using the redirect() function. > My issues are still basically the same howe

Re: form.save() fails silently - how to debug?

2012-07-26 Thread Karl Sutt
I think > results = formset.save(commit=False) > formset.save() should be > results = formset.save(commit=False) > results.save() Tervitades/Regards Karl Sutt On Thu, Jul 26, 2012 at 10:35 AM, Derek wrote: > I'd appreciate some help with the following problem, under Django 1.4 > > When run

form.save() fails silently - how to debug?

2012-07-26 Thread Derek
I'd appreciate some help with the following problem, under Django 1.4 When running with the models, forms and view as described below, the data from the form is *not* saved into the model. However, when using the test code (shown at the end) in a shell environment, the data *is* saved as expected