Re: If logged in show X, if not Y

2010-11-28 Thread Andre Terra
I think a more elegant approach would be to have a main template with {%
block some_name_for_the_part_that_changes %}, and have two different
template (logged_in.html and not_logged_in.html) that both extend said block
in 'main.html'.

Then, as Xavier suggested, move the "if user is authenticated" part to the
view:

if is authenticated:
  render logged_in.html
else:
  render not_logged_in.html


Regards,
Andre Terra

On Sun, Nov 28, 2010 at 22:50, robos85  wrote:

> Hi,
> I've read about {% if user.is_authenticated %} and m template is going
> to have the same structure, but some block will have different content
> for logged users. Additionally there will by some more buttons.
> I wondered if there's some other way to divide it.
> By no I have that plan:
> define 1 mainframe template. In it I'll include some sub-templates. In
> that sub-templates I'll make {% if user.is_authenticated %} and
> include the destination template or do the stuff.
>
> Is this plan ok?
>
> On 29 Lis, 01:27, Xavier Ordoquy  wrote:
> > Hi,
> >
> > You may want to look at the authentication contrib application that comes
> with Django.
> > Esp here:http://docs.djangoproject.com/en/1.2/topics/auth/#id7
> >
> > Another solution if you intend to have totally different templates would
> be to check within the view the user state and render a different template.
> >
> > Regards,
> > Xavier.
> >
> > Le 29 nov. 2010 à 00:53, robos85 a écrit :
> >
> >
> >
> >
> >
> >
> >
> > > I managed to make register and login on my site. Now I want to divide
> > > my template to parts for loggen and not logged user.
> > > What is the best way to check and display template parts for this? For
> > > example if user is not logged in: show login form but if he is logged
> > > in - in the same place show him his avatar.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Django admin photo upload

2010-11-29 Thread Andre Terra
For anyone else who's interested, I've heard great things about
sorl-thumbnail too, haven't used it myself.

I hope all is fine with easy_thumbnail.


Regards,
Andre Terra

On Mon, Nov 29, 2010 at 10:39, Sithembewena Lloyd Dube wrote:

> @Kenneth, thanks again. easy_thumbnail cuts it just fine.
>
> Regards,
> Lloyd
>
>
> On Mon, Nov 29, 2010 at 1:01 PM, Sithembewena Lloyd Dube <
> zebr...@gmail.com> wrote:
>
>> @ Venkatraman, and @kenneth - thanks gentlemen. I am trying out
>> easy_thumbnail as it looks light enough for my needs. django-photologue
>> looks great too, although I suspect it is a much more full-fledged solution?
>> I will look at it if need be.
>>
>> Regards,
>> Lloyd
>>
>>
>> On Mon, Nov 29, 2010 at 12:15 PM, Venkatraman S wrote:
>>
>>>
>>> On Mon, Nov 29, 2010 at 3:37 PM, Kenneth Gonsalves wrote:
>>>
>>>> On Mon, 2010-11-29 at 15:24 +0530, Venkatraman S wrote:
>>>> > Have a look at django-photologue.
>>>>
>>>> is it still maintained?
>>>>
>>>
>>> Not sure. But the code is a good one to start off for the OP and get some
>>> ideas on
>>> how images and thumbnails can be handled..
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-us...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>
>>
>> --
>> Regards,
>> Sithembewena Lloyd Dube
>> http://www.lloyddube.com
>>
>
>
>
> --
> Regards,
> Sithembewena Lloyd Dube
> http://www.lloyddube.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: django to php

2010-11-30 Thread Andre Terra
Because he can't drive stick.



Regards,
Andre Terra

On Tue, Nov 30, 2010 at 16:53, CLIFFORD ILKAY wrote:

> On 11/30/2010 02:26 AM, Akash Mukherjee wrote:
>
>> Hello,
>>
>> I have a webapp created in django. Now I want to convert the entire
>> code into PHP. Is it possible?? If yes, how?
>>
>
> I have a Porsche that I'd like to trade for an ox cart. Any takers?
> Seriously, why would you want to do that?
> --
> Regards,
>
> Clifford Ilkay
> Dinamis
> 1419-3266 Yonge St.
> Toronto, ON
> Canada  M4N 3P6
>
> <http://dinamis.com>
> +1 416-410-3326
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: missing object in object_list generic view

2010-11-30 Thread Andre Terra
Start by reading
http://www.b-list.org/weblog/2006/nov/16/django-tips-get-most-out-generic-views/
and
finish by writing one (or many!) wrapper function(s) as suggested.

It will make your code 1) readable, 2) easier to debug, 3) extensible, 4)
powerful, and 5) DRY.


Cheers,
Andre Terra

On Tue, Nov 30, 2010 at 17:20, Carlos Aboim  wrote:

> It's very strange, got this:
> urls
> info_dict = {
>'Queryset': Obra.objects.all (),
>}
>
> (r'index / $ ',' django.views.generic.list_detail.object_list ',
> info_dict, dict (name = "obras_index", template_object_name = 'obras',
> paginate_by = 5)),
>
> template
> [...]
> {% For book in the works%}
>  obra.numero {{}} ## example
> [...]
>
> and what appears in place of the list of objects paged out of 5 in 5,
> is
> "Page of"
>
> I'm missing the queryset variable somehow
>
> What can I do to solve the problem
>
> thank you
> Aboim
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Error in ajax request

2010-11-30 Thread Andre Terra
Noob question here: why would it need limit=5 if the funcion has default
values?


Best regards,
Andre Terra

On Mon, Nov 29, 2010 at 20:17, Daniel Roseman  wrote:

> On Nov 29, 8:28 pm, James Matthews  wrote:
> > Hi,
> >
> > When I use this rate limiterhttp://
> www.levigross.com/post/1721427025/django-rate-limitingand preform an
> > ajax request I get this error
> >
> > django/middleware/common.py", line 84, in process_response
> > if response.status_code == 404:
> > AttributeError: 'function' object has no attribute 'status_code'
> >
> > [CODE]
> > @ratelimit
> > @never_cache
> > def ajaxrequester(request):
> > if request.is_ajax():
> > stuff = submitform(request.POST)
> > return HttpResponse("{'ok':200}",content_type="text/xml")
> > else:
> > return HttpResponseForbidden("You don't belong here")
> > [/CODE]
> >
> > Any thoughts?
>
> It looks like that is a callable decorator - it is intended to be
> called immediately, with arguments:
>
> @ratelimit(limit=5)
>   ...etc...
>
> You can tell it's meant to be used like this because of the extra
> level of nested functions: normal decorators just return a function
> (which calls the decorated function), but callable decorators return a
> function (the actual decorator) which itself returns a function.
>
> (Actually I'm not sure that 'callable decorator' is the right term
> here, but I can't think of a better one. Is there a canonical name for
> this sort of thing?)
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Unresolved import in Eclipse

2010-12-01 Thread Andre Terra
You could also try using Aptana Studio, which is imho better than Eclipse
for django development. They're very similar, but it's more refined.

http://www.aptana.com/products/studio3

<http://www.aptana.com/products/studio3>Mind you, I've never used it as a
plugin, just the standalone version.


Sincerely,

Andre Terra



On Wed, Dec 1, 2010 at 21:51, cootetom  wrote:

> I take it you're using PyDev with eclipse? My experience is that
> eclipse often says that it can't resolve an import but is wrong. Just
> remember an import will work if it is on your python path. When you
> run the django project from eclipse it will use the python path as
> well as the project directory to resolve imports. You can tell PyDev
> about paths that you're importing from so that it knows where to
> check. You do this for a project by clicking Project > Properties >
> PyDev - PYTHONPATH. You can then add paths to the list of source
> folders. I generally don't bother and tend to ignore eclipse's warning
> about unresolved imports. If the import is wrong then you'll know
> about it as soon as you try and run the website as it'll complain
> loudly!
>
>
>
>
> On Dec 1, 5:47 pm, cocolombo  wrote:
> > Hi everyone.
> >
> > I am using Eclipe 3.6.1 with Python 2.7 on Windows XP and my problem
> > is the following:
> >
> > 1) I have installed a module named : django-urlauth-0.1.1
> >
> > 2) In Eclipse, at the left of the line:
> >
> > from urlauth.util import wrap_url
> >
> > Eclipse qive a big red dot with the message : Unresolved import
> > wrap_url
> >
> > 3) But strangely If I open a shell window (django environnemnt window)
> > in Eclipse and type:
> >
> > >> from urlauth.util import wrap_url
> >
> > everything is fine and I can access the wrap_url function from the
> > shell window.
> >
> > Any Idea what is wrong. I am new to django and Eclipse so maybe this
> > is trivial stuff, sorry if this is the case.
> >
> > cclmb
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Error in ajax request

2010-12-02 Thread Andre Terra
Ah, gotcha. What was I thinking? It's pretty obvious now :P

On Thu, Dec 2, 2010 at 21:37, pjrhar...@gmail.com wrote:

> On Dec 1, 2:43 am, Andre Terra  wrote:
> > Noob question here: why would it need limit=5 if the funcion has default
> > values?
>
> Even if it has a default value, you still need to call it to get your
> decorator. As someone wrote above, its a function that  returns a
> decorator, not actually a decorator. So you could just do @ratelimit()
> to use the defaults, but you need the brackets.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Pre-filled user info in Django Comments?

2010-12-10 Thread Andre Terra
>From my experience, adapting to
http://code.google.com/p/django-threadedcomments/ pays off. You said "the
site I'm *building*", and we all know it's definitely easier to explore
other possibilities early on.


Best regards,

Andre Terra (airstrike)

On Fri, Dec 10, 2010 at 14:12, Jeff  wrote:

> My site takes the route of hiding name, email, and URL fields for
> authenticated users.
>
> You can safely serve up a form without the name field for
> authenticated users since the comments framework will just copy over
> either the user's full name if it's set or their username if it isn't
> for the commenter's name.
>
> Things get a little dicey not displaying the email field since
> Django's commenting system by default requires an email address for
> all comments while the standard user management framework doesn't
> require users to specify their email address, so you'd need to figure
> out how to handle the case where the user hasn't set an email address
> yet (if the user has set an email address, then it should be copied
> over if the email field isn't displayed, otherwise the form will show
> an error page when the comment is submitted).
>
> Populating URLs will require extending the user management framework
> and the commenting system.
>
> Hope that helps!
>
> On Dec 9, 12:20 pm, Paolo  wrote:
> > Hi,
> >
> > The site I'm building uses the standard user management framework and
> > the standard comments framework.
> >
> > What I'd like to see happen is the comments form rendered with the
> > user's name and email address pre-filled if they are already signed in
> > (or have the fields hidden entirely!).
> >
> > Easy enough?
> >
> > Cheers,
> >
> > Paul
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Models inheritance in django: how to change PK "_ptr_id" on "id"?

2012-02-07 Thread Andre Terra
I just read your e-mail quick and somewhat carelessly, so forgive me if I'm
missing something.


Here's a list of things for you to check:

* Have you defined your Client model with abstract = True in its Meta
options?[1]
* Have you syncdb'd[2]?
* If you must name your pk something else, just follow the docs[3]

[1] http://django.me/abstract-base-classes
[2] http://django.me/syncdb
[3] http://django.me/automatic-primary-key-fields


Cheers,
AT


On Tue, Feb 7, 2012 at 4:26 PM, Artyom Chernetzov wrote:

> Here is model structure: Client is User, Client can be corporate or person:
>
> class Client(User):
> #fields
>
> class ClientCorporate(Client):
> #fields
>
>
> class ClientPerson(Client):
> #fields
>
> And client can make orders:
>
> class Order(models.Model):
> client=models.ForeignKey(Client)
> #fields
>
> I try to create common orders list for any type of client, here is view:
>
> def orders_list(request):
> client=request.user.client
> return list_detail.object_list(request,
> queryset = client.order_set.all(),
> #templates ...
> )
>
> And it leads to an error:
>
> **DatabaseError while rendering: no such column: cabinets_order.client_id**
>
> I browse db and find that all User childs have column "user_prt_id". I
> can't find way to change pk name in inherited models. But maybe there is
> some better approach?
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/RrPQgVp3R2EJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Django Contract - London - Immediate Start - £250pd - £350pd

2012-02-27 Thread Andre Terra
Meanwhile, as you wait for answers, do check http://djangopeople.me/

Perhaps you could contact some locals directly and even schedule a couple
of interviews.


Cheers,
AT

On Mon, Feb 27, 2012 at 12:22 PM, Tim Abbott  wrote:

> Good Afternoon all,
>
> Firstly, sorry to use the group like this, however the company I am
> working with are one of my longest standing clients and I really want to
> make sure they get the right calibre person. I have been recommended to
> this user group by a friend of mine who is a Python freelancer.
>
> I need an experienced Django Developer to work a 6 week - 2 Month contract
> in London paying between £250pd up to £350pd. The company are a leading
> Marketing Digital Agency. This will be a frontend web development role with
> some CMS and Mobile CMS elements.
>
> As I said, this is really urgent and they need someone on site as soon as
> possible. I can give you a few more details over the phone, the best number
> to get me on is 01189 256 144 or outside normal hours it would be
> 07852232361.
>
> If you are available please can you send your CV to me by return email or
> email my work email address tim.abb...@zetman.com. Either is fine, I just
> need to find someone available!
>
> Thanks in advance
>
> Tim Abbott
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Post data Query Dict - Why not a list ?

2012-02-29 Thread Andre Terra
On Wed, Feb 29, 2012 at 5:46 AM, Szabo, Patrick (LNG-VIE) <
patrick.sz...@lexisnexis.at> wrote:

> Should I not get  lists ?
>
> ** **
>
> i.e:
>
> ** **
>
> [Monatsreport]
>
> [2,29,42]
>


I may be misunderstanding something, but for one reason lists are not
ordered, so you'd never know which item to get, agreed?


Cheers,
AT

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



Re: Post data Query Dict - Why not a list ?

2012-02-29 Thread Andre Terra
Excuse my brainfart moment.. sets and dicts are not ordered!

On Wed, Feb 29, 2012 at 11:32 AM, Tom Evans wrote:

> On Wed, Feb 29, 2012 at 1:46 PM, Andre Terra  wrote:
> > I may be misunderstanding something, but for one reason lists are not
> > ordered, so you'd never know which item to get, agreed?
> >
>
> Lists are ordered, I think you are confusing something :)
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Error while importing URLconf 'permitprint.urls': day is out of range for month

2012-02-29 Thread Andre Terra
use something like >>> d + datetime.timedelta(days=365)

http://docs.python.org/library/datetime.html#timedelta-objects


Cheers,
AT

On Wed, Feb 29, 2012 at 12:59 PM, furby  wrote:

> Caught it.  Haha.  What a funny bug.  From models.py:
>
> 196 d = dt.datetime.today()
> 197 expires = d.replace(year=d.year+1)
>
> There is no Feb. 29th, 2013.  So this breaks.  Thx for the help!
>
> On Feb 29, 9:50 am, Tom Evans  wrote:
> > On Wed, Feb 29, 2012 at 3:33 PM, furby  wrote:
> > > The guy I built this for does not want to pay me to maintain it, so
> > > it's still on .96.  And yet when something breaks randomly he wonders
> > > why.  Debug enabled today for debugging.  There is no dev
> > > environment.  Only production for this.
> >
> > Customer is always right. Plus, job for life ;)
> >
> >
> >
> > > Here's the urlconf.  I've literally commented out every urlpattern
> > > expect the top one on line 4.  Still breaks:
> >
> > >  1 from django.conf.urls.defaults import *
> > >  2 from permitprint.app.models import *
> > >  3 urlpatterns = patterns('django.views.generic.simple',
> > >  4 (r'^/?$', 'direct_to_template', {'template': 'index.html'}),
> > >  5 """
> >
> > Hmmpf. One of the things improved since 0.96 is that error reporting
> > of this kind has improved. There is an import error coming from one of
> > the imports in the urlconf, and that is why it cannot import the
> > urlconf. Is there any date handling code in the top level of the
> > permitprint.app.models?
> >
> > Cheers
> >
> > Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: best resources for learning django

2012-03-02 Thread Andre Terra
First of all, welcome to Django!

If you're not familiar with python (and specially managing python
packages), I recommend you setup a sane development environment. Namely
using virtualenv and pip, and optionally mkvirtualenv (if you're not on
windows).

Having to figure out import errors is usually very a frustrating obstacle,
especially for newbies.



http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/
http://www.doughellmann.com/docs/virtualenvwrapper/


Cheers,
AT


On Fri, Mar 2, 2012 at 3:48 PM, Javier Guerra Giraldez
wrote:

> On Fri, Mar 2, 2012 at 1:23 PM, gowtham  wrote:
> > Not sure if it is the best one (would like to here from Pros on this).
> But
> > following really helped me to get started. I  finishing this tutorial in
> 2
> > days and the next two days, i started and had a working application
> (simple
> > though) for my project..
> >
> > https://docs.djangoproject.com/en/1.2/intro/tutorial01/
>
>
> even if you find any other 'better' source, the tutorials are a
> necessary prerequisite.  there are lots of times where a newcomer asks
> something in the list and even if the answer might not be in the
> tutorials themselves, not doing them leads to a big obstacle to
> communication.
>
> for me, the best order is:
>
> - the tutorials (all of them, even if they're not related to your needs)
> - ask a little in the list.
> - read other sections in the documentation.
> - read the Django Book.  even if it's a little dated, the concepts stay
> valid.
> - ask a little more on the list
> - read the whole docs.
> - start answering on the list!  yes, that helps learning too
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Using django and virtualenv on Mac OS X. (WAS: Getting Started with Mac OS X)

2012-03-07 Thread Andre Terra
You should use pip and virtualenv to create a sane development environment.

This guide [1] is originally aimed at ubuntu/linux, but I think you can
probably follow in mac os x as well. I've also listed a few other links
with instructions that look alright, but that I haven't tested.

Basically, don't "ln -s". Use virtualenv instead.

Quote from one of the links:

*"On my systems, virtualenv, virtualenvwrapper, and Mercurial are the only
Python packages that are always available — every other package is confined
to its virtual environment."*

While you might prefer something other than mercurial, the point still
stands. Add only the bare minimum to the system-wide install and everything
else to virtualenvs instead.



Cheers,
AT

[1]
http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/


http://www.arthurkoziel.com/2008/10/22/working-virtualenv/
http://hackercodex.com/2011/08/30/python-install-django-on-mac-osx-lion-10.7/
http://www.djangoapp.com/blog/2011/07/25/django-installation-on-mac-os-x-lion/




On Wed, Mar 7, 2012 at 2:31 PM, Clark Corey  wrote:

> I am typing mine into a shell promptI posted the thread, but I don't
> know that it has posted yet...here it is:
>
> After installing Django I am attempting to start a new project.  After
> creating a directory for this, I tried using the command: "django-
> admin.py startproject mysite".
>
> but I'm getting the message "-bash: django-admin.py: command not found".
>
> So, I've tried running this:
>
> "sudo ln -s library/python/2.6/site-packages/django/bin/django-admin.py
> /usr/local/bin/django-admin.py" in which i get "file exists"
> and I still get the same problem when running the startproject.
>
> Only other piece of info is that during installation I had a "error:
> /usr/local/bin/django-admin.py: No such file or directory".  But I can
> cd into that directory and see the django-admin.py file.
>
> Thanks!
>
> -Clark
>
>
>
> On Wed, Mar 7, 2012 at 7:54 AM, Tom Evans wrote:
>
>> On Wed, Mar 7, 2012 at 2:43 PM, Clark  wrote:
>> > I am having a similar issue, so I tried the $ pip uninstall django,
>> > but I got a "IOError: [Errno 13] Permission denied"
>> >
>> > Advice?
>> >
>> > Thanks.
>> >
>>
>> You should have started a new thread for your new error. The error
>> here was that the new user was typing shell commands into a python
>> prompt - is that what you are doing?
>>
>> The error that you have shown means that pip tried to access (read or
>> delete) a file to which it did not have access. That could happen for
>> any number of reasons, but most likely you installed django as root
>> and are trying to uninstall it as a regular user.
>>
>> Of course, that is just speculation, as you have not shown what
>> happened, or what your original error was that made you think "I know,
>> a reinstall of Django will fix everything".
>>
>> Cheers
>>
>> Tom
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Problems getting started

2012-03-07 Thread Andre Terra
On Wed, Mar 7, 2012 at 2:53 PM, Sandro Dutra  wrote:

> I don't know how it's works on a Linux box, but on Windows we've to put
> Python/Scripts on PATH variable to use the command directly.



Or you can use virtualenv like I mentioned in the other thread.


Cheers,
AT

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



Re: User permission

2012-03-07 Thread Andre Terra
What I do:

1) Control user rights in views, always, no matter what.
2) Pass user perms to template so that you only display accessible,
permitted links.


Cheers,
AT

On Wed, Mar 7, 2012 at 2:10 PM, Xavier Pegenaute wrote:

> Hi,
>
> Which one is the best option?
>
> a- Control the user rights in the views
> b- Control the user rights in the templates
> c- Control the user rights in both locations
>
> I guess is (c), but it's too much work.
>
> Thanks,
> Regards.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

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



Re: Problems getting started

2012-03-07 Thread Andre Terra
Again, don't install as root, use virtualenv. This will save you headaches
in the future, and unless you have an inexcusable reason to have Django run
as root, you shouldn't.


Sincerely,
AT

On Wed, Mar 7, 2012 at 6:28 PM, backdoc  wrote:

> I think you might need to install as root or sudo.
>
> From memory.
>
> sudo python setup.py install
>
> Also, try executing "which django-admin.py" at the terminal.  That
> will tell you the location of the executable.  Basically, I'm curious
> if it will even find it, as I'm thinking it didn't install at all.  I
> just installed the 1.4 rc last night on Debian.  I didn't have any
> issues.
>
> On Mar 7, 8:36 am, Clark  wrote:
> > After installing Django I am attempting to start a new project.  After
> > creating a directory for this, I tried using the command: "django-
> > admin.py startproject mysite".
> >
> > but I'm getting the message "-bash: django-admin.py: command not found
> > ".
> >
> > So, I've tried running this:
> >
> > "sudo ln -s library/python/2.6/site-packages/django/bin/django-
> > admin.py /usr/local/bin/django-admin.py" in which i get "file exists"
> > and I still get the same problem when running the startproject.
> >
> > Only other piece of info is that during installation I had a "error: /
> > usr/local/bin/django-admin.py: No such file or directory".  But I can
> > cd into that directory and see the django-admin.py file.
> >
> > Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: django facebook api

2012-03-12 Thread Andre Terra
Suresh,

If you want to get any answers, you must first learn how to make the
questions.


Please follow the guidelines in this wiki article before posting to the
mailing list:
https://code.djangoproject.com/wiki/UsingTheMailingList


Cheers,
AT


On Thu, Mar 8, 2012 at 9:24 AM, suresh dokania wrote:

> Hi,
>
> I got my login working. Redirect uri was d problem. I created a redirect
> uri stormy-sunset in facebook using django
>
> I followed this link http://djangosnippets.org/snippets/2065/
>
> but  the problem is here are my requirements
> When i press the login button  n enter my username n password , i need to
> be redirected to a particular template in my localhost
> but its nt working with local uri
>
> second only for the account i ve created my app , its logging. when i try
> using another username and password it says requested user name and
> password cannot be used by facebook at the moment
> i want to use the details of the user logged in to build  a social graph
> using django
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: "Dynamyc" modells

2012-03-13 Thread Andre Terra
This is so not what Django was built to do...

I have a feeling that if you ever do manage to write it, it's going to be
slower than slow and error prone...


Sincerely,
AT


On Tue, Mar 13, 2012 at 4:59 AM, Ervin Hegedüs  wrote:

> hello,
>
> On Tue, Mar 13, 2012 at 09:38:34AM +0200, Jani Tiainen wrote:
>
> > Ultimate solution sounds more like using document oriented
> > databases, like CouchDB or MongoDB. (Just the few I happened to
> > remember).
>
> okay, lets look an another example: I have a model, which
> describes RDBMS connections: DBdesc, DBhost, DBuser, DBpassword,
> DBdbname, DBtable, DBkeycolumn, DBvalcolumn, and so on...
>
> Now I can filter() a row by DBdesc, which gives me de full
> description of DB connection - sometimes that DB exists on an
> external host. As I wrote my previous email, all data model in
> different data source have an intersect of columns, these columns
> are stored in my model.
>
> (Security is important, usually I used this through VPN's, and
> currently all stored connection has just select privilege - these
> are not sensitive datas of course.)
>
> After I get the DB desc, I use "row" SQL connection, eg. when DB
> is MySQL, I import the MySQLdb modul, create a mysql connection,
> a cursor...
>
> This is different from marketing agencies example, but I can use
> the "ultimate" solution at every cases.
>
>
> Thanks:
>
>
> a.
>
>
> --
> I � UTF-8
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: [bump] Preventing JOIN while checking if a self referencing FK is null

2012-03-21 Thread Andre Terra
On Wed, Mar 21, 2012 at 5:41 AM, diafygi  wrote:

> >>> Blog.objects.filter(editor=None)
>


>>> print Blog.objects.filter(editor=None).values('id').query
SELECT "myapp_blog"."id" FROM "myapp_blog" WHERE "myappblog"."editor_id" IS
NULL


Cheers,
AT

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



Re: where did I install Django

2012-03-21 Thread Andre Terra
How to have a sane python setup:

1. use pip and virtualenv[1]
2. ???
3. PROFIT!

Cheers,
AT

[1]
http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/




On Tue, Mar 20, 2012 at 8:30 PM, jdw  wrote:

> got it!  This one worked.  Thanks.
>
> On Tuesday, March 20, 2012 3:52:05 PM UTC-7, Furbee wrote:
>>
>> From an answer on stackoverflow.com (http://stackoverflow.com/**
>> questions/122327/how-do-i-**find-the-location-of-my-**
>> python-site-packages-directory
>> **):
>>
>> Enter python shell by executing python binary:
>>
>> from distutils.sysconfig import get_python_lib
>>
>>
>> print(get_python_lib())
>>
>>
>> It usually resides in a folder named site-packages or dist-packages
>> somewhere in the Python directory. In Windows it is different than in Unix.
>>
>> When all else fails, you can run a find command on Unix, or a do an
>> advanced search in Windows.
>>
>> On Tue, Mar 20, 2012 at 3:30 PM, jdw 
>> 
>> > wrote:
>>
>>> Newbie alert...
>>>
>>> I installed Django and finished the first tutorial.  On the second one,
>>> I could not log in to the website because  I didn't set a superuser.
>>> Ultimately, I figured out my problem, but I realized I have no idea where I
>>> installed Django.  Is there an easy way to find out where the code lives?
>>>
>>> I realized I had no idea when the tutorial suggested running this:
>>>
>>> python /path/to/django/contrib/auth/c**reate_superuser.py
>>>
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To view this discussion on the web visit https://groups.google.com/d/**
>>> msg/django-users/-/**9FZCBitFicMJ
>>> .
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to django-users+unsubscribe@*
>>> *googlegroups.com .
>>> For more options, visit this group at http://groups.google.com/**
>>> group/django-users?hl=en
>>> .
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/bHhVJmu5AJEJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Having all objects defined in Models.py editable in one admin page

2012-03-21 Thread Andre Terra
Try writing your own views rather than expanding the Admin. It's well worth
it in the long run!


Cheers,
AT

On Wed, Mar 21, 2012 at 1:50 PM, Sithembewena Lloyd Dube
wrote:

> Hi guys,
>
> I am building a learning application for a client. The problem we are
> experiencing is that of inlines. We have multiple related objects and the
> client wants to be able to edit all objects from one CRUD. Unfortunately,
> there seems to be no solution for multiple inlines in a Django admin.
> application. Is there a sensible way to address this problem?
> --
> Regards,
> Sithembewena Lloyd Dube
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Problem with Django starting up

2012-03-21 Thread Andre Terra
What I recommend is that you install pip and virtualenv, create a folder
(say, C:\virtual\) where you will place different python "environments" per
virtualenv, then create a folder (say, C:\projects) where you will create
different django projects.

This way you can always use virtualenv to "activate" different environments
and not need to install libraries system-wide.


Basically (blue commands are to be typed in the command prompt):
01. Go to http://pypi.python.org/pypi/pip#downloads
02. Download the archive, extract the contents to a given folder (you might
need 7-zip[1]).
03. Open the command prompt (Winkey+R, type in "cmd" with no quotes)
04. cd into the folder created by the extracted archive in step 02
05. python setup.py install
06. Make sure you have C:\Python27\Scripts in your PATH.
06.1. Do this by typing set PATH=C:\Python27\Scripts;%PATH% in the command
prompt
07. pip install virtualenv
08. mkdir c:\virtual && mkdir c:\projects
09. cd c:\virtual
10. virtualenv --no-site-packages myfirstenvironment (you can name this
after your project if you want to)
11. cd myfirstenvironment

*12. Activate your environment:
C:\virtual\myfirstenvironment\Scripts\activate.bat*

If you want the development version of Django:
13.A. pip install git+https://github.com/django/django.git#egg=django

If you want a stable release:
13.B. pip install django

14. Whenever you need to install a package, just do the same as in step #12
but type the package name instead of django. Don't forget to activate your
environment whenever you open a command prompt window and BEFORE you start
working on your project!


I think that about sums it up. Using this on linux is of course easier. I
hope I didn't miss any steps, but I'm sure others will correct me if I
forgot anything.


Cheers,
AT


[1] http://www.7-zip.org/download.html


On Wed, Mar 21, 2012 at 3:48 AM, Jani Tiainen  wrote:

> 21.3.2012 7:50, Samuel Muiruri kirjoitti:
>
>  I can't get the first part to work
>>
>>
> I assume that you have python installed to c:\python27\
>
> You need to add c:\python27\scripts to your path.
>
> Or alternatively:
>
> c:\python27\scripts\django-**admin.py startproject mysite
>
> --
>
> Jani Tiainen
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

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



Re: [bump] Preventing JOIN while checking if a self referencing FK is null

2012-03-21 Thread Andre Terra
Because django offers a nice ORM that makes it easy to do most queries,
especially one-liners like this one.

And refactoring raw SQL is a royal PITA.


Cheers,
AT

On Wed, Mar 21, 2012 at 3:14 PM, Python_Junkie <
software.buy.des...@gmail.com> wrote:

> Use straight sql.
>
> There are always potentially limitations with an abstraction such as the
> ORM.
>
> Why try to fit a square peg into a round whole.
>
>
> On Wednesday, March 21, 2012 4:41:32 AM UTC-4, diafygi wrote:
>>
>> There is an old thread that didn't end in a resolution about
>> preventing joins in a filter(foreign_key=None) scenario.
>>
>> http://groups.google.com/**group/django-users/browse_**
>> thread/thread/61ee2fb22deae326
>>
>> I'd like to bring it up again and ask if there is now a way to prevent
>> joins from a query.
>>
>> An example:
>> class Blog(model.Models):
>>editor = models.ForeignKey(User, null=True)
>>
>> # find all the blogs with no editors
>> >>> Blog.objects.filter(editor=**None)
>> DEBUG:django.db.backends:(0.**039) SELECT `myapp_blog`.`id` FROM
>> `myapp_blog` LEFT OUTER JOIN `myapp_user` ON (`myapp_blog`.`editor_id`
>> = `myapp_user`.`id`) WHERE `myapp_user`.`id` IS NULL;
>>
>> # Is there a way to do this query?
>> >>> Blog.objects.filter(editor=**None)
>> DEBUG:django.db.backends:(0.**039) SELECT `myapp_blog`.`id` FROM
>> `myapp_blog` WHERE `myapp_blog`.`editor_id` IS NULL;
>>
>> Thanks!
>> Daniel
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/NfvXnYxnHBkJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Preventing JOIN while checking if a self referencing FK is null

2012-03-21 Thread Andre Terra
Sorry. In the process of changing model names to fit my own installation
and test the code, I also managed to invert the relation.

Pay no attention to the man behind the curtains!

Cheers,
AT
On Mar 21, 2012 6:42 PM, "diafygi"  wrote:

> I cannot confirm that behavior. Can others verify?
>
> I'm using Django 1.3 and I get:
> >>> print Blog.objects.filter(editor=None).values('id').query
> SELECT `myapp_blog`.`id` FROM `myapp_blog` LEFT OUTER JOIN
> `myapp_user` ON (`myapp_blog`.`editor_id` = `myapp_user`.`id`) WHERE
> `myapp_user`.`id` IS NULL
>
> -Daniel
>
> On Mar 21, 2:07 pm, Andre Terra  wrote:
> > On Wed, Mar 21, 2012 at 5:41 AM, diafygi  wrote:
> > > >>> Blog.objects.filter(editor=None)
> >
> > >>> print Blog.objects.filter(editor=None).values('id').query
> >
> > SELECT "myapp_blog"."id" FROM "myapp_blog" WHERE "myappblog"."editor_id"
> IS
> > NULL
> >
> > Cheers,
> > AT
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: using forloop.counter to access data

2012-03-21 Thread Andre Terra
You could always try writing a custom template tag or filter as someone
else suggested earlier in the thread before resorting to JavaScript.

Cheers,
AT
On Mar 21, 2012 5:41 PM, "Larry Martell"  wrote:

> On Wed, Mar 21, 2012 at 12:52 PM, James  wrote:
> >
> >
> > On Wednesday, March 21, 2012 10:41:08 AM UTC-4, Larry@gmail.comwrote:
> >>
> >> On Wed, Mar 21, 2012 at 7:53 AM, James <> wrote:
> >> >
> >> >
> >> > On Wednesday, March 21, 2012 8:47:23 AM UTC-4, larry@gmail.com
> >> > wrote:
> >> >>
> >> >> This is probably a stupid newbie question 
> >> >>
> >> >> I want to access a column of data in a row using forloop.counter, but
> >> >> I cannot get it to work.
> >> >>
> >> >> In my test code, if I display {{ forloop.counter }} I get 2
> >> >> If I display {{ headers.0.2 }} I get ToolType
> >> >> But if I display {{ headers.0.forloop.counter }} I get nothing
> >> >>
> >> >> What is the proper syntax for this?
> >> >
> >> >
> >> > the forloop.counter and friends will simply give you information about
> >> > the
> >> > iteration, it won't give you any information about the data in the
> >> > queryset
> >>
> >> Yes, I realize that. I am using it withing a loop to try an access a
> >> specific item of data. The code I showed was just an example from one
> >> iteration of the loop.
> >>
> >> > (I'm assuming this is what you mean when you say column).
> >> >
> >> > Here are the
> >> >
> >> > docs
> https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#for
> >> >
> >> >  If you want to access the column of data, assuming it's referenced
> from
> >> > a
> >> > model, just the attribute of that model. If you passed in a list to
> the
> >> > template, you just use the django "dot" look-up syntax.
> >>
> >> Perhaps my question wasn't clear. I have a list called headers. From
> >> within a for loop I want the n'th item from the first row. In the loop
> >> I am trying to access {{ headers.0.forloop.counter }} but I get no
> >> value from that. But if I hard code the number (as a test), e.g.:  {{
> >> headers.0.2 }} then I do get the value.
> >
> >  With regards to your reply:
> >
> >
> >>  Yes, I realize that. I am using it withing a loop to try an access a
> >> specific item of data. The code I showed was just an example from one
> >> iteration of the loop.
> >
> >
> > You can't use forloop and friends in the manner you attempting to use it.
> > It's The reason is, headers.0 has no attribute named "forloop"
> >
> > The best that you could do here, in this situation, is to create a custom
> > filter and pass it forloop.counter as variable like so:
> > {{ headers.0|forloop.counter }} You will of course have to write that
> filter
> > out first, register it, and install it in the template.
> >
> > I'm still not sure if this is the right approach. Why not just iterate
> over
> > the list itself, if you want to print the nth item within the list?
>
> That would be really inefficient, as the table can have thousands of
> rows, with 30 columns each. I'd have to iterate through the header row
> for each column in each row to get the value to put into the href.
>
> > Or,
> > structure the list/queryset from the view such that you don't have to do
> > such acrobatics.
> >
> >>  But if I hard code the number (as a test), e.g.:  {{
> >> headers.0.2 }} then I do get the value.
> >
> >
> > This works because headers.0 has an attribute that works by way of the
> > django dot look up. See Tom Evan's post regarding this.
> >
> > It seems to me that you have a list of lists (and not a single list). In
> > which case, you can just iterate over the first list and iterate over the
> > second list. If you need some control flow, just use the standard if /
> else
> > conditions. But, maybe I'm missing something?
>
> Yes, I think you are. I have 2 header rows, and thousands of data
> rows. For each column in each data row I have to construct a href. One
> of the parameters in the href comes from the first header row. The
> header rows get processed first, then the data rows (to build the
> table). So by the time I am processing the data I don't have the
> header any more. I should probably just do this in javascript.
>
> > Even easier would be to use django's introspect feature and create models
> > based on the tables in the DB, query the DB using the models and create
> > querysets. Then you can access and display the data in a more
> > coherent manner.
> >
> > see the docs here for
> > introspection:
> https://docs.djangoproject.com/en/dev/howto/legacy-databases/?from=olddocs
>
>
> That already is the case. I am trying to add functionality to an existing
> app.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-u

Re: Is there a place for new Django specialized hosting?

2012-03-22 Thread Andre Terra
Forgive me if I sound pessimistic, I'm just a hobbyist developer offering
my most sincere 2 cents.

There are many services that offer similar features and sometimes even
more. From a business perspective, the only way to thrive in this market is
by having technology that provides competitive advantage and through
marketing aimed at receiving endorsement from trendsetters in the web
development field.

Google ep.io, gondor, apphosted, djangozoom, heroku,
cloudfoundry.com(built by a former Google/Microsoft engineer) and
others.

Considering these have already launched or at least reached beta stage,
you're off to a tough start if you do go through with the plan.

Cheers,
AT



On Mar 21, 2012 10:24 PM, "Martin Tiršel"  wrote:

> Hello,
>
> I am playing with an idea to create a hosting service specialized for
> Django. I would be glad if you can provide some feedback if you would use
> such service (or why not) and what monthly fee would you pay for this.
>
> This would be based on virtual servers without root access (only
> unprivileged shell access) with web based administration:
>
> * create so many webs you want (or resources allows)
> * separated webserver for media files/static content
> * virtualenv support, multiple python versions
> * SVN/Git
> * testing/production environment (clone production data to testing
> environment [app, media, database] -> export project from svn/git -> apply
> migrations -> test -> apply to production)
> * one click trac installation
> * integrated web based editor for some quick changes/fixes (
> http://ace.ajax.org/)
> * backup/restore
> * some tools that makes life easier like one click project initialization
> inside svn/git and prepared settings (so you don't need to create project,
> add it to repository and rewrite common settings), ...
> * basic support for Django
> * easy SSL certificate installation
> * and many others :)
>
> There could be two programs, for example 1GB RAM, 2 vCPU's, 30 GB HDD or
> 2GB RAM, 3 vCPU's, 50GB HDD
>
> My goal is to provide an environment for developers with multiple projects
> that wants virtual server but don't want/know to install/configure such
> virtual server. Or is there already a service like this?
>
> Thanks,
> Martin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

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



Re: ANNOUNCE: Django 1.4 released

2012-03-23 Thread Andre Terra
Hooray!

Congrats to everyone involved, especially all that worked on bringing
timezone support to this increasingly amazing web framework.

I don't mean to nitpick but a minor detail in the release notes requires
some attention:

"Django does not support Python 3.x at this time. At some point before the
release of Django 1.4, we plan to publish a document outlining our full
timeline for deprecating Python 2.x and moving to Python 3.x."

Have we got a timeline yet?

Cheers,
AT
On Mar 23, 2012 2:11 PM, "James Bennett"  wrote:

> Django 1.4 is finally here!
>
> For details, checkout the weblog:
>
> https://www.djangoproject.com/weblog/2012/mar/23/14/
>
> And the release notes:
>
> https://docs.djangoproject.com/en/dev/releases/1.4/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-develop...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>
>

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



Re: IE9+Django,Don't respond or Socket error!!!

2012-03-28 Thread Andre Terra
On Mon, Mar 26, 2012 at 11:31 PM, br  wrote:

> 2) If you want to use the runserver that comes with django:
> - to run runserver, use "manage.py runserver 0.0.0.0:8000" instead of
> the default (which goes to localhost or 127.0.0.1) , and then figure
> out your computer's IP address in your intranet (ivarious ways to do
> this, i use "ipconfig" from command line and pick the one that
> probably starts with 192.168).  Then when you want to access your app,
> do it at http://:8000
>


To make things easier, create a free host redirect on no-ip.org[1] and name
it something like 'mydjangoserver.no-ip.org', then install the No-IP
service for automatically updating the redirect to match your current IP
(on a defined interval, which I usually set for 30 mins). This way you can
always point to http://mydjangoserver.no-ip.org regardless of which network
you're currently on. Helps if you're on the go often, or if you've got a
dynamic IP (my original problem back when I started using it).


Cheers,
AT

[1] http://no-ip.org/

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



Re: is doing text manipulations in django's template faster than doing same in views

2012-03-29 Thread Andre Terra
If you're doing a lot of operations with your data, there's a chance it
should be moved to the view. The template should usually be restricted to
defining *how* data gets displayed, whereas the view defines *what* your
data is.


Cheers,
AT

On Thu, Mar 29, 2012 at 7:30 AM, vijay shanker wrote:

> which one is faster or considered better in terms of performance ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: How Admin can be able to configure Model fields

2012-03-29 Thread Andre Terra
Deepak,

Please read through this before posting again:

https://code.djangoproject.com/wiki/UsingTheMailingList


Cheers,
AT

On Thu, Mar 29, 2012 at 5:04 AM, Deepak RK  wrote:

> Admin can add another field in any model (lets say UserProfile ) and
> it should start appearing in registration form.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Looking for Django IDE

2012-04-02 Thread Andre Terra
OP, there are about a dozen threads regarding django and IDEs in the
mailing list. Please search the archive before asking the same question
again. Let's try not e-mail thousands of people needlessly!


Sincerely,
André Terra


2012/4/2 Sells, Fred 

> Thanks; actually I can use the nightly build for an IDE plugin so your
> response "saves the day".  I just cannot use it in software deployed in
> production.
>
> Thanks again,
>
> Fred.
>
> -Original Message-
> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
> On Behalf Of N.Aleksandrenko
> Sent: Monday, April 02, 2012 7:18 AM
> To: django-users@googlegroups.com
> Subject: Re: Looking for Django IDE
>
> sublime 2 + plugin for djando syntax
>
> 2012/4/2 Alexandros Karypidis :
> > This is a problem in PyDev, not Django.
> >
> > The fix is already committed in the PyDev repository and will be
> > released in PyDev 2.5.0:
> > http://sourceforge.net/tracker/?func=detail&aid=3512322&group_id=85796
> > &atid=577329
> >
> > If you can't wait until PyDev 2.5.0, the only solution is to use a
> > nightly build.
> >
> > You should explain to your "management" that they should get out of
> > your way and let you do your job.
> >
> >
> > On 2/4/2012 7:17 πμ, Sells, Fred wrote:
> >>
> >> Is there a Django 1.4.1 in the works that would solve this problem?
> >> I also use Eclipse+PyDev and am planning to upgrade to Django 1.4
> shortly.
> >> However my management is not going to allow using a nightly build in
> >> a production system regardless of the justification.  I guess my
> >> options are to stick with 1.3 or create a dummy project manually and
> >> copy and tweak it whenever I need a new project.  Any suggestions.
> >>
> >> > From the forum post, it was not clear if this is a Django, PyDev or
> >> Eclipse issue.  Any thoughts?
> >>
> >> Fred.
> >>
> >> -Original Message-
> >> From: django-users@googlegroups.com
> >> [mailto:django-users@googlegroups.com] On Behalf Of Alexandros
> >> Karypidis
> >> Sent: Sunday, April 01, 2012 3:57 PM
> >> To: django-users@googlegroups.com
> >> Subject: Re: Looking for Django IDE
> >>
> >> Hi,
> >>
> >> I'm using PyDev in Eclipse and it seems quite nice: http://pydev.org/
> >>
> >> Have a look at the Django-specific stuff:
> >> http://pydev.org/manual_adv_django.html
> >>
> >> Please note that you must use a nightly build for Django 1.4 due to
> >> this:
> >> http://sourceforge.net/projects/pydev/forums/forum/293649/topic/51586
> >> 43
> >>
> >> Cheers,
> >> Alex
> >>
> >>
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Profiling Django (WAS Django database-api)

2012-04-03 Thread Andre Terra
While I know of the two methods mentioned by Anssi, I've often wondered how
to profile my code from a project level.

I have some complex and database intensive asynchronous tasks running under
celery which take a LONG time to complete and I'd just love to be able to
keep track of the queries they generate in order to optimize and possibly
remove the biggest bottlenecks.

"Real time" updates would be great, but I can settle for after-the-fact
logs. I know of django-debug-toolbar [0] but since these aren't happening
in a view, I'm not sure that app can help.

Any suggestions? Thanks in advance!

Cheers,
André Terra

[0] http://pypi.python.org/pypi/django-debug-toolbar
 On Apr 3, 2012 6:13 AM, "KasunLak"  wrote:

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



Re: Problemas con syncdb

2012-04-03 Thread Andre Terra
I guess you could check if you're actually looking at the right file.

$ python manage.py shell

>>> import settings

>>> print settings.__file__



Cheers,
AT

On Tue, Apr 3, 2012 at 10:28 AM, DIEGO CENZANO PRADO  wrote:

> I am trying to do the tutorial and I get an error doing 'python manage.py
> syncdb'. I am using the DATABASES as it is created and I've try to use
> sqlite3 and mysql backends. I tried it in windows and in unix. Rasult is
> always the same:
>  raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
> django.core.exceptions.ImproperlyConfigured: settings.DATABASES is
> improperly configured. Please supply the ENGINE value. Check settings
> documentation for more details.
> But settings.py is:
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.sqlite3', # Add
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
> 'NAME': 'polls.db',  # Or path to database
> file if using sqlite3.
> 'USER': '',  # Not used with sqlite3.
> 'PASSWORD': '',  # Not used with sqlite3.
> 'HOST': '',  # Set to empty string for
> localhost. Not used with sqlite3.
> 'PORT': '',  # Set to empty string for
> default. Not used with sqlite3.
> }
> }
> ¿Any idea?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Yl-oyPgbgLYJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Need help

2012-04-03 Thread Andre Terra
It could be a regression bug.

To be honest, I don't see a reason why '' should become 'localhost'
automagically. I'd much prefer if users were forced to write 'localhost'
rather than having Django do it (and fail) for them.

Explicit is better than implicit.

If you haven't yet, please file a bug report:
https://code.djangoproject.com/newticket


Cheers,
AT


On Tue, Apr 3, 2012 at 12:25 PM, thongor  wrote:

> Wow this post is really old but this also solved my problem strangely
> enough.
>
> On Thursday, June 25, 2009 2:48:32 PM UTC-4, amy wrote:
>>
>> I had this same problem...the user and pass were fine but no users
>> could authenticate on any DB, regardless of settings.
>>
>> Turns out my issue was only that I needed to add the string
>> "localhost" to the host parameter.
>>
>> It's odd since the comments specifically state to leave it blank for
>> localhost...but oh well. It worked.
>>
>> DATABASE_HOST = 'localhost' # Set to empty string for
>> localhost. Not used with sqlite3.
>>
>> Odd.
>>
>> On May 31, 6:14 am, Tim Chase  wrote:
>> > mizan rahman wrote:
>> > > No, i've checked that i've created a user named "djangouser" and the
>> > > problem still exist what will i do? Plz help me
>> >
>> > and you've checked that the password in settings.py is correct?
>> > You only confirmed one of the two problems I suggested.
>> >
>> > If both are correct, you may have to include the section of your
>> > pg_hba.conf that defines access permissions.  It usually looks
>> > something like
>> >
>> > ##**##**##
>> > local   all postgres  ident sameuser
>> >
>> > # TYPE  DATABASEUSERCIDR-ADDRESS  METHOD
>> >
>> > # "local" is for Unix domain socket connections only
>> > local   all all   ident sameuser
>> > # IPv4 local connections:
>> > hostall all 127.0.0.1/32  md5
>> > # IPv6 local connections:
>> > hostall all ::1/128   md5
>> > ##**##**##
>> >
>> > along with information about how your connecting in Django (to
>> > localhost, to the local machine by IP address, to a remote
>> > machine, etc)
>> >
>> > -tkc
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/BI0mwz_xsrsJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Profiling Django (WAS Django database-api)

2012-04-03 Thread Andre Terra
Hey Javier,

Thanks for the reply. My problem with the logs in the past was that they
tended to make the task even slower (due to recursion) but I guess that's
probably because I didn't call the logging from the appropriate places in
the code.

To make things a little more complicated, the task involves writing a large
amount of data to a temp database, handling it and then saving some
resulting queries to the permanent DB. This makes it a tad harder to
analyze what goes on in the first part of the code.

I'll try logging again over the weekend and see how that works.. I just
wish there were third party apps and tools for debugging this sort of
problem.

Thanks again for your input.

Cheers,
AT

On Apr 3, 2012 3:47 PM, "Javier Guerra Giraldez"  wrote:
>
> On Tue, Apr 3, 2012 at 8:21 AM, Andre Terra  wrote:
> > I have some complex and database intensive asynchronous tasks running
under
> > celery which take a LONG time to complete and I'd just love to be able
to
> > keep track of the queries they generate in order to optimize and
possibly
> > remove the biggest bottlenecks.
>
> the easiest would be to write detailed logs, which _can_ be analysed
> in real time, not only 'after the fact'.
>
> my second idea would be to hack the log output so instead of writing
> to a file, it would store messages (probably with some structure) to
> some comfortable database.  I'd use Redis, but i guess MongoDB or even
> an SQL-based DB could work too.  then you can easily filter and
> aggregate times according to task type, when it happened, etc.
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

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



Re: dynamically adding form fields

2012-04-03 Thread Andre Terra
Hi Matt,

Search the docs for inlines, inline formsets and inline formset factories,
and you'll find exactly what you need [0].

Read them carefully cause it's easy to make mistakes and debugging inlines
has always been frustrating for me.

Good luck and happy coding.

Cheers,
AT

[0] https://docs.djangoproject.com/en/dev/topics/forms/modelforms/

On Apr 3, 201
>
> I'm working on a complex form and not sure if there is an elegant way to
> handle it in django.
>
> The form creates an invoice and it uses jQuery to dynamically add/remove
> extra form fields into the HTML for line items.  Each line item contains
> several fields including description, unit price, quantity etc.
>
> On the server I need to create all these line item objects and set the
> foreign key back to the invoice model object.  It needs to validate
> everything and return errors for the appropriate fields.
>
> I'd like to use a ModelForm or Form for the whole invoice but not sure how
> to represent the line item fields.
>
> Suggestions?
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/xaYRsc5sZxwJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Problem using django-admin.py in a virtual environment

2012-04-04 Thread Andre Terra
When you type 'django-admin.py foo' in a command prompt, windows will use
the system wide python install which is what is associated with the .py
extension. In order to avoid this, you must call 'python django-admin.py
foo'.

If you don't like having to type 'python' before calling a script, you can
alter your virtualenv activate script so that window's file association for
Python files gets changed when a new environment gets activated. This has
the downside of not reverting the association when you close a prompt
without properly deactivating (by typing 'deactivate'), but I still like
it, so there's a how-to below.


In order to tell the virtualenv to use your virtual python install when
calling file.py directly, you need to modify the activate.bat script and
add the following line somewhere in the beginning (after @echo off):

FTYPE Python.File="C:\Environments\django1.3\Scripts\python.exe" "%1" %*

Then add a line to revert this association change in deactivate.bat
(located in the same folder):

FTYPE Python.File="C:\Python27\python.exe" "%1" %*

I did my best to guess the paths, but you might have to adjust them
appropriately.


Hope that helps!

Cheers,
AT

On Wed, Apr 4, 2012 at 6:01 AM, DIEGO CENZANO PRADO
wrote:

> I have install django with 'python setup.py install' in a virtual
> environment called 'django1.3'
>
> I run it and receive the following error mesage:
>
> (django1.3) C:\Documentos de Diego\Dropbox\Codigo\Django>django-admin.py
>
> Traceback (most recent call last):
>
>   File "C:\Environments\django1.3\Scripts\django-admin.py", line 2, in
> 
>
> from django.core import management
>
> ImportError: No module named django.core
> Can anybody help me, please?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/WKzPnfWfh9UJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Difficult setup on Suse Linux

2012-04-05 Thread Andre Terra
There's a chance you have a logging module in your PATH that is shadowing
the default package.

Did you create an app or project named logging by any chance?

Ideas:
- From an interactive python shell, import logging and check
logging.__file__

In my Ubuntu install, I get:
/usr/lib/python2.7/logging/__init__.pyc

- Install virtualenv and create an environment using the --no-site-packages
and install nothing but Django. Try running it from there and see what
happens. Ideally, you'll want to use virtual environments always.

I'm hoping one of these solutions will help, but I'm really just guessing.

Cheers,
AT

-- Sent from my phone, please excuse any typos. --

On Apr 5, 2012 8:22 AM, "Martin Sommer"  wrote:
>
> Its Django 1.3.1, with Python 2.4.1. The Django docs say that this
> would work.
>
> https://docs.djangoproject.com/en/1.3/intro/install/
>
> Martin
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

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



Re: Comparing QuerySets

2012-04-05 Thread Andre Terra
Not sure if this is efficient, but you can try wrapping the values_list in
a set() call.

>>> set(ids1) == set(ids2)

True

>>> set(ids1) & set(ids2)

set([1])

>>> ids3 = set([])

>>> r = set(ids1) & set(ids3)

>>> r

set([])

>>> len(r)

0


Cheers,
AT

On Thu, Apr 5, 2012 at 6:07 AM, Thomas Guettler  wrote:

> I was surprised, that comparing querysets does not work:
>
> {{{
> from django.contrib.auth.models import User
> user_id=User.objects.all().**order_by('id')[0].id
>
> if not User.objects.filter(id=user_**id)==User.objects.filter(id=**
> user_id):
>print 'Not equal? I think they should be'
>
> ids1=User.objects.filter(id=**user_id).values_list('id', flat=True)
> ids2=User.objects.filter(id=**user_id).values_list('id', flat=True)
> if not ids1==ids2:
>print 'Not equal? I think they should be: %s %s' % (ids1, ids2)
>
> }}}
>
> Both, django 1.3 and 1.4 print this result:
>  Not equal? I think they should be
>  Not equal? I think they should be: [1] [1]
>
> I could not find a documentation of this in the django docs[1].
>
> Before creating a doc-ticket I want to ask here.
>
> [1] 
> https://docs.djangoproject.**com/en/dev/ref/models/**querysets/
>
> --
> Thomas Guettler, http://www.thomas-guettler.de/
> E-Mail: guettli (*) thomas-guettler + de
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

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



Re: Django ORM - query help

2012-04-12 Thread Andre Terra
On Thu, Apr 12, 2012 at 10:01 AM, David  wrote:

> Log.objects.distinct('thing__id').order_by('thing__id',
> '-modified_on').select_related().filter(thing__deleted=0)[:20]
>
> By avoiding the use of values() I was able to then use the result as an
> object and access everything I needed.
>
> The above ORM statement however does not look as elegant to read as I have
> come to expect from Django though. The resulting SQL doesn't seem too
> shabby however.
>


Django has a tendency of making you write really long lines, but I guess
you could break it into smaller chunks to improve readability.

logs = Log.objects.distinct('thing__id').order_by('thing__id',
'-modified_on')
related = logs.select_related().filter(thing__deleted=0)[:20]


Cheers,
AT

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



Re: Avoid verbose_name HTML escaping in admin

2012-04-13 Thread Andre Terra
I'm only guessing, but I think the escaping is being done at rendering time
by the template itself. Take a look at the default admin templates and
check the docs for an explanation on how to override them with your own.

Protip: do not edit the original files!

Cheers,
AT

-- Sent from my phone, please excuse any typos. --
On Apr 13, 2012 6:16 AM, "FraMazz"  wrote:

> Is it possible to avoid HTML escaping in admin?
> I have defined a model with verbose_name for several fields.
> In verbose_name I need HTML code to highlight part of the string e.g.
> d1 = models.CharField(max_length=1, blank=False, default='0',
> verbose_name="Hi all!'').
> In admin the text gets escaped resulting in the whole string being shown
> (Hi all!) instead of Hi *all*!
> I also tried verbose_name=mark_safe("Hi all!'') to no avail
>
> Suggestions?
> Thanks
> Francesca
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/LYnO1AIlc_EJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: transaction.commit_on_success committing prematurely?

2012-04-24 Thread Andre Terra
This may actually solve one of the problems I've been having regarding slow
bulk inserts. I'll look into it, thanks for the pointer!!!

Cheers,
AT

On Tue, Apr 24, 2012 at 2:16 PM, John Begeman  wrote:

> My app uses multiple databases and my saves were against something
> that was not the default DB.  I needed to specify the proper db to
> manage transactions against, as commit_on_success was trying to manage
> connections on the default database.
>

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



Re: 1.4 on git

2012-05-07 Thread Andre Terra
add "django==1.4" to a requirements.txt file (no quotes!)
$ pip install -R requirements.txt



On Mon, May 7, 2012 at 1:00 AM, Rivsen  wrote:

> Hi Larry,
>
> I cloned django and django-old from github, and I found the git index of
> yours.
>
> It's in django-old repo, not in django.
>
> So you need clone django-old not django.
>
> git clone git://github.com/django/django-old.git
>
> cd django-old
>
> git checkout -b test -f *6fbf282ac2*
>  *
> *
> git log
>
> commit *6fbf282ac2*b467bd71f807cad45e12a86aa371bd
> Author: claudep 
> Date:   Fri Mar 23 19:44:52 2012 +
>
> Now, The 'test' branch is the same to your system 1.
>
> Best regards,
>
> Rivsen
>
> 2012/5/7 Larry Martell 
>
>> On Sun, May 6, 2012 at 12:54 PM, Ramiro Morales  wrote:
>> > You will need to read the Git documentation because we are in Git
>> territory now.
>> >
>> > )ou got the latest development code by default but remember that when
>> > you clone you get (most of) the development history and it is
>> > available locally.
>> >
>> > You need to get a checkout of the commit pointed to by the '1.4' tag.
>> > IIRC you can achieve that with::
>> >
>> >  git checkout 1.4
>>
>> Ok, Thanks. I'll try that next time. I ended up just scp-ing the
>> django dir from my working system.
>>
>>
>> > On 5/6/12, Larry Martell  wrote:
>> >> On Sat, May 5, 2012 at 7:06 PM, Ramiro Morales 
>> wrote:
>> >>> On Sat, May 5, 2012 at 8:42 PM, Larry Martell <
>> larry.mart...@gmail.com>
>> >>> wrote:
>>  Last month I set up a system and when I cloned django from git I got
>>  version 1.4. Now I an setting up another system, and when I clone
>>  django from git I get 1.5, and my app is failing. How I can get 1.4?
>> I
>>  see a django-nonrel / django-1.4 but it says "Work in progress 1.4
>>  port, DON'T USE"
>> >>>
>> >>> The github.com/django/django repository is now the official Django
>> >>> development repository, we migrated from SVN a week ago.
>> >>>
>> >>> Problem is that we've only migrated the development mainline. We are
>> >>> working to also migrate the release tags (1.4, 1.3, ...) and the
>> >>> post-release maintenance branches. The plan is to have it ready in a
>> >>> couple of days.
>> >>>
>> >>> The repository that previously was at github.com/django/django is
>> called
>> >>> now github.com/django/django-old and it has the 1.4 tag. You can
>> clone
>> >>> from it if you can't wait.
>> >>
>> >> i cloned from django-old, and I get 1.5 alpha (which does not work for
>> me):
>> >>
>> > django.VERSION
>> >> (1, 5, 0, 'alpha', 0)
>> >>
>> >> My working system has:
>> >>
>> > django.VERSION
>> >> (1, 4, 0, 'final', 0)
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "Django users" group.
>> >> To post to this group, send email to django-users@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> django-users+unsubscr...@googlegroups.com.
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/django-users?hl=en.
>> >>
>> >>
>> >
>> > --
>> > Sent from my mobile device
>> >
>> > Ramiro Morales
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: i need to place my django site on a server, i dont know how to do it! help!!!

2012-05-10 Thread Andre Terra
Or just deploy on heroku

http://heroku.com


Cheers,
AT


On Thu, May 10, 2012 at 11:13 AM, eihli  wrote:

> This won't be a complete list but it's what I can remember off the top of
> my head.
> Things to do:
> Install Python
> Install Django
> Install database software (I chose Postgres. I guess you don't need this
> if you are using SQLite3).
> Create database and users and assign permissions.
> Install mod_wsgi.
> Edit your apache httpd.conf file to use mod_wsgi:
> http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
> If you are using apache to serve static html files (like your .css or
> image files) then you'll need to add an Alias to your apache config.
> Something like: Alias /myproject/static/
> /var/www/djangoapps/myproject/media/static
>
> Here are some links I bookmarked while trying to set up a VPS with Django:
>
> http://www.epicserve.com/blog/2011/nov/3/ubuntu-server-setup-guide-django-websites/
>
>
> http://bailey.st/blog/2012/05/02/ubuntu-django-postgresql-and-nginx-a-rock-solid-web-stack/
>
>
> http://blog.kevin-whitaker.net/post/725558757/running-django-with-postgres-nginx-and-fastcgi-on
>
>
> http://brandonkonkle.com/blog/2010/jun/25/provisioning-new-ubuntu-server-django/
>
>
>
>
> On Thursday, 10 May 2012 07:23:11 UTC-5, doniyor wrote:
>>
>> Hi there,
>>
>> i need a small help: i have a django site, which is ready to test. now i
>> talked to a hosting service, they had only php and mysql supporting server,
>> but not django. they gave me a virtual server, where i can install django
>> and put my site there. now i am stuck. i dont know how to install django on
>> server and which python modules to install that run my site and where to
>> install. is there any list of steps to do this kind of job? it would be
>> very helpful. i just dont find a clue where to start. what i understand is:
>> apache is webserver and it is there on server. so i need some module that
>> supports python, right? i decided for mod_wsgi. i dont know why i decided
>> for this. before that i installed easy_install then i installed all python
>> packages including django. now when i log in to server thru Putty including
>> switching to root, i land to: domainname: /www/vhtdocs/domainname # and
>> this folder has some html files of my old site. they just copied from old
>> server to this virtual one. now the question is: is it the place where i
>> can just upload my whole django-site?
>>
>> i would be very thanksful for some instructions..
>>
>> thanks thanks.
>>
>> Doni
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/3jzFFzJ9KoEJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: New Release of IBM_DB_DJANGO (1.0.4)

2012-05-16 Thread Andre Terra
I don't even use IBM databases, but I just wanted to say thank you and
great job!

I'm always happy to see Django being embraced all across the IT industry
and to see IBM developing and maintaining an part of this great framework
is always heart warming.

Keep up the good work!


Cheers,
AT


On Wed, May 16, 2012 at 7:20 AM, Rahul  wrote:

> IBM_DB_DJANGO-1.0.4
> ---
> IBM_DB_DJANGO adaptor enables access to IBM databases from Django
> applications http://www.djangoproject.com/. The adaptor is developed
> and maintained by IBM.
>
> What's New?
> 
>  - Added support for Django-1.4
>
>  - Backward compatibilty - Same codebase works with older supported
> version of Django
>
>  - Added support to enable Django's USE_TZ feature
>
>  - Added support for Django's bulk_create
>
>  - Added support for 'SELECT FOR UPDATE'
>
>  - Added module version string __version__
>
>
> SVN access to the source
> ---
> http://code.google.com/p/ibm-db/source/browse/trunk/IBM_DB/ibm_db_django/
>
> Installation
> 
> $ easy_install ibm_db_django
>
> Feedback/Suggestions/Issues
> 
> You can provide us feedback/suggestions, or report a bug/defect, or
> ask for help by using any of the following channels:
> 1. Mailing us at open...@us.ibm.com
> 2. Opening a new issue at http://code.google.com/p/ibm-db/issues/list.
> 3. By opening new discussion at http://groups.google.co.in/group/ibm_db.
> For prerequisites, installation steps and help details, visit -
> http://code.google.com/p/ibm-db/wiki/ibm_db_django_README
> Try this out and let us know you valuable feedback. Have fun.
>
> Cheers,
> Rahul Priyadarshi
>
> Download Express-C for free, go to:
> ---
> -
>
> http://www.ibm.com/software/data/db2/express/download.html?S_CMP=ECDDWW01&S_TACT=ACDB2011
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: import error: no model named .....

2012-05-17 Thread Andre Terra
Everyone, please follow these guidelines before asking other questions:

https://code.djangoproject.com/wiki/UsingTheMailingList



Cheers,
AT

On Thu, May 17, 2012 at 4:14 PM, Tanveer Ali Sha wrote:

> even am getting *page not found* error
>
> 1.^notes/
> the current URL,didnt match any of these
>
>
>
> for that wikicamp example which is available in showmedo.com..
>
> I donno why I getting these error ...??:(
>
>
> On Fri, May 18, 2012 at 12:32 AM, Halit Alptekin wrote:
>
>> You should import models into views.py.
>>
>> For Example;
>>
>> from hdyazi.models import *
>> from hdmakale.models import *
>> from hdsayfalar.models import *
>>
>> My models' names are hdyazi,mdmakale,hdsayfalar ...
>>
>> --
>> *www.halitalptekin.com | Halit Alptekin*
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Getting Started-Introduction

2012-05-22 Thread Andre Terra
https://docs.djangoproject.com/en/dev/internals/contributing/

On Tue, May 22, 2012 at 11:17 AM, vishrut mehta
wrote:

> Thank you a lo..! But i tld u im a bit new to all this...Can u
> please explain how to solve bugs and submit the patches,means the procedure
> ??I am just new to this...
>
> On Tue, May 22, 2012 at 3:54 PM, kenneth gonsalves  > wrote:
>
>> ...
>>
>

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



Re: Generic views create_object and prefill form data?

2012-05-23 Thread Andre Terra
For the record, you could go even further (and you may already have), and
make the get_initial part of a WebsiteMixin so that you can reuse it in
other views without having to repeat yourself.


Cheers,
AT

-- Forwarded message --
From: Paul 
Date: Wed, May 23, 2012 at 5:09 PM
Subject: Re: Generic views create_object and prefill form data?
To: Django users 


Solved it by migrating to the class based generic views, then fed
initial form data to the constructor of the form by overloading
get_initial on the view class.
Paul

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

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



Re: track change

2012-05-23 Thread Andre Terra
Google for Django Audit Log and/or Audit Trail. While some of the packages
might not be under active development, they may be able to point you in the
right direction.

Cheers,
AT

-- Sent from my phone, please excuse any typos. --
On May 23, 2012 5:45 PM, "Carsten Jantzen"  wrote:

> Hi
>
> I am looking for a way to track a skill change for a player in a
> online game.
>
> model:
> Player 1
> skill_x=1
> skill_y=1
>
> During next update I get a change
>
> Player 1
> skill_x=2
> skill_y=1
>
> When I load the player I would like to see his latest stats.
> If I goto the players page I would like to be able to view when and
> what skill changed.
>
> I am looking for a good way to implement it.
> I was thinking to make the skill it's own object and make a one to
> many relation on the player.
> What I am afraid of is that the same skill will show up multiple times
> when loading the player.
>
> Hope to get some input.
>
> /Carsten
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: GeoIP install failure, advice needed

2012-05-24 Thread Andre Terra
sudo brew link geoip? Total guess, btw.


Cheers,
AT

On Thu, May 24, 2012 at 6:39 PM, DF  wrote:

> Several hours of frustration here and looking to see if anyone has any
> advice.
>
> I'm trying to install GeoIP vie Homebrew and receive the following error
> just prior to the install finishing:
>
> "Error: The linking step did not complete successfully
> The formula built, but is not symlinked into /usr/local
> You can try again using `brew link geoip'"
>
>
> brew link geoip returned this error:
>
> "Error: Could not symlink file:
> /usr/local/Cellar/geoip/1.4.8/etc/GeoIP.conf.default
> /usr/local/etc is not writable. You should change its permissions."
>
>
> I'm not entirely familiar with permissions and such and was wondering what
> I needed to do from the command line to get this to link properly. Any help
> greatly appreciated.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/nmmmuD9eA0gJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Python IDLE

2012-05-28 Thread Andre Terra
For one thing, I don't know of anybody who uses IDLE as their editor for
writing complex code like when developing a website with Django.

You can always type 'python manage.py runserver' instead of just 'manage.py
runserver' to make sure python is the program that's opening your .py file.

It seems like you have a problem with your file associations. To fix this,
go to the registry (Start Menu, Run, regedit) and browse to:

*HKEY_CLASSES_ROOT\Python.File\shell\open\command*

You should have a string there named '(Default') and its value should be
exactly this (including quotes): *"C:\Python26\python.exe" "%1" %**

You could have a different python path depending on your installation (say,
C:\Program Files\Python27), but you get the gist. Don't forget the quotes
and the trailing %*


Cheers,
AT


On Mon, May 28, 2012 at 9:37 AM, coded kid  wrote:

> I'm in a big mess now, I've lost my projects due to this errror. I'm
> on windows, This is how I encounter the problem; I try to edit my
> settings.py in IDLE. After right clicking on the files, I choose open
> program with these default file. I choose idle window bat file, and I
> clicked Ok. It didn't open, I try to run manage.py runserver on my
> DOS. Not working, it will pop up the IDLE Shell and mange.py script by
> displaying it in IDLE. It didn't run the server. The logo of my python
> files have changed. How can I revert it back to open with IDLE? And
> use it as default for my python script?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: OpenSource IDE with debugger capabilities of PyCharm

2012-05-31 Thread Andre Terra
No IDE recommendations, please!

There are many threads regarding that, so please search around, OP.

As for template debugging, this is currently a limitation in Django itself
AFAIK, but efforts are being made to improve the situation.

Sincerely,
Andre Terra

-- Sent from my phone, please excuse any typos. --
On May 31, 2012 4:07 AM, "Houmie"  wrote:

> Hi,
>
> I have a question to the seasoned Django developers, I am relatively
> new to Django and have been developing on Aptana Studio 3.0 since one
> month.  While I think its a great free product, it seems debugging is
> only limited to url.py and views.py. Beyond that there is no way to
> set a break point in a template.
>
> I just watched a video of pycharm and it seems pycharm is able to do
> it.
>
> I was wondering if I have setup Aptana incorrectly, and it would
> support template debugging as well.
>
> Otherwise is there any other open source django IDE you would
> recommend that could debug templates?
>
> Many thanks,
> Houman
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: OpenSource IDE with debugger capabilities of PyCharm

2012-06-01 Thread Andre Terra
"AFAIK" implies "I might be wrong", but.. sure.

Template Debugging threads in django-developers:
https://groups.google.com/forum/?fromgroups#!searchin/django-developers/template$20debugging


Efforts in better template debugging, none included in core:
https://github.com/codysoyland/django-template-repl
https://github.com/t0ster/django-debug-template


And if you were instead referring to my comment that there are threads
aplenty regarding IDEs, then:
https://groups.google.com/forum/?fromgroups#!searchin/django-users/best$20IDE




Sincerely,
André Terra


On Thu, May 31, 2012 at 7:55 PM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> On Thu, May 31, 2012 at 6:54 PM, Andre Terra  wrote:
> > No IDE recommendations, please!
> >
> > There are many threads regarding that, so please search around, OP.
> >
> > As for template debugging, this is currently a limitation in Django
> itself
> > AFAIK, but efforts are being made to improve the situation.
>
> It is? And there are? That's news to me - can you shed any light on this?
>
> Yours,
> Russ Magee %-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: about_dajngo

2012-06-06 Thread Andre Terra
You can also use the Google Chart Tools, if you only need low to moderate
complexity charts.

https://developers.google.com/chart/


Cheers,
AT

On Wed, Jun 6, 2012 at 4:11 AM, Pierre de LESPINAY wrote:

> If you only need to draw HTML charts, I would suggest to use jQPlot
> Le 6 juin 2012 09:06, "kenneth gonsalves"  a
> écrit :
>
>  On Wed, 2012-06-06 at 12:26 +0530, Satvir Toor wrote:
>> > On Wed, Jun 6, 2012 at 10:47 AM, kenneth gonsalves
>> >  wrote:
>> >
>> > > any library that you ordinarily use in your html pages will work.
>> > What are the major uses of numpy and matplotlib libraries in django.
>>
>> django is just python - any python library can be used in a view
>> function to generate data/information which can be passed to a template.
>> You will have to use some js library to render this data in the html
>> page. There are lots of these libraries available - from your question
>> it looks like you are not aware of how django works - I suggest that you
>> do the official tutorial or take a look at how django works with
>> reportlab to create pdfs.
>> --
>> regards
>> Kenneth Gonsalves
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Filter by today

2012-06-12 Thread Andre Terra
You're missing result in your queries because your timestamp DateTimeField
includes time information (otherwise it would be a DateField).

Cheers,
AT

-- Sent from my phone, please excuse any typos. --
On Jun 12, 2012 7:55 AM, "Simon Pickles"  wrote:

>  Hi, if my model has a timestamp field,
>
> class Attempt(models.Model):
> timestamp = models.DateTimeField('Timestamp')
>
> How would I query to get entries from today? I tried:
>
> result = Attempt.objects.filter(timestamp = date.today())
>
> but it always says DoesNotExist (I can see entry in table in other ways).
> I think my query is wrong.
>
> Thanks for any help
>
>
> Simon
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: from future url -- argh

2012-06-14 Thread Andre Terra
I was having the same problem, but with the development version (that is,
1.4+, or soon to be 1.5).

Just remove the {% load url from future %} because the future is NOW! :O

The old {% url %} tag has apparently been deprecated, but I can't find any
notes on this change after 2 mins of googling.

Let me know how it goes.


Cheers,
AT

On Thu, Jun 14, 2012 at 4:00 PM, JeffH  wrote:

> django 1.4
>
> topapp
>   urls.py
> ...
> url(r'^shows/', include('shows.urls')),
>   template
> base.html
> ... {% url shows.views.customers %}
>
> shows
>   urls.py
> ..
> url(r'^customers/$', 'shows.views.customers')
>
> The above works just fine -- everything is happy except for the
> deprecation warning in debug mode.
>
> So I modify base.html  and add {% load url from future %}  to the top, and
> then put single quotes around the argument {% url 'shows.views.customers'
> %} and django goes Boom!
> "django.core.urlresolvers.NoReverseMatch -- NoReverseMatch: Reverse for
> '' with arguments '()' and keyword arguments '{}' not found."
>
> I've become dizzy trying the different methods specified in the docs
> including setting a name= attr in the shows/urls.py
> url(r'^customers/$', 'shows.views.customers', name='fido')
> {% url 'fido' %}
>
> and I get the same message.  Other variations tried:
> {% url 'shows_views.customers' %}  - same error
>
> If someone can help me out,I'd appreciate it.
>
> Best,
>
> Jeff
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/x4uqjgipT9YJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: from future url -- argh

2012-06-14 Thread Andre Terra
Ah, here it is:

https://docs.djangoproject.com/en/dev/internals/deprecation/#id2


Cheers,
AT

On Thu, Jun 14, 2012 at 8:54 PM, Andre Terra  wrote:

> I was having the same problem, but with the development version (that is,
> 1.4+, or soon to be 1.5).
>
> Just remove the {% load url from future %} because the future is NOW! :O
>
> The old {% url %} tag has apparently been deprecated, but I can't find any
> notes on this change after 2 mins of googling.
>
> Let me know how it goes.
>
>
> Cheers,
> AT
>
>
> On Thu, Jun 14, 2012 at 4:00 PM, JeffH  wrote:
>
>> django 1.4
>>
>> topapp
>>   urls.py
>> ...
>> url(r'^shows/', include('shows.urls')),
>>   template
>> base.html
>> ... {% url shows.views.customers %}
>>
>> shows
>>   urls.py
>> ..
>> url(r'^customers/$', 'shows.views.customers')
>>
>> The above works just fine -- everything is happy except for the
>> deprecation warning in debug mode.
>>
>> So I modify base.html  and add {% load url from future %}  to the top,
>> and then put single quotes around the argument {% url
>> 'shows.views.customers' %} and django goes Boom!
>> "django.core.urlresolvers.NoReverseMatch -- NoReverseMatch: Reverse for
>> '' with arguments '()' and keyword arguments '{}' not found."
>>
>> I've become dizzy trying the different methods specified in the docs
>> including setting a name= attr in the shows/urls.py
>> url(r'^customers/$', 'shows.views.customers', name='fido')
>> {% url 'fido' %}
>>
>> and I get the same message.  Other variations tried:
>> {% url 'shows_views.customers' %}  - same error
>>
>> If someone can help me out,I'd appreciate it.
>>
>> Best,
>>
>> Jeff
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/x4uqjgipT9YJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>

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



Re: Hierarchy Model

2012-07-15 Thread Andre Terra
-- Sent from my phone, please excuse any typos. --
On Jul 15, 2012 11:02 AM, "Setiaman Lee"  wrote:

> Hi,
>
> I want to implement hierarchy data model which is quite common in
> Relational Data Model.
>
> Let's say I have Employee model which has the relation to the boss which
> link to the employee model itself.
> It will look like this:
>
> class Employee(models.Model):
> empname = models.CharField(max_length=60)
> boss = models.ForeignKey(Employee)
> salary = models.integer()
>
>
> Sample Data:
>
> IDempname  bosssalary
> --
> 1  albertnull  1
> 2  bert  1  5000
> 3  Chuck  1  5000
> 4  Donna  3  3000
> 5  Jack3  2000
>
> Albert is the root with Bert and Chuck under him and Chuck has Donna and
> Jack under him.
>
> I got an error when I tried to sync to the database where Django telling
> me that the employee is not exist in the Foreign key part.
> Is there any way to manipulate this situation?
>
> Cheers,
> Setiaman
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Hierarchy Model

2012-07-15 Thread Andre Terra
I recommend using django-mptt. I can't link to it cause I'm writing on my
phone, but it's easy to find it on Google.

Also, your foreign key should target self rather than Employee, IIRC.

Cheers,
AT

-- Sent from my phone, please excuse any typos. --
On Jul 15, 2012 11:02 AM, "Setiaman Lee"  wrote:

> Hi,
>
> I want to implement hierarchy data model which is quite common in
> Relational Data Model.
>
> Let's say I have Employee model which has the relation to the boss which
> link to the employee model itself.
> It will look like this:
>
> class Employee(models.Model):
> empname = models.CharField(max_length=60)
> boss = models.ForeignKey(Employee)
> salary = models.integer()
>
>
> Sample Data:
>
> IDempname  bosssalary
> --
> 1  albertnull  1
> 2  bert  1  5000
> 3  Chuck  1  5000
> 4  Donna  3  3000
> 5  Jack3  2000
>
> Albert is the root with Bert and Chuck under him and Chuck has Donna and
> Jack under him.
>
> I got an error when I tried to sync to the database where Django telling
> me that the employee is not exist in the Foreign key part.
> Is there any way to manipulate this situation?
>
> Cheers,
> Setiaman
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Return SQL calculation within queryset

2012-07-25 Thread Andre Terra
Please read the following bits of documentation:

https://docs.djangoproject.com/en/dev/topics/db/sql/#performing-raw-sql-queries
https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.extra



Cheers,
AT

On Tue, Jul 24, 2012 at 9:03 PM, jondbaker wrote:

> I've implemented the spherical law of cosines to aid in proximity-based
> searching. Everything works correctly, but I'm a bit stumped as to how I
> can return the calculated distance for a record given that it's not a field
> in the model. In the Model Manager below, row[1] represents the dynamically
> calculated distance, but I need to find a way to "attach" each calculation
> to it's corresponding record so that I can print the distance in a template.
>
> class LocationManager(models.Manager):
> '''
> '''
> def nearby_locations(self, latitude, longitude, radius):
> '''
> '''
> cursor = connection.cursor()
> if settings.DATABASES['default']['ENGINE'] ==
> 'django.db.backends.sqlite3':
> # sqlite doesn't natively support math functions, so add them
> connection.connection.create_function('acos', 1, math.acos)
> connection.connection.create_function('cos', 1, math.cos)
> connection.connection.create_function('radians', 1,
> math.radians)
> connection.connection.create_function('sin', 1, math.sin)
>
> sql = """SELECT id, (3959 * acos(cos(radians(%f)) *
>   cos(radians(latitude)) * cos(radians(longitude) -
> radians(%f)) +
>   sin(radians(%f)) * sin(radians(latitude
>   AS distance FROM locations_location
>   GROUP BY id HAVING distance < %d
>   ORDER BY distance ASC""" % (latitude, longitude, latitude,
>   int(radius))
> cursor.execute(sql)
> data = [(row[0], row[1]) for row in cursor.fetchall()]
> ids = [i[0] for i in data]
> return self.filter(id__in=ids)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/pfZSZB1nLVIJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Best approach to handling different types of Users

2011-08-18 Thread Andre Terra
Until you install some third party app that accesses
User.objects.all() and then suddenly nothing works as it's supposed
to.

You can access the User object from its related UserProfile instance
and do everything you say from there instead of breaking the
convention. Nobody's stopping you from writing an abstract
BaseUserProfile model with an FK to User and custom UserProfile
subclasses. I just don't see any advantages in going down that path.

Because how will you access every user if you ever need to? What if
someone gets promoted? How will you separate view from model logic?
Are you going to rewrite forms for every user class? That's probably
going to be hard to maintain.


FWIW, profiles are the canonical solution. They are also the only
elegant solution, at least until the app loading branch lands on
trunk, which should then allow you to register a different class as
User. But that won't happen any time soon..


Cheers,
AT

On 8/18/11, Matt Schinckel  wrote:
> Lately, I have been looking at using subclasses of auth.User as a way of
> segmenting users.
>
> This appears (to me, at this stage, anyway) to have several advantages over
> using the UserProfile approach.
>
> * You can have extra attributes on the subclass. For instance, one set of
> users belong to a Company, and I can do this FK relation from the subclass.
> Similarly, I can have a date_of_birth field that is attached to the user,
> rather than the UserProfile. From a performance perspective, this doesn't
> make a lick of difference, as a subclass of a concrete class still has a
> join anyway.
> * You can easily have different user classes appear differently in the
> admin.
> * You can have different relationships between particular User types and
> other objects. For instance, a Staff user may 'work_at' a Location, but an
> 'AreaManager' may have a 'manages' relationship to an Area. You can still do
> this with auth.User, but every user will have every relationship.
>
> The biggest helper for this was to have an authentication backend that
> automatically selects the subclass, so that you no longer get a User object
> in request.user, but whatever you want.
>
> A drawback is that you can't easily change the field types: email, which I
> use for authentication, needs to be unique. You can handle this with
> validation checking on forms, but that requires you to remember to build
> this into your forms. The other way is to monkey-patch the User class
> directly, and manually fix the database to not allow duplicates on the email
> column.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Y6qCTdPzU9sJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
Sent from my mobile device

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



Re: Work in memory instead of BD, how to?

2011-08-18 Thread Andre Terra
I think a better solution would be to use a store rather than cache
(protip: redis) and, if the calculations are lengthy, write a
'publish' function that writes them to the store and let the user
choose when to see the changes in the results appear on the website.

Additionally, add a 'modified since last publish' flag that is
switched on with post_save and off with publish().

And of course, use celery for running the calculations in the
background. Here, redis doubles (or triples!) as the result and broker
backends (see the celery docs for more info on that).


Cheers,
AT

On 8/18/11, Felipe Arruda  wrote:
> Humm, I see, the second case I could make out of it somehow(just have
> some doubts in 2.5: How am I supposed to do this?)
> The first one I could't see how I'm not going to lose the changes,
> done in cache.
> My biggest problem is in altering some value in some models, since
> this operation will be done many times, and I can't do if not by
> this(so that the client infos wont be any different from the DB), and
> for what I understand from this solution I would work if my operations
> where simple retrieving data from the server and doing some
> calculation, but will lose the informations in cache(substituting it
> from the DB. I want it to be otherwise).
>
> And about the django-celery: Never heard about it, but now I'm going
> to use it(but for other purposes, and other projects too). Thanks for
> the tip!
>
> Another thing. I thought of doing something like this:
> Use MemCache, and the second ideia presented, put like a very long
> time, and run a parallel task(using celery? or maybe some thing in
> django-extensions that integrate with cron), so that from time to
> time(a more reasonable time then the timeout from the cache) it will
> get every info from cache and save it in the DB.
> This way, in the worst case, every 10 minutes the system would have a
> small halt to save things(or could make a more complex way to save
> each register in different times).
> What do you thing about it? To much POG, or is in the right track?
>
> On Aug 18, 3:57 pm, Doug Ballance  wrote:
>> You probably don't want to cache changes.  Or if you do, it would be
>> better done elsewhere (like a caching raid controller/w battery on
>> your database machine).  The usual cache patterns I've seen are:
>>
>> 1) Fetch from database
>> 2) Store in cache with a reasonable timeout to that changes are
>> reflected as the cache expires
>> 3) Look in cache, if found return that.  If not goto step (1)
>>
>> or
>>
>> 1) Fetch from database
>> 2) Store in cache with a -long- timeout
>> 2.5) Track changes to cached objects and update the stored information
>> if it changes.
>> 3) Look in cache, if found return it.  if not goto step(1)
>>
>> since the changes won't be reflected as rapidly due to the long
>> timeout, you can configure the post_save/post_delete/etc signals to
>> automatically update the cached value every time a change is made to
>> one of that models instances.  This is what the django-cache-utils app
>> is doing for you.  The trick is that the more complicated your use,
>> the more complex the cache invalidation is going to have to be.
>>
>> Another possiblity is that caching may be the wrong solution to your
>> problem. If for example a web request need to do so a bunch of
>> expensive operations, but does not need to do them interactively with
>> your user, a solution like django-celery may be better.  With celery
>> the job gets scheduled for execution outside of the web request-
>> response system (possibly even on another machine) and gives you a job
>> id.  This allows the user to get on with things, leaving the work to
>> be done behind the scenes.  If the user needs to know the results or
>> state of the job  you can use ajax or refreshing to check back using
>> the id to retreive the results when the job completes.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
Sent from my mobile device

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



Re: How do I select which user/password to use for DB connection after Django app was started?

2011-08-18 Thread Andre Terra
You can't map python processes to users. It's simply not how it works.


This is the web on the 21st century, rethink your concepts instead of
trying to fit them on to a completely different paradigm.

Change is good. Embrace it.


Cheers,
AT

On 8/18/11, michael kapelko  wrote:
> I think about 50 users, but Django for each sounds too much.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
Sent from my mobile device

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



Re: Best approach to handling different types of Users

2011-08-19 Thread Andre Terra
Alright, do what you will. Whatever floats your boat..

On Fri, Aug 19, 2011 at 5:12 AM, Matt Schinckel  wrote:

>
> On Friday, August 19, 2011 12:07:44 PM UTC+9:30, Andre Terra (airstrike)
> wrote:
>>
>> Until you install some third party app that accesses
>> User.objects.all() and then suddenly nothing works as it's supposed
>> to.
>>
>> Why wouldn't it? The User subclasses will still appear in the
> User.objects.all() queryset.
>
>> You can access the User object from its related UserProfile instance
>> and do everything you say from there instead of breaking the
>> convention. Nobody's stopping you from writing an abstract
>> BaseUserProfile model with an FK to User and custom UserProfile
>> subclasses. I just don't see any advantages in going down that path.
>>
>  As I said, 'at this stage', it all seems to be working out okay. I have
> plenty of 3rd party apps, and even some of my own, that access User, and
> they still work with sub-classes.
>
>> Because how will you access every user if you ever need to? What if
>> someone gets promoted? How will you separate view from model logic?
>> Are you going to rewrite forms for every user class? That's probably
>> going to be hard to maintain.
>>
>  You can still access User.objects.all(). I even have a way to access the
> sub-classes (downcasting) when fetching all users.
>
>> FWIW, profiles are the canonical solution. They are also the only
>> elegant solution, at least until the app loading branch lands on
>> trunk, which should then allow you to register a different class as
>> User. But that won't happen any time soon..
>>
> See, I don't see them as an elegant solution. Having to do:
>
> user.get_profile().date_of_birth
>
> instead of:
>
> user.date_of_birth
>
> irks me every time I write the code. UserProfile has always felt to me that
> it was a patchy way of extending User.
>
> Matt.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/-B-vk5gzPqcJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Djangonaut is looking for a job

2011-08-19 Thread Andre Terra
http://djangogigs.com/
https://www.djangoproject.com/rss/community/jobs/

2011/8/19 Eugeny Belykh 

> hi))
> i think yes,we should keep  trying
>
>
> 2011/8/17 枯藤天涯 
>
>> hello,I am from China。And I am looking a job about python/django .Just
>> same as you .Remote (telecommuting) only.Can we find the job like
>> this?
>>
>> 2011/8/5 Eugeny Belykh :
>> > Hi everybody.I am Django newbee based in Russia. I am looking for a
>> > Django related job.Remote (telecommuting) only. 1 django-powered site
>> > in portfolio.Are there any vacancies?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>> >
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Django Development environment

2011-08-23 Thread Andre Terra
Aptana (aka Eclipse/Pydev) for no reason other than hyperlinks in the code

Vim/Notepad++ on occasion
virtualenv, git, pip, ack (grep on steroids)
nginx (proudly compiled from source with custom modules!)

ubuntu 10.04 (will only upgrade to LTS releases) or windows xp. All of
these tools are multiplatform! In addition I'd have to recommend
virtualenv wrapper for those of you running linux

In django:
django-cache-utils
django-form-utils
celery
redis
django-debug-toolbar
django-filter by Alex Gaynor (a must have)


Cheers,
AT

On 8/23/11, Raul Alejandro Ascencio Trejo  wrote:
> Emacs (https://code.djangoproject.com/wiki/Emacs), Postgre... :|
>
> 2011/8/22 Mario Gudelj 
>
>> Mac, sqlite, Eclipse with Pydev or AquaMacs, apache
>>
>>
>> On 23 August 2011 13:06, Jani Tiainen  wrote:
>>
>>> Ubuntu or windows, eclipse with pydev, apache, nginx, virtualenv and
>>> Oracle.
>>>
>>> Stephen Jackson  kirjoitti 23.8.2011 kello
>>> 1.07:
>>>
>>> I am new to the world of Django. I would like to hear from other django
>>> developers describe their dev environment (tools, os, editors, etc.).
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To view this discussion on the web visit
>>> 
>>> https://groups.google.com/d/msg/django-users/-/Fq-jCVxrK7AJ.
>>>
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> r-ascencio 
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
Sent from my mobile device

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



Re: can django be used in destop application?

2011-08-23 Thread Andre Terra
Better yet,

http://www.riverbankcomputing.co.uk/software/pyqt/download


Cheers,
AT

On Tue, Aug 23, 2011 at 8:59 PM, Sam Walters  wrote:

> Seriously why bother?
>
> http://www.wxpython.org/
>
> The whole front end of django is too web-centric. So the only thing
> that might be of use is if you have an existing web application which
> heavily uses the django ORM and you want back end consistency with a
> desktop GUI application that shares thee same database.
>
> Writing an application with wx-python is less time consuming than
> dealing with css+html you wont have the same issues to consider when
> thinking about security. wx-python  is a 2-3 week learning curve to
> become proficient and lots of tutorials out there.
>
>
>
> On Wed, Aug 24, 2011 at 5:50 AM, h3  wrote:
> > Django is modular enough that most of its parts could probably be
> > replaced with desktop oriented
> > modules, like rendering QT templates instead of HTML templates.. which
> > is great.
> >
> > If not you can probably use a embed browser engine (like webkit) and
> > run your app like a website
> > locally and get somewhat the look and feel of a desktop application.
> >
> > That said, your real problem will arise when your application will
> > need to do things that doesn't adhere to
> > the REST api. Then you'll need to find a way to save your application
> > state and that's pretty much
> > when shit will hit the fan IMHO.
> >
> > If the desktop application(s) you want to build are all easily
> > translatable for the web (using a REST api that is),
> > I think it's theoretically possible. But try to do anything out of
> > this scope and you will bitten at every corners.
> >
> > In other words, not really worth the troubles.
> >
> > regards,
> >
> > Max
> >
> >
> > On Aug 23, 1:36 pm, "Cal Leeming [Simplicity Media Ltd]"
> >  wrote:
> >> Curious concept, using Django for a desktop application.
> >>
> >> Can't think of any reason why you couldn't at least try it :)
> >>
> >> Cal
> >>
> >> On Tue, Aug 23, 2011 at 3:49 PM, Andy McKay  wrote:
> >>
> >> > On 2011-08-23, at 4:17 AM, smith jack wrote:
> >>
> >> > > i mean not use django for web site development, but for desktop
> >> > application,
> >> > > it seems its orm can be used in destop application, isn't it?
> >>
> >> > Yes.
> >> > --
> >> >  Andy McKay
> >> >  a...@clearwind.ca
> >> >  twitter: @andymckay
> >>
> >> > --
> >> > You received this message because you are subscribed to the Google
> Groups
> >> > "Django users" group.
> >> > To post to this group, send email to django-users@googlegroups.com.
> >> > To unsubscribe from this group, send email to
> >> > django-users+unsubscr...@googlegroups.com.
> >> > For more options, visit this group at
> >> >http://groups.google.com/group/django-users?hl=en.
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Delegating a async job from a django view

2011-08-25 Thread Andre Terra
Celery is really all you need.

IIRC, you'll have to install celery, django-celery, setup a broker backend
(which handles the task dispatching), and a result backend (i.e. where
you'll get results from your tasks).

This means you'll have to run a celery server and quite possibly a separate
server for broker/result backends, and there are many options available out
there.

Make sure to ask in #django and #celery for help on freenode. The docs are
very extensive, but there are still some gaps. In any case, users in those
two channels will be glad to help you deal with them.


Cheers,
AT

On Thu, Aug 25, 2011 at 4:24 AM, Amit Sethi wrote:

> What is the best solution for delegating a long time taking job from a
> django view. Basically i wish to query a few web api , analyze and
> then create a report . The report is not to be created in a sync
> manner and can be sent at a later time . But it will have a web
> interface to decide a few factors . I somehow think that twisted can
> be used for this but I am not sure how one can use twisted with django
> . Are there any other solutions that i can use for this problem .
>
> Thanks
> Amit
>
> --
> A-M-I-T S|S
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Combining queries? A "join" in Python?

2011-08-30 Thread Andre Terra
FWIW, I'm using django-mptt to help me traverse my tree of self-referencing
models, as well as run complex aggregates based on them.

http://django-mptt.github.com/django-mptt/index.html

Be aware that the API has changed a lot from 0.3 (which is easily found
around the web) to 0.5 (which will require some more googling or cloning for
a specific commit from github). The key advantage of using this library is
that it takes care of adding (and handling) a tree_id column for your
MPTTModels, which you can then use to filter aggregates and the like. So do
check it out!

As an anedoctal aside, In my use case I have AccountGroup, Account and
Entry, and my problem could only be solved through a HUMONGOUS query (62
lines total) that returns the aggregate sum for Entries for a given
AccountGroup for a given month, including subtotals for each level of the
AccountGroup and each Account. So be ready to sharpen up on your SQL skills
if you're looking for something similar!


Cheers,
AT

On Tue, Aug 30, 2011 at 2:10 PM, graeme  wrote:

>
>
> On Aug 30, 7:25 pm, Stuart  wrote:
> > On Aug 30, 3:10 am, graeme  wrote:
> >
> > > I think I need to restate this question with the actual models.
> >
> > Apologies in advance for answering a question you didn't ask, but is
> > your subcategory model truly representing something different from
> > your category model? I think the problems you are having with the
> > query may be indicative of a problem with your model definitions /
> > database layout.
> >
> > Unless I have the wrong idea about what you are trying to accomplish,
> > I recommend a single Category model with a parent field defined as a
> > back-reference to itself. Something like this:
> >
> > parent = models.ForeignKey('self', blank=True, null=True,
> > related_name='child')
> >
> > This approach would eliminate the SubCategory and SubCategoryText
> > models. The CategoryText looks about right as it is.
> >
> > I'm not clear on precisely what you are trying to accomplish with your
> > query, but perhaps rethinking your models will make the query easier.
>
> I must admit I never thought of structuring the database like that. I
> had to think about it quite a bit.
>
> What my query does is give me a list of subcategories, ordered by
> category, and then by the number of places in the category, and
> annotates each subcategory with the number of places in it.
>
> Having a single category model might simplify the query, but as I want
> the page to show something like:
>
> CATEGORY
> Subcategory One
> Subcategory Two
> CATEGORY TWO
> Subcategory Three
> etc.
>
> I am still going to have to, at least, join the category table to
> itself, instead of joining the subcategory table to the category
> table. I have not yet figured out if this will give me easier access
> to the CategoryText of a parent category (in that case it may simplify
> things a lot).
>
> If I am iterating over subcategories (which will now just be those
> categories without a parent), will I have easier access to the
> CategoryText of the parent.
>
> The disadvantage is that the current structure enforces, at the
> database level, that Places can only belong to a sub-category, and
> that the hierarchy is only two levels deep. I would have to move some
> validation out of the database if I did this.
>
> My current approach, or adding the necessary attributes in Python
> works. It does help, as I just found out, that I can add attributes to
> the Categories while looping over SubCategoryTexts (i.e.
> subcategorytextobject.subcategory.category.foo = bar works). It is
> still an ugly hack, though.
>
> >
> > Hope that helps,
> >
> > --Stuart
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: django setup.py access denies

2011-09-01 Thread Andre Terra
Email 1000 users directly, see when if you get spam or not. If so, email the
first 500 again, rinse and repeat, else proceed to the next batch after 12
hours.

Aside from the fact that you will be spamming as well, at least it would
be for just one time and for the greater good.


Cheers,
AT


On Thu, Sep 1, 2011 at 10:35 AM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> On Thu, Sep 1, 2011 at 4:24 AM, Elie Obeid  wrote:
> > I know how to unsubscribe i don't need your link, I don't trust any of
> you,
> > i don't know why this is the official group, this is the official
> spammers
> > group
>
> I have to apologize here - you've been bitten by a problem that we're
> having a great deal of problem resolving.
>
> There are 2 subscribers on django-users. One of them has an
> infected mail client that is autoresponding with spam whenever it gets
> a message from Django-users.
>
> However, the malicious software is hiding it's tracks really well,
> because we're not able to identify *which* user is actually causing
> the problem. And because this is a Google group, we can't get any
> helpful server information, either.
>
> So - again - apologies that your first experience to this group has
> been spam -- we certainly don't encourage or condone this sort of
> behavior. We're doing our best to address the problem; if anyone has
> any nifty ideas on how to  hunt down the offender, I'm all ears.
>
> Yours,
> Russ Magee %-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: How to group models month by month.

2011-09-06 Thread Andre Terra
http://django.me/aggregation


Cheers,
AT

2011/9/6 Yaşar Arabacı 

>
> I have a model with datetime field. I want to get a table with three
> columns as, year, month and number of items in time span. And I also want to
> order them from newest to oldest. What I want to get is something like this:
>
> 2011 August 4
>
> 2011 March 7
>
>  How do you suggest I should do that?
>
> I am trying to add post archives to my front page in my blog. Here is link
> to same question on StackOverflow:
> http://stackoverflow.com/q/7320662/886669
>  --
> http://yasar.serveblog.net/
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Binding two views to one url?

2011-09-08 Thread Andre Terra
What you need to do is browse the class-based views docs for how to handle
forms with them.

https://docs.djangoproject.com/en/dev/ref/class-based-views/#formview

Instead of switching from DetailView to FormView, you can just try to add
some of the mixins that FormView uses. This way you can merge functionality
from different classes:

https://docs.djangoproject.com/en/dev/ref/class-based-views/#django.views.generic.edit.FormMixin
https://docs.djangoproject.com/en/dev/ref/class-based-views/#django.views.generic.edit.ProcessFormView


The documentation is lacking, but try reading those three links and see what
you come up with. Post again if you have any further questions and we'll be
glad to help.


Cheers,
AT

On Thu, Sep 8, 2011 at 4:33 PM, Petey  wrote:

> Is it possible to bind two views to one url adress?
>
> I have a generic view - detail_view and I prepared a form for comments.
> Detail_views generates urls by "type", "pk", "slug" fields. Under each
> publication I'd like to add a form to add my comments model and I dont
> really know how I could do that.
>
> URL - detail view:
>
> url(r'^(?P[\w\-_]+)/(?P\d+)/(?P[\w\-_]+)/$',
> DetailView.as_view(
>  model=Publisher,
>
> template_name='templates/publications/single.html',
> ),
>
>  name = "single_publication"
>  ),
>
> VIEW for form:
> def add_comment(request, type, pk, slug):
> form = CommentsForm()
> return render_to_response('templates/publications/single.html',
> {'form':form}, context_instance=RequestContext(request))
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Ke3ot3Kjd-8J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: How do I render a template variable inside a for loop, when the var is a dict and the key is forloop.counter

2011-09-08 Thread Andre Terra
There is an inflexibility indeed, because the template is meant for
designers, not programmers.

Try {% for key, value in MyList.items %} instead.

A hackier solution would be to write your custom template tag like {%
get_from_dict foo bar %} to try to get foo[bar]. But in this case you can
just use items(), as it's often the case when iterating over dictionaries.


Cheers,
AT

On Thu, Sep 8, 2011 at 4:24 PM, Rami  wrote:

> Hi,
> I have a dict var defined in server side, like PHONE_BOOK={1:'634534',
> 2:'264886', 3:'455346' etc..}
> Then in my django template I have this loop where I need to print the
> PHONE_BOOK[loop counter]:
> {% for Item in MyList %}
>
>  Item.first_name |  PHONE_BOOK.forloop.counter
>
> {% endfor %}
> -
> For some reason PHONE_BOOK.forloop.counter doesn't work and neither
> the more direct ways like PHONE_BOOK[forloop.counter]; it seems to me
> that there's a bit of an inflexibility in the django template renderin
> mechanism.
>
> Any idea how to solve that?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: How do I render a template variable inside a for loop, when the var is a dict and the key is forloop.counter

2011-09-09 Thread Andre Terra
I get it now.. Then go with the hackier solution I proposed!

On Thu, Sep 8, 2011 at 6:18 PM, Rami  wrote:

> Thanks.
> But note that I'm not looking for the dict value in MyList, rather: I
> loop on MyList and (trying to) retrieve the dict value from (another
> var) BOOK_PHONE with key=loop.counter.
> I think that makes it a bit more challenging, but still it's a fairly
> simple case. It's this limitation in the template syntax ... that
> doesn't allow you to do MyDict[key], instead you need to write
> MyDict.key (dot). But my key is "loop.counter", and
> MyDict.loop.counter (2 dots) is too much for the template to be
> interpreted correctly.
>
>
> On Sep 8, 12:51 pm, Andre Terra  wrote:
> > There is an inflexibility indeed, because the template is meant for
> > designers, not programmers.
> >
> > Try {% for key, value in MyList.items %} instead.
> >
> > A hackier solution would be to write your custom template tag like {%
> > get_from_dict foo bar %} to try to get foo[bar]. But in this case you can
> > just use items(), as it's often the case when iterating over
> dictionaries.
> >
> > Cheers,
> > AT
> >
> >
> >
> >
> >
> >
> >
> > On Thu, Sep 8, 2011 at 4:24 PM, Rami  wrote:
> > > Hi,
> > > I have a dict var defined in server side, like PHONE_BOOK={1:'634534',
> > > 2:'264886', 3:'455346' etc..}
> > > Then in my django template I have this loop where I need to print the
> > > PHONE_BOOK[loop counter]:
> > > {% for Item in MyList %}
> >
> > >  Item.first_name |  PHONE_BOOK.forloop.counter
> >
> > > {% endfor %}
> > > -
> > > For some reason PHONE_BOOK.forloop.counter doesn't work and neither
> > > the more direct ways like PHONE_BOOK[forloop.counter]; it seems to me
> > > that there's a bit of an inflexibility in the django template renderin
> > > mechanism.
> >
> > > Any idea how to solve that?
> >
> > > Thanks.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Using gedit for django development

2011-09-13 Thread Andre Terra
Incredible! I'll have to take a look at this over the weekend.

Have you given any thought to wrapping hyperlinks around modules, classes
and functions for easier browsing? This is the #1 (okay, maybe the only)
reason I use Aptana.


Cheers,
AT

On Tue, Sep 13, 2011 at 7:33 AM, Thomas Weholt wrote:

> Very nice. Did some work on making a plug-in for the Editra editor
> with the same goal but your project looks much better, Thanks!
>
> Thomas
>
> On Tue, Sep 13, 2011 at 2:12 AM, Micah Carrick  wrote:
> > I've written a blog post on using gedit, the default text editor in
> GNOME,
> > as a Django IDE. If you're a Linux user and you've never considered using
> > gedit for development then this may be an interesting read for you.
> > http://www.micahcarrick.com/gedit-as-a-django-ide-for-linux.html
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
>
>
>
> --
> Mvh/Best regards,
> Thomas Weholt
> http://www.weholt.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: setting the database when using a rawqueryset

2011-09-13 Thread Andre Terra
Not exactly what you want, but
https://docs.djangoproject.com/en/dev/topics/db/sql/#executing-custom-sql-directly


Cheers,
AT

On Tue, Sep 13, 2011 at 5:51 PM, Robert  wrote:

>
> I have inherited the support of a Django application and am new to the
> language so I would appreciate some advice.  The application requires
> getting data from different databases depending on the client.
>
> The existing code uses the syntax:   table>.objects.using(self.CLIENT_DB).get to connect to the correct
> databse.
>
> However, I have some queries that are so complex I have had to use the
> rawqueryset with SQL commands such as "for record in  table>.objects.raw() . . .".  Apparently "using" is
> not an available attribute of the rawqueryset.  What is the best way
> to dynamically change databases when using a rawqueryset?
>
> Thanks for your guidance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: setting the database when using a rawqueryset

2011-09-14 Thread Andre Terra
Take a look at the aggregation docs at http://django.me/aggregation for sum,
group by, etc.


Cheers,
AT

On Tue, Sep 13, 2011 at 7:44 PM, Robert  wrote:

>
> I apologize for using AT rather than your name, Andre.
>
> On Sep 13, 6:42 pm, Robert  wrote:
> > Thanks, AT.  Actually this is the article where I learned how to do
> > raw SQL in Django. It made life easy for complex queries.
> > Unfortunately it does not specify how to dynamically set the database
> > for the RawQuerySet.  I am hoping there is an easy way to do it so I
> > can avoid a complete rewrite.  The alternative is to figure out how to
> > do what I think are complex queries (includes subqueries, group by,
> > having, sum commands) using the ORM QuerySet.
> >
> > On Sep 13, 5:01 pm, Andre Terra  wrote:
> >
> >
> >
> > > Not exactly what you want, buthttps://
> docs.djangoproject.com/en/dev/topics/db/sql/#executing-custom...
> >
> > > Cheers,
> > > AT
> >
> > > On Tue, Sep 13, 2011 at 5:51 PM, Robert  wrote:
> >
> > > > I have inherited the support of a Django application and am new to
> the
> > > > language so I would appreciate some advice.  The application requires
> > > > getting data from different databases depending on the client.
> >
> > > > The existing code uses the syntax:   > > > table>.objects.using(self.CLIENT_DB).get to connect to the correct
> > > > databse.
> >
> > > > However, I have some queries that are so complex I have had to use
> the
> > > > rawqueryset with SQL commands such as "for record in  > > > table>.objects.raw() . . .".  Apparently "using" is
> > > > not an available attribute of the rawqueryset.  What is the best way
> > > > to dynamically change databases when using a rawqueryset?
> >
> > > > Thanks for your guidance.
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> Groups
> > > > "Django users" group.
> > > > To post to this group, send email to django-users@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/django-users?hl=en.-Hide quoted text -
> >
> > > - Show quoted text -- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: setting the database when using a rawqueryset

2011-09-14 Thread Andre Terra
And I apologize for not even saying yours, Robert!


Yours,
André


On Wed, Sep 14, 2011 at 9:32 AM, Andre Terra  wrote:

> Take a look at the aggregation docs at http://django.me/aggregation for
> sum, group by, etc.
>
>
> Cheers,
> AT
>
>
> On Tue, Sep 13, 2011 at 7:44 PM, Robert  wrote:
>
>>
>> I apologize for using AT rather than your name, Andre.
>>
>> On Sep 13, 6:42 pm, Robert  wrote:
>> > Thanks, AT.  Actually this is the article where I learned how to do
>> > raw SQL in Django. It made life easy for complex queries.
>> > Unfortunately it does not specify how to dynamically set the database
>> > for the RawQuerySet.  I am hoping there is an easy way to do it so I
>> > can avoid a complete rewrite.  The alternative is to figure out how to
>> > do what I think are complex queries (includes subqueries, group by,
>> > having, sum commands) using the ORM QuerySet.
>> >
>> > On Sep 13, 5:01 pm, Andre Terra  wrote:
>> >
>> >
>> >
>> > > Not exactly what you want, buthttps://
>> docs.djangoproject.com/en/dev/topics/db/sql/#executing-custom...
>> >
>> > > Cheers,
>> > > AT
>> >
>> > > On Tue, Sep 13, 2011 at 5:51 PM, Robert  wrote:
>> >
>> > > > I have inherited the support of a Django application and am new to
>> the
>> > > > language so I would appreciate some advice.  The application
>> requires
>> > > > getting data from different databases depending on the client.
>> >
>> > > > The existing code uses the syntax:  > > > > table>.objects.using(self.CLIENT_DB).get to connect to the correct
>> > > > databse.
>> >
>> > > > However, I have some queries that are so complex I have had to use
>> the
>> > > > rawqueryset with SQL commands such as "for record in > > > > table>.objects.raw() . . .".  Apparently "using" is
>> > > > not an available attribute of the rawqueryset.  What is the best way
>> > > > to dynamically change databases when using a rawqueryset?
>> >
>> > > > Thanks for your guidance.
>> >
>> > > > --
>> > > > You received this message because you are subscribed to the Google
>> Groups
>> > > > "Django users" group.
>> > > > To post to this group, send email to django-users@googlegroups.com.
>> > > > To unsubscribe from this group, send email to
>> > > > django-users+unsubscr...@googlegroups.com.
>> > > > For more options, visit this group at
>> > > >http://groups.google.com/group/django-users?hl=en.-Hide quoted text
>> -
>> >
>> > > - Show quoted text -- Hide quoted text -
>> >
>> > - Show quoted text -
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

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



Re: Class-based views or "Traditional" Views for Django 1.3?

2011-09-14 Thread Andre Terra
OTOH, getting the hang of it can be hard with the current state of the docs
and given that they require a completely different mindset when coding
views.


Cheers,
AT

On Wed, Sep 14, 2011 at 10:35 AM, Donald Stufft wrote:

>  Class Based Views let you override and subclass views to modify their
> behavior, I find them to be very quick once you get the hang of them.
>
> On Wednesday, September 14, 2011 at 9:33 AM, Kurtis wrote:
>
> Hey Guys,
>
> I'm relatively new to Django 1.3. As others have noticed, there is
> less documentation around the Class-Based views than typical for
> Django. No needs for apologies as I have seen in other threads. I
> don't blame others for my lack of knowledge :)
>
> If I am working on a large project from scratch, would it be smart to
> just use the traditional, function/method-based views? Or should I go
> ahead and try to adapt the class-based views? I am working on a
> deadline so the amount of time burnt searching more in-depth for my
> answers could be a problem. On the other hand, if there are any
> advantages to using Class-based views, I may want to take advantage of
> them. Unfortunately, I don't know enough about the Class-based views
> to really weigh that out on my own. Any information regarding this
> decision would be greatly appreciated.
>
> Thanks!
> -Kurtis Mullins
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: SCGI error

2011-09-14 Thread Andre Terra
On Wed, Sep 14, 2011 at 6:10 AM, Tom Evans  wrote:

I'm not entirely experienced with scgi or uWSGI, but I'm almost
> certain that neither of them talk HTTP, which is what Firefox uses to
> talk to servers. You need to connect your WSGI/SCGI server to a HTTP
> server like Apache, lighttpd, Cherokee or similar. (...)
>

Don't forget nginx!


Cheers,
AT

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



Re: Cannot Connect to Server with Postgresql (9.0)

2011-09-15 Thread Andre Terra
Hello, Eric

Welcome to Django!

* Can you ping the server?

* Are you sure about your username and password? Try creating a new login
role through PgAdmin and use that instead to see if the error is in the
connection or in the authentication process.

* Does your pg_hba.conf file have an entry which matches the IP from which
you are accessing the database? (check towards the very end) -- this
shouldn't raise an error on localhost connections, but you never know

Try #django and #postgres on irc.freenode.org for help too!


Cheers,
AT


On Thu, Sep 15, 2011 at 3:37 PM, ericdoesdjango  wrote:

> Windows (vista)
>
> I did the djangoproject tutorial and I am now going through
> djangobook.  The first time (going through the djangoproject
> tutorial), after creating tables, I tried to enter values in the table
> through the django models.  This was a couple of weeks ago and I
> forgot what error it returned.  I then switched into my postgres shell
> and entered the first data entry manually.  It worked and I was able
> to enter subsequent data through the Django framework, so I didn't
> think much of it.
>
> More recently (going through the djangobook example), I have set up a
> database connection and created my first tables.  Again I tried to
> enter the first table values through Django's models framework.  This
> time I received the error:
>
> 'could not connect to the server: connection refused (0x274D/
> 10061)
> is the server running on host ??? and accepting TCP/IP connections on
> port 5432?'
>
> At first I thought this may have been a problem with my host info in
> the settings.py file.  However, I now receive this same message when I
> try to login to postgres from the windows command line (except '???'
> is replaced with 'localhost').
>
> I've never had this problem before when using postgres.
> 1.  How might have Django caused this problem?
> 2.  How can I fix it?  I'm new to Postgresql as well, so I have been
> having difficulty finding out how to fix it on their end.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: When is a good time to use db_index? Rule of thumb?

2011-09-16 Thread Andre Terra
Wow, great question and even better answers! Amazing help indeed.

Thanks everyone, I learned a bunch from this too. Enjoy the weekend!


Cheers,
AT

On Fri, Sep 16, 2011 at 1:52 PM, Micky Hulse  wrote:

> Thank you Micah, Donald and Doug! I really appreciate the help! :)
>
> That really helps to clear things up for me.
>
> Have a great weekend.
>
> Cheers,
> Micky
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Calculated value that depends in related models

2011-09-19 Thread Andre Terra
Have you considered using a cache/store backend like redis[1] instead of
saving the result to the database?

Using this approach, you can write a custom model method for returning the
calculation, which can be called manually every time you need the result.
The key difference being that this method try to get the result from the
cache first, and defer the calculation to the cases when that fails.

Finally, add a method for invalidating the cache (i.e. deleting the value
that was previously stored) and call that you can every time either one of
the models gets saved.

Write a key composed of the model's app_label, module_name and pk, a custom
string to identify this calculation, perhaps some params and you're good to
go.

django-cache-utils[2] can help in some cases, or you can write the cache
setting/getting/invalidating on your own.

I (and many others like me) recommend redis and django-redis-cache[3] for
this.


Cheers,
AT

[1] http://redis.io/
[2] https://bitbucket.org/kmike/django-view-cache-utils
[3] https://github.com/sebleier/django-redis-cache


On Mon, Sep 19, 2011 at 12:24 PM, graeme  wrote:

> I want to save a calculated value to a model field. The calculation
> takes a few seconds and I need to query by it, so I think the
> denormalisation is justified.
>
> The problem is that the calculation requires data from two related
> models: one of which is the "through" model of a ManyToMany
> relationship, the other of which has a for (i.e. we are looking at the
> reverse side of it).
>
> Is there any way of calling the calculation after BOTH the related
> models have been saved? If there is a way of guaranteeing the order in
> which they are saved i could use a post_save or m2m_changed signal on
> one of them.
>
> Alternatively, as both are inlines in the admin, I think I could
> customise save_formset, but I have not been able to find any examples
> or much documentation for this.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Web Designer

2011-09-26 Thread Andre Terra
Please refer to our recent thread with suggestions for development
environments. There's enough there already to get anyone started.

On the web:
https://groups.google.com/forum/#!msg/django-users/ZwVHa0jBRrY/Fq-jCVxrK7AJ


Cheers,
AT



On Mon, Sep 26, 2011 at 1:25 PM, Sushirod  wrote:

>
> Good sugestions, I`ll take a look at this!
>
> On 26 set, 04:32, Markus Gattol  wrote:
> > I'd say most people us a simple text editor such as Vim, Emacs... If you
> use
> > runserver and and your browsers auto-reload for that tab then that's all
> you
> > need. If you want to be a bit speedier then you can use things like
> > Sass/Compass for your CSS and maybe HamlPy for your HTML. Both have
> "watch"
> > commands that watch your .sass/.haml files and automatically create the
> > .css/.html which would then be picked up be runserver which in turn gets
> > reloaded by your browser's tab for which you set the autoload toggle.
> >
> > for HTML
> >  -https://github.com/jessemiller/HamlPy
> >
> > for CSS
> >  -https://github.com/chriseppstein/compass(is written in Sass)
> >  -https://github.com/nex3/sass
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: DJango doesn't work with Oracle 11g on Windows 8

2011-09-26 Thread Andre Terra
Windows 8?

On Sat, Sep 24, 2011 at 5:27 AM, Benjamin Welton <
benjamin.r.wel...@wmich.edu> wrote:

>  Hey Alec,
>
> django.core.exceptions.ImproperlyConfigured: Error loading cx_Oracle
> module: DLL load failed: %1 is not a valid Win32 application.
>
> Do you have the visual c redistributable installed for 64bit and the Python
> for windows extensions for 64bit installed?
>
> Ben
>
>
> On 9/24/2011 3:17 AM, Alec Taylor wrote:
>
> Good afternoon,
>
> Unfortunately DJango doesn't work with Oracle 11g Express on Windows 8 x64.
>
> DJango error: http://pastebin.com/8tAzsjYh (summary: "No module named
> cx_Oracle")
>
> pip install cx_Oracle output: http://pastebin.com/6Y61PqSM
>
> easy_install cx_Oracle output: http://pastebin.com/rCsY63RS
>
> Summary: "Unable to find vcvarsall.bat"
>
> When I try tried the x64 installer fromhttp://cx-oracle.sourceforge.net/ 
> (using Python 2.7 x64), I got the
> following manage.py syncdb error: http://pastebin.com/syqxF4m6
>
> How can I make DJango work with my Oracle 11g Express database?
>
> Thanks for all suggestions,
>
> Alec Taylor
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: DJango doesn't work with Oracle 11g on Windows 8

2011-09-26 Thread Andre Terra
It's just that if I were trying to get django working on windows 8, I
wouldn't start with an Oracle setup.


Cheers,
AT

On Mon, Sep 26, 2011 at 6:14 PM, Benjamin Welton <
benjamin.r.wel...@wmich.edu> wrote:

>  Windows 8?
>
>
> Its possible he's using it on Windows 8 since the developer preview is
> available. If he actually is id be curious to know if everything works ok on
> windows 8 with python/django.
>
> Ben
>
>
> On 09/26/2011 04:10 PM, Andre Terra wrote:
>
> Windows 8?
>
> On Sat, Sep 24, 2011 at 5:27 AM, Benjamin Welton <
> benjamin.r.wel...@wmich.edu> wrote:
>
>>  Hey Alec,
>>
>> django.core.exceptions.ImproperlyConfigured: Error loading cx_Oracle
>> module: DLL load failed: %1 is not a valid Win32 application.
>>
>> Do you have the visual c redistributable installed for 64bit and the
>> Python for windows extensions for 64bit installed?
>>
>> Ben
>>
>>
>> On 9/24/2011 3:17 AM, Alec Taylor wrote:
>>
>> Good afternoon,
>>
>> Unfortunately DJango doesn't work with Oracle 11g Express on Windows 8 x64.
>>
>> DJango error: http://pastebin.com/8tAzsjYh (summary: "No module named
>> cx_Oracle")
>>
>> pip install cx_Oracle output: http://pastebin.com/6Y61PqSM
>>
>> easy_install cx_Oracle output: http://pastebin.com/rCsY63RS
>>
>> Summary: "Unable to find vcvarsall.bat"
>>
>> When I try tried the x64 installer fromhttp://cx-oracle.sourceforge.net/ 
>> (using Python 2.7 x64), I got the
>> following manage.py syncdb error: http://pastebin.com/syqxF4m6
>>
>> How can I make DJango work with my Oracle 11g Express database?
>>
>> Thanks for all suggestions,
>>
>> Alec Taylor
>>
>>
>>
>>--
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Extracting the database name from an object

2011-09-27 Thread Andre Terra
It doesn't hurt to remind him that methods that begin with _ are considered
unstable API and are subject to change/removal without previous notice.


Cheers,
AT

On Tue, Sep 27, 2011 at 3:51 PM, Willem Romijn  wrote:

> ob._state.db, according to this article:
>
>
> http://stackoverflow.com/questions/4146781/does-a-django-model-know-from-which-database-it-was-loaded-and-how-can-this-info
>
> 2011/9/27 Juan Pablo Romero Méndez 
>
>> Hello,
>>
>> Suppose I get an object from a non-default database:
>>
>> ob = MyModel.objects.using('somedb').get(pk=1)
>>
>> Is it possible later to retrieve the database name just from the object?
>>
>> ob.db??
>>
>> Regards,
>>
>>  Juan Pablo
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: psycopg2 pickling error

2011-09-28 Thread Andre Terra
Thanks for providing this feedback, Tom. I read your original question but I
wasn't sure of the answer, so it's good to know how you worked it out!

Best regards,
AT

On Wed, Sep 28, 2011 at 4:51 AM, tom  wrote:

> Hello,
>
> I have solved the problem with the support from newrelic, the issue was
> related to the configuration of wsgi. I have 3 VHosts for the application. I
> switched from wsgi embedded mode to daemon mode. Additionally I have added
> these two lines for each VHost:
>
> WSGIDaemonProcess www.agileamp.com user=user group=group processes=2
> threads=15 display-name=%{GROUP}
> WSGIProcessGroup www.agileamp.com
>
> Best regards, Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Q6WENc5zBYMJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Two django apps (models) using same table

2011-09-29 Thread Andre Terra
Perhaps https://docs.djangoproject.com/en/dev/ref/models/options/#db-table ?

But you really shouldn't describe the same table twice, if it's exactly the
same thing. Move the models.py to a standalone "app" and have your two apps
refer to that instead.


Cheers,
AT

On Thu, Sep 29, 2011 at 2:28 PM, IgorS  wrote:

> I am new to Django. It might be a very easy question but i could not
> google it...
>
> If i have two django apps in the same project and both apps need to
> use the same table in the same database, how should i describe this
> table in two different models.py files.
>
> Thank you,
> -igor
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Simple input forms which show more than one row - easy/possible in django?

2011-10-05 Thread Andre Terra
I've only skimmed this thread, but I recommend django-form-utils[1] if what
you want is to write nicely formatted forms with little to no headache at
all.

[1] https://bitbucket.org/carljm/django-form-utils/overview


Cheers,
AT

On Wed, Oct 5, 2011 at 1:05 PM, Chris G  wrote:

> On Wed, Oct 05, 2011 at 03:13:08PM +, Brett Epps wrote:
> > Hi Chris,
> >
> > Once you've defined a model for your data, you can use a ModelForm [1] to
> > automatically generate a form for that model.
> >
> > You might also want to check out the admin site [2], which displays data
> > in a tabular format similar to what you describe.
> >
> Yes, I'd seen that, can I get the admin forms to work 'outside' as it
> were?
>
> > 1. https://docs.djangoproject.com/en/dev/topics/forms/modelforms/
> > 2. https://docs.djangoproject.com/en/dev/ref/contrib/admin/
> >
> Thanks, it looks as if ModelForm will do most of what I want.
>
> --
> Chris Green
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: What is the right way to use S3 as a storage backend?

2011-10-05 Thread Andre Terra
I may be dreaming, but IIRC ADMIN_MEDIA_PREFIX is on its way to deprecation,
so some googling might be in order.

Cheers,
AT


On Wed, Oct 5, 2011 at 11:07 AM, Kurtis  wrote:

> Okay, two things.
>
> 1. I saw I was potentionally using the wrong URL. I believe it should
> be my CDN URL. Correct me if I'm wrong but the right URL *should* be
> along the lines of: http://dw2u7t9lse636.cloudfront.net/
>
> 2. I included that ADMIN_MEDIA_PREFIX setting and it did update the
> URLs for Admin media. Thanks!
>
> Unfortunately, and this is probably an issue with Amazon -- I get a an
> access denied error when I try to access my files. For example:
>
> http://dw2u7t9lse636.cloudfront.net/css/base.css
>
> On Oct 5, 10:01 am, Kurtis  wrote:
> > I'll give that a shot. I pushed my bucket to the CDN and tried to set
> > that URL manually using:
> >
> > STATIC_URL = 'http://kurtis.s3.amazonaws.com/'
> >
> > Unfortunately, it's still trying to use /static/... Hopefully your
> > idea will work. Thanks!
> >
> > On Oct 5, 9:54 am, Shawn Milochik  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Could it be the ADMIN_MEDIA_PREFIX setting?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: How to make Django pick new urls immediately

2011-10-07 Thread Andre Terra
That is correct.

I believe you could go even further and not even prefix the app's urls, by
adding an empty path (r'^', include('api.urls')),

I don't quite remember what the raw string should look like, but this would
let you apply your app's url patterns to the root of your domain, which in
some cases is useful.


Cheers,
AT

On Fri, Oct 7, 2011 at 5:51 AM, Kayode Odeyemi  wrote:

> On Fri, Oct 7, 2011 at 9:33 AM, Daniel Roseman wrote:
>
>> On Friday, 7 October 2011 09:20:03 UTC+1, Kayode Odeyemi wrote:
>>>
>>> 2011/10/6 Yaşar Arabacı 
>>>
>>> maybe you should restart the server? And, do you include new urls in your
 root url config?

 OK! I just found out that if you have urls.py in different packages and
>>> these urls.py files are all included in the root package urls.py file of the
>>> app, if I have a url (say /post) defined within a python module in the
>>> package app.api, I will have to access the url like this
>>> http://example.com/api/post and not http://example/post. I was
>>> attempting the later which is the reason for the 404.
>>>
>>
>> No, that's not true. The name of the app has nothing to do with it.
>> Rather, it's the name you give when you include the app's URLs:
>>
>> (r'^randomname/', include('api.urls'))
>>
>> That will include the 'api' app's URLs with the prefix 'randomname', so
>> you would do example.com/randomname/post/.
>>
>
> If I understand you clearly, that means for all views in api/views.py which
> has its urls.py (which is within /api) included in the root package of the
> app like so: (r'^api/', include('api.urls')), will be accessed like this:
> http://example.com/api/[url-pattern]?
>
> --
> Odeyemi 'Kayode O.
> http://www.sinati.com. t: @charyorde
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Why can't "directly" change array elements of model objects in Django shell?

2011-10-07 Thread Andre Terra
The easiest way would be to slice the list exactly how you were doing with
x[3]... It doesn't get much easier than that.

I guess if you really need to spare yourself three keystrokes, you can do it
like this:

>>> x = YourModel.objects.all()[3]
>>> x.foo = 'bar'
>>> x.save()


Cheers,
AT

On Fri, Oct 7, 2011 at 6:01 PM, Chris Seberino  wrote:

>
>
> On Oct 7, 10:39 am, Jacob Kaplan-Moss  wrote:
> > On Fri, Oct 7, 2011 at 10:30 AM, Chris Seberino 
> wrote:
> >
> > > I've noticed that this doesn't often work in Django shell...
> >
> > > x = MyModel.objects.all()
> > > x[3].some_field = "new value"
> > > x[3].save()
>
> > This is because `MyModel.objects.all()` isn't a list; it's a QuerySet.
> > That is, `MyModel.objects.all()` *doesn't* hit the database until you
> > say `x[3]`, at which point Django performs a query with a LIMIT and
>
> OK.  I understand.  What is easiest way then to *force* my x[3] code
> above to hit the database so that
> my changes are permanent?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Profiling Django

2011-10-12 Thread Andre Terra
A good place to start is using django-debug-toolbar and taking a look at the
queries generated for each view, so that you know what's taking long. There
are tools for monitoring database performance, but I have no experience with
them, so I'll leave it to other members in this list to make the
recomendations. Maybe go after disk read/write monitoring if you have access
to that?

When possible, moving the big functions in your code to asynchronous celery
tasks [1] will nearly always speed things up.

If you're doing big (hundreds of thousands of rows) db calls, try using DSE
[2]

[1] http://readthedocs.org/docs/django-celery/en/latest/
[2] http://pypi.python.org/pypi/dse


Cheers,
AT


On Wed, Oct 12, 2011 at 10:19 AM, <
michael.pimmer@boehringer-ingelheim.com> wrote:

> **
>
> The django application I am working on is very slow on the server-side, and
> I want to know why.
> The essence is to identify which code-parts of processing one request take
> most time.
>
> The app runs with mod_wsgi on Apache, here is what I tried:
>
> - django-timelog: the information logged is too unspecific and
> high-leveled. I want to know which functions and parts of a view require
> most time. (moreover, analyze_timelog doesn't work here)
> - django-debug-toolbar with profiling from
> http://backslashn.com/post/505601626/ - too fine-grained:
>I do not want to know that 138752 calls to
> python2.6/posixpath.py:129(islink) take 0.858 seconds. I want to know in
> which views / functions it happens.
> - profiling with wsgiref, like described in
> https://code.djangoproject.com/wiki/ProfilingDjango#no1 - looks like (and
> probably is?) exactly the same output as the django-debug-toolbar with
> profiling: too fine-grained, I want to get an overview, not the pure
> low-level calls.
>
> What is your preferred way to analyze/profile the performance of
> django-applications?
>
> thanks,
> Michael
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Second coming of Java?

2011-10-13 Thread Andre Terra
On Thu, Oct 13, 2011 at 7:04 AM, Petite Abeille wrote:

> (...)
>
> How To Write Unmaintainable Code.
> http://thc.org/root/phun/unmaintain.html
>
> Tangentially related:
>
> Big Ball of Mud
> http://www.laputan.org/mud/
>
>
I had read Big Ball of Mud before, but "How to Write Unmaintainable Code" is
just too good! hahahahah thank you so much for that link


Cheers,
AT

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



Re: a django question about "python manage.py syncdb"

2011-10-14 Thread Andre Terra
models should be lowercase, because that's the standard for every single
python package.


Cheers,
AT

On Fri, Oct 14, 2011 at 6:23 AM, Chen Xu  wrote:

> Hi,
> I am new to Django.
> I have installed Django and go t everything set up correctly, just started
> some easy tutorials.
>
> So when I do
> Django-admin.py startapp  blog
>
>
> it creates a /blog directory that looks like thsi
> /blog
> - __init__.py
> - tests.py
> - models.py
> - views.py
>
> I know in Django, when you run "python manage.py syncdb", it will look
> through models.py, and create all the table it finds.
> However, I dont want to create all my tables in models.py, becaue when my
> proj get bigger, it is hard to maintain.
> Therefore, I create a subdirectory "/Models" to store all my model
>
> /blog
> - __init__.py
> - tests.py
> - models.py
> - views.py
> /Models
> - __init__.py
> post.py
>
>  so in my
> models.py: (only 2 lines)
> from django.db import models
> from blog.Models import post
>
> in my post.py: (only 3 lines)
> from django.db import models
> class post(models.Model):
>   body = models.TextField()
>
>
> and then when I run "python manage.py syncdb" , it doesn't create the table
> "post" for me.
>
> Could anyone please help?
>
>
>
>
> Thanks very much
> Best regards
>
>
> --
> ⚡ Chen Xu ⚡
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Automaticall list all fields of generic model in template

2011-10-17 Thread Andre Terra
Even better, use django-form-utils!

https://bitbucket.org/carljm/django-form-utils/overview


Cheers,
AT

On Sun, Oct 16, 2011 at 7:57 PM, Mario Gudelj wrote:

> I think you need this
> https://docs.djangoproject.com/en/dev/topics/forms/modelforms/
>
>
> On 16 October 2011 18:24, bovender  wrote:
>
>> Hi all,
>>
>> new to Django and loving it.
>>
>> Is there a way to automatically generate HTML output for the fields of a
>> model instance?
>>
>> I'm looking for something similar to form.as_table, just without the form
>> widgets.
>>
>> Currently I find myself manually repeating all the typing work for the
>> detail view templates that I already did for the model definitions.
>>
>> Thanks
>>
>> bovender
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/iGP654BL2HMJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Class Based FormView - Initial Logic

2011-10-17 Thread Andre Terra
Maybe some place inside get(), dispatch() or get_form_kwargs()?


Cheers,
AT

On Mon, Oct 17, 2011 at 3:57 PM, Kurtis  wrote:

> Hey,
>
> I have a FormView and a Form. I want to put in some logic that will
> take place before the Form is even displayed. I know I could throw
> this in a decorator and wrap the View but there's only a couple of
> views that need this specific functionality and didn't see a need for
> a whole new decorator.
>
> I know I can override the form_valid and form_invalid methods. There's
> also several "get_foo" methods I see in the source. I'm just not
> really sure where I would/could put code in that will run before the
> Form is even displayed or processed (in case they just bypass my view
> and try to throw POST data right at it, which probably wouldn't matter
> because of the CSRF).
>
> Any ideas?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



  1   2   3   4   5   >