Re: IDE for Python/django

2010-09-28 Thread Steve Boyle
I've used Aptana for a while now and it's worked great for me.

http://www.aptana.com/

rgds

On Sep 27, 2:07 pm, Carlos Daniel Ruvalcaba Valenzuela
 wrote:
> So far there is 3 big ones for django, Eclipse + PyDev or Aptana +
> PyDev, WingIDE (latest version can even debug django templates) and
> PyCharm.
>
> If you want something OSS or Free Eclipse or Aptana, otherwise you may
> want to checkout both WingIDE and PyCharm to see if you like one of
> those.
>
> Personally I like PyCharm so far.
>
> Regards,
> Carlos Ruvalcaba
>
> On Mon, Sep 27, 2010 at 6:00 AM, girish shabadimath 
> wrote:
> > actually i use vim for writing python scripts , i wanted IDE to easy my
> > tasks of writing script (like auto-completion) ,,,i dont want GUI based,,i
> > prefer  editor like vim which supports python scripts
>
> > On Mon, Sep 27, 2010 at 6:26 PM, Sithembewena Lloyd Dube 
> > wrote:
>
> >> Hi Girish,
>
> >> I do not know what platform you work on, but on Windows try Jetbrains
> >> PyCharm. On Linux, try SPE, or Eclipse with Pydev extensions (the latter is
> >> also available on Windows).
>
> >> What are you looking for in an IDE? Give more info to get a better answer.
>
> >> On Mon, Sep 27, 2010 at 2:52 PM, Masklinn  wrote:
>
> >>> On 2010-09-27, at 14:51 , girish shabadimath wrote:
> >>> > hi all,
>
> >>> > is there any IDE for Python/Django ?
> >>> Yes.
>
> >>> --
> >>> 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
>
> >> --
> >> 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.
>
> > --
> > Girish M 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-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: using both SQL and NonSql (MondoDB) in same project?

2010-09-28 Thread Julie Andrews
Thanks

On Tue, Sep 28, 2010 at 12:06 PM, Daniel Roseman wrote:

> On Sep 27, 9:43 pm, Bill Seitz  wrote:
> > I know Django will support multiple SQL databases by just having a
> > tuple of DATABASES entries in settings.py.
> >
> > But can I put a single item in DATABASES for a SQL part, and a 'from
> > mongoengine import connect' section in as well?
> >
> > I'd like to have users/accounts/payments in SQL, and all my main/
> > messier stuff in MongoDB
>
> Any MongoDB stuff you put in is external to Django itself and will
> rely on third-party libraries. So, you can do what you like with it.
>
> We're doing something very similar at the moment.
> --
> 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.
>
>


-- 
Julie
tradinglogically.blogspot.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.



RSS error

2010-09-28 Thread Gabriel - Iulian Dumbrava
Hi guys,

I'm trying to make the rss work. I managed to call the
"LatestGalleriesFeed" function by using direct pointing in url
(commented out in the urlpatter bellow), but when trying to use the
generic view with the feeds mapping I get the error "object.__new__()
takes no parameters"

Thanks!
Gabriel - Iulian Dumbrava

This is my configuration:

from verticalsoftware.galleries.models import LatestGalleriesFeed

feeds = {
#'articles': ArticlesFeed,
'blogs': LatestEntries,
#'podcasts': PodcastFeed,
'gallery': LatestGalleriesFeed,
}

urlpatterns = patterns('',
(r'^feeds/(?P.*)/', 'django.contrib.syndication.views.feed',
{'feed_dict': feeds}),
#(r'^feeds/$', LatestGalleriesFeed()),
...


and the function is:

class LatestGalleriesFeed(Feed):
title = "Chicagocrime.org site news"
link = "/sitenews/"
description = "Updates on changes and additions to
chicagocrime.org."

def items(self):
return Gallery.objects.all().order_by('-date_added')[:5]

def item_title(self, item):
return item.title

def item_description(self, item):
return item.description

def item_link(self, item):
return item.get_self_url

-- 
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: Where do you put your business logic in django? Organizing big projects in django.

2010-09-28 Thread Benedict Verheyen
On 27/09/2010 23:59, Diederik van der Boor wrote:


> SInce watching that video, my projects are composed by default of 2 apps. A 
> "projectname" for the core backend stuff, and a "projectname-site" with the 
> templates, settings, and frontend media. This is imho a nicer base to start 
> "hooking in" more applications.

Can you give an example of the second application where you put the templates,
settings and so on?
I'm trying to put all the media, templates in the application directory.
However, it's not clear to me how i can do this as you end up with 2 media 
url's.
One for the project and one for the applications, same goes for the templates.

Regards,
Benedict

-- 
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: SITE_ID

2010-09-28 Thread Benedict Verheyen
On 27/09/2010 12:19, Tim Sawyer wrote:
>> On 25/09/2010 18:32, Tim Sawyer wrote:
>>> On 25/09/10 15:57, craphunter wrote:
 Yes, I have read it, but I don't really get it. What is the meaning of
 it?
>>>
>>> Consider a website that has multiple blogs, all of which are deployed to
>>> the same database.
>>>
>>> Consider that you want each blog to be a separate URL: www.blog1.com,
>>> www.blog2.com, but you only want one database for ease of backing up
>>> etc.
>>>
>>> So, you have one codebase, one database, but multiple sites.
>>>
>>> You can achieve this using SITE_ID.  www.blog1.com has a settings.py
>>> with SITE_ID = 1.  www.blog2.com has a settings.py file with SITE_ID =
>>> 2.  In your database, there are two rows in the django_site database
>>> table, with serials 1 and 2.  The table that holds the blog entries has
>>> a foreign key to Site, and so identifies which site the blog post
>>> appears on.
>>>
>>> At least that's how I used it...hope that helps clarify it a bit!
>>>
>>> Tim.
>>
>> Hey Tim,
>>
>> the way you used it would mean that you had different settings.py per
>> site/url and thus
>> a project per url as 1 project can only have 1 settings file? Is this
>> correct?
>> Have do you config the admin then so you see both sites in the same admin?
> 
> Hi Benedict,
> 
> Yes that's correct.  Each settings.py is a separate virtual host in
> Apache.  The rest of the source was common (on the pythonpath).  So the
> pythonpath was the same for each virtual host but there was a uniquely
> named settings.py refered to from the mod-wsgi config.
> 
> These were distinct sites for distinct customers, so each site had its own
> admin, limited to that site's data.
> 
> Here's the mechansim I used to limit the admin to that site's objects.  I
> think if you don't do any of this, each admin will have all the data
> available in it, if that's what you want.
> 
> Each model had an additional manager:
> 
> from django.contrib.sites.managers import CurrentSiteManager
> 
> class Contest(models.Model):
> ...
> objects = models.Manager()
> on_site = CurrentSiteManager()
> 
> and in the admin.py I redefined the queryset:
> 
> class ContestAdmin(SiteOnlyAdmin):
> def queryset(self, request):
> return self.limitQueryset(request, Contest)
> 
> admin.site.register(Contest, ContestAdmin)
> 
> where limitQueryset is defined on the superclass as:
> 
> def limitQueryset(self, request, pObject):
> return pObject.on_site.all()
> 
> Hope that helps,
> 
> Tim.
> 

Tim,

that helped, thanks for sharing the information !

Regards,
Benedict


-- 
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: notification in python

2010-09-28 Thread harryos

> You could also try looking at the HTTP headers for a request for e.g. 
> "index.htm" using urllib. Specifically the "Expires" and "Last-Modified".
> Using headers values requires that you can trust the site on the header 
> content. Web servers and caching proxies can do all sorts of things with the 
> headers. Otherwise, saving the hash of the raw HTML (without GIFs etc.) as 
> suggested is a good approach. Depending on what your definition of "updated" 
> is.
>


thanks Erik,
By 'update' I meant a major addition/removal of text(say 100
characters).
Initially I thought of making hash of a page and comparing it to the
saved hash of the same page  at a different moment of time..But ,this
would
cause even a tiny change to be considered as an update..I would like
to use a filter to set an update of x number of characters.
May be using f=urllib.urlopen and
currentsize=len(f.read())  will let me find the number of added/
removed characters..and set the filter accordingly..

any other suggestions most welcome
harry


-- 
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: Where do you put your business logic in django? Organizing big projects in django.

2010-09-28 Thread Benedict Verheyen
On 28/09/2010 0:48, bruno desthuilliers wrote:
> 
> 
> On 27 sep, 17:31, Thomas Weholt  wrote:
>> On Mon, Sep 27, 2010 at 4:52 PM, bruno desthuilliers
>>
> 
>>> ??? Which "django specific magic" ???
>>
>> I was referring to syncdb. As far as I know, models defined outside
>> any models.py or models module won`t be picked up by syncdb, but I
>> might be wrong.
> 
> s/module/package/ !-)
> 
> but there's no "magic" involved here - just a naming convention - and
> startapp has nothing to do with it.
> 
 It`s obviously not clear to all django users
 how to best handle growing projects, split into modules etc
>>
>>> I can only second Steve on this : time for "Python for Djangonauts"
>>> class then. FWIW, I'm amazed at how many persons seem to pick up
>>> django without any background in Python.
>>
>> Hmmm ... do you or Steven know anything about my programming
>> background?
> 
> Nope, and neither Steve nor I did question your competence. The above
> remark was not specifically about you, and was not intended as
> criticism FWIW, quite on the contrary. Now I don't think there's that
> much Django-specific knowldege involved when it comes to managing a
> growing code base, and Django's manual is about Django, not about
> Python.
> 
> (snip the remaining - Steve already answered better than I could do)
> 

I agree with Thomas that at least some guidelines would be nice.
As what you and Steve have been saying about the need for a "Python for 
Djangonauts" class,
i think it would be a good idea also.
I'm wondering though what specific Python topics you would touch?
One that comes to mind is the use __init__,py and this modules in general as 
this
knowledge is needed to understand how you can split your models and views.

This would be what i would put in the guidelines for code structuring.
Topics i think would be interesting:
1. Project vs App
- What is a project? When do you use applications?
- Possible examples of coding structure
- 1 site in 1 project
- many sites in 1 project
- ...
2. Splitting models & views
3. How can you cleanly seperate an application further from a project
4. Building reusable applications
5. Advanced building methods
- Buildout
- Virtualenv
- ...

If we could agree on a list of topics, we can start writing it ourselves.
We have people here with lots of experience regarding these kind of
more advanced topics.
I wouldn't mind to write something on point 2 but that would need
to be verified by someone with loads more experience than me before
it could be published.

Regards,
Benedict


-- 
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: Where do you put your business logic in django? Organizing big projects in django.

2010-09-28 Thread bruno desthuilliers
On 28 sep, 10:02, Benedict Verheyen 
wrote:
> I agree with Thomas that at least some guidelines would be nice.
> As what you and Steve have been saying about the need for a "Python for 
> Djangonauts" class,
> i think it would be a good idea also.
> I'm wondering though what specific Python topics you would touch?

I'd be tempted to answer : all of Python - hence my opinion that at
this point it's more about learning Python than anything else.

But the most obvious points are probably about Python's execution
model:
* what happens when a .py file is loaded into the interpreter, whether
thru direct execution ('> python somefile.py') or via an import,
* modules, packages, and the pythonpath
* import hooks and how django use them

> One that comes to mind is the use __init__,py and this modules in general as 
> this
> knowledge is needed to understand how you can split your models and views.

This is already explained in Python's fine manual.

> This would be what i would put in the guidelines for code structuring.
> Topics i think would be interesting:
> 1. Project vs App
>     - What is a project? When do you use applications?
>     - Possible examples of coding structure
>         - 1 site in 1 project
>         - many sites in 1 project
>         - ...

Ok, this is more Django-specific, and I agree that sharing experience
on these points might be a good thing.

> 2. Splitting models & views

It's a more general pattern: turning a module (single .py file) into a
package without breaking client code.

> 3. How can you cleanly seperate an application further from a project

Part of this topic is mostly generic dependencies management, but
there are indeed quite a few Django-specific points here.

> 4. Building reusable applications

There are already some threads, blog posts etc on this, but I've met a
couple issues never adressed so far.

> 5. Advanced building methods
>     - Buildout
>     - Virtualenv
>     - ...
>
> If we could agree on a list of topics, we can start writing it ourselves.
> We have people here with lots of experience regarding these kind of
> more advanced topics.
> I wouldn't mind to write something on point 2 but that would need
> to be verified by someone with loads more experience than me before
> it could be published.



>
> Regards,
> Benedict

-- 
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.



django-todo relaunched

2010-09-28 Thread shacker
django-todo is a multi-user, multi-group, pluggable todo-list/
ticketing system for individuals and organizations. The project,
formerly on google code, has been relaunched on githhub:

http://github.com/shacker/django-todo

with lots of bugs fixed and features added recently.  Includes a
setup.py so you can install with pip or other. Also listed at  django-
projects.com:

http://www.djangopackages.com/grids/g/ticketing/

./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-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.



Implementing accounts

2010-09-28 Thread mf
After finishing the core functionalities of my project it's time to
begin with other secundary but important things.

I've something like the following models.py file:

class Category(models.Model):
   name = models.CharField(max_length=30)

class Transaction(models.Model):
name = models.CharField(max_length=30)
description = models.TextField(blank=True)
amount = models.DecimalField(max_digits=12, decimal_places=2)
category = models.ForeignKey(Category,
related_name='transacciones', blank=True, null=True)

And this is what I want to do:

 Accounts: Each user can create different accounts.Example: the user A
have a home account with categories car and house, and a work account
with categories salary and bonuses. I don't know how to explain it
well, I'd like to have a "group of rows" for each account.

It seems pretty easy to do but I can't find the solution.


-- 
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: Removing the 'site' (not the website/url) field from django-comments

2010-09-28 Thread Tim Sawyer
> Hi all,
>
> I'm trying to have comments on my sites shown on all other sites, as I
> have a 'mobile' skin for my site on a separate domain and site_id.
>
> So for example:
> Joe posts a comment on http://www.site1.mydomain.com
>
> Mary goes to http://www.mobilesite.mydomain.com and can see and
> respond to Joe's comment.
>
> I'm not highly experienced in Django or programming in general, it
> looks like I will need to override some functions and classes such as
> BaseCommentNode and some template tags, and remove 'site__pk =  but
> I'm not sure which ones or how to do it.

When I did something similar, I had the same SITE_ID for the two projects.
 The two sites still had their own settings.py and application source. 
The key things that were different in settings.py were that ROOT_URLCONF
pointed to different URLs, and TEMPLATE_DIRS pointed to different top
level templates.  In that way I have different sites, but still referring
to the same database tables, and crucially the same SITE_ID, so you
wouldn't have the problem with django-comments.

Would that work for you?

Tim.


-- 
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: Implementing accounts

2010-09-28 Thread bruno desthuilliers
On 28 sep, 11:43, mf  wrote:
> After finishing the core functionalities of my project it's time to
> begin with other secundary but important things.
>
> I've something like the following models.py file:
>
> class Category(models.Model):
>    name = models.CharField(max_length=30)
>
> class Transaction(models.Model):
>     name = models.CharField(max_length=30)
>     description = models.TextField(blank=True)
>     amount = models.DecimalField(max_digits=12, decimal_places=2)
>     category = models.ForeignKey(Category,
> related_name='transacciones', blank=True, null=True)
>
> And this is what I want to do:
>
>  Accounts: Each user can create different accounts.Example: the user A
> have a home account with categories car and house, and a work account
> with categories salary and bonuses. I don't know how to explain it
> well, I'd like to have a "group of rows" for each account.
>
> It seems pretty easy to do but I can't find the solution.

Relational model 101 : many to many relationship.
http://docs.djangoproject.com/en/dev/ref/models/fields/#manytomanyfield

HTH !-)

-- 
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.



.dates() bug or feature?

2010-09-28 Thread dPeS
Hi all,

Anyone has explanation to this? :

>>> len(models.Rezerwacja.objects.all())
9
>>> len(models.Rezerwacja.objects.annotate(przyjazd=Min('transza__zajetosc__dzien')))
9
>>> models.Rezerwacja.objects.annotate(przyjazd=Min('transza__zajetosc__dzien')).dates('utworzona','year')
[datetime.datetime(2010, 1, 1, 0, 0), datetime.datetime(2010, 1, 1, 0,
0), datetime.datetime(2010, 1, 1, 0, 0), datetime.datetime(2010, 1, 1,
0, 0), datetime.datetime(2010, 1, 1, 0, 0)]

I expect to get ONE datetime.datetime(2010, 1, 1, 0, 0) rather then 5
which is |Min('transza__zajetosc__dzien')| ...

tested on django 1.2.1

Regards,
d.

-- 
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.



Validating or modifying admin inlines against main form

2010-09-28 Thread graeme
I need to do one of the following in the admin using Django 1.2:

1. Validate a value in a form against which objects have been added
using an inline form.
2. Add or delete related objects depending on the value in the main
model from.

The first would be preferable as the user would be able to decide
which was wrong and correct it appropriately.

I have tried doing this using the model's clean() method, its save()
method and a post_save signal. In all cases I cannot get the new
related objects.

I have thought of using form validation, but I cannot figure out how
to get the values from the inlines in the validation of the
ModelAdmin.form.

-- 
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: Accessing schemas in django

2010-09-28 Thread Jean-Pierre De Villiers
Hi,

I am receiving an error:
AttributeError: 'Manager' object has no attribute 'using'
when i run:
   result = Tusers.objects.using('lysgbl').filter.all()
where Tusers is the table and lysglb is the schema

Is there something wrong in the code i am using or what is the problem?
Any help would be appriciated.

Thanks,

J

On Mon, Sep 27, 2010 at 4:24 PM, shmengie <1st...@gmail.com> wrote:

> Using the later django versions, supports mutiple database/schemas
> with a DATABASES dict in settings.py
>
> your modles can select different db's on the fly:
>
> result = MyModel.objects.using('anotherdb').filter...
>
> Should get you there.
>
> On Sep 27, 4:37 am, Jean-Pierre De Villiers 
> wrote:
> > On Sep 27, 9:30 am, Nabil Servais  wrote:
> >
> > >   Hello,
> >
> > > Le 27/09/2010 08:53, Jean-Pierre De Villiers a crit :
> >
> > > > Hi,
> > > > Is there a way to access an existing database schema in Django?
> > > > Any help would be appreciated!
> >
> > > > J
> >
> > > You can use the inspectdb option of the project manager, you will find
> > > more information in the official documentation :
> >
> > >http://docs.djangoproject.com/en/dev/ref/django-admin/?from=olddocs
> >
> > Hi,
> > Thanks for the help Nabil Servais, is there a way to use the same
> > model for different schemas, like a variable used for the schemas or
> > something.
> > We have for example, hundreds of schemas and using a different model
> > for every one of them would be a tiresome process.
> >
> > thanks again!
>
> --
> 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: DjangoCon 2011

2010-09-28 Thread Steve Holden
There seemed to be a general feeling that a change of venue should head
Eastwards rather than South. So we are looking primarily for East coast
locations as an alternative to Portland for 2011.

regards
 Steve

On 9/27/2010 11:49 PM, David Zhou wrote:
> Is the bay area right out for cost reasons?
> 
> dz
> 
> Sent from my iPhone
> 
> On Sep 27, 2010, at 8:48 PM, Samuel Baldwin  
> wrote:
> 
>> 2010/9/27 Franklin Einspruch :
>>> May I humbly suggest Boston?
>>
>> Another for Boston.
>> --
>> Samuel Baldwin - logik.li
>>
>> --
>> 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.



Fwd: Re: DjangoCon 2011

2010-09-28 Thread Steve Holden
On 9/28/2010 1:19 AM, Kenneth Gonsalves wrote:
> On Mon, 2010-09-27 at 22:51 -0400, Steve Holden wrote:
>> I'd just like to briefly report back on the inquiries Nancy and I have
>> been making into East coast venues for DjangoCon 2011. 
> 
> just curious - why a hotel? In India we hold such conferences in
> universities/colleges - they provide all facilities free of cost (except
> accomodation - although some make their guest houses available for the
> VIPs), and in fact, compete with each other to offer hosting. We have
> just finished Pycon India where we got three state of art auditoriums
> free of cost.

The choice of venue was made in advance for this year - effectively we
took over an existing contract. This is the first time anyone has
suggested a non-hotel venue.

I haven't really heard much support for a university venue from the
community at large. They have both advantages and disadvantages. Of
course PyCon used a university location for the first three years. After
we outgrew the original location the conference's size made it difficult
to find university locations large enough (according to the people who
made the choices - I only chaired for three years).

It would be best not to cast the net too wide, given that a year ahead
is a relatively short planning time frame for a conference of this size.

regards
 Steve

-- 
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 No Messages Error

2010-09-28 Thread zimyand
Give your solution.

On Aug 4, 3:54 pm, kostia  wrote:
> SOLVED!
>
> On Aug 4, 3:48 pm, kostia  wrote:
>
>
>
>
>
>
>
> > After I do:
>
> > kos...@baikal$ python manage.py runserver
> > Error: No module named messages
> > kos...@baikal$
>
> > Django 1.2.1 with python 2.6.5+ devel installed.

-- 
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: Re: DjangoCon 2011

2010-09-28 Thread Franklin Einspruch
You might also have a look at Providence, RI. There's an airport, it's
an hour from Boston by car, and they have an active tech community
there:

http://rinexus.com/
http://providencegeeks.org/
http://www.pbn.com/Schillings-38-Studios-signs-lease-at-One-Empire-Plaza,52603

Good restaurants abound and entertainment options are at least extant
if not quite as rich as Portland, OR. Venues are likely to be far
cheaper than Boston.

- Franklin

On Tue, Sep 28, 2010 at 7:11 AM, Steve Holden  wrote:
> On 9/28/2010 1:19 AM, Kenneth Gonsalves wrote:
>> On Mon, 2010-09-27 at 22:51 -0400, Steve Holden wrote:
>>> I'd just like to briefly report back on the inquiries Nancy and I have
>>> been making into East coast venues for DjangoCon 2011.
>>
>> just curious - why a hotel? In India we hold such conferences in
>> universities/colleges - they provide all facilities free of cost (except
>> accomodation - although some make their guest houses available for the
>> VIPs), and in fact, compete with each other to offer hosting. We have
>> just finished Pycon India where we got three state of art auditoriums
>> free of cost.
>
> The choice of venue was made in advance for this year - effectively we
> took over an existing contract. This is the first time anyone has
> suggested a non-hotel venue.
>
> I haven't really heard much support for a university venue from the
> community at large. They have both advantages and disadvantages. Of
> course PyCon used a university location for the first three years. After
> we outgrew the original location the conference's size made it difficult
> to find university locations large enough (according to the people who
> made the choices - I only chaired for three years).
>
> It would be best not to cast the net too wide, given that a year ahead
> is a relatively short planning time frame for a conference of this size.
>
> regards
>  Steve
>
> --
> 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.
>
>



-- 
Art, writing, journal: http://einspruch.com
Comics: http://themoonfellonme.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.



get_or_create failuire

2010-09-28 Thread Szymon
Hi,

Problem: sometimes (not always) get_or_create is trying to create
duplicated record.

Model:

class online(models.Model):
 postac = models.OneToOneField('postac.postacie',
related_name="lista_online")
 data = models.DateTimeField()

Code snippet:

o =
online.objects.filter(postac__user=request.user).exclude(postac=request.session['postac'])
o.delete()
o, c = online.objects.get_or_create(postac=request.session['postac'],
defaults={ 'data' : datetime.now()+timedelta(minutes=15) })
if not c:
o.data = datetime.now()+timedelta(minutes=15)
o.save()

Database schema:

  Column   |   Type   |
Modifiers
---+--
+-
 id| integer  | not null default
nextval('spoleczniak_online_id_seq'::regclass)
 postac_id | integer  | not null
 data  | timestamp with time zone | not null
Indexes:
"spoleczniak_online_pkey" PRIMARY KEY, btree (id)
"spoleczniak_online_postac_id_key" UNIQUE, btree (postac_id)
Foreign-key constraints:
"spoleczniak_online_postac_id_fkey" FOREIGN KEY (postac_id)
REFERENCES postac_postacie(id) DEFERRABLE INITIALLY DEFERRED


PostgreSQL error:

Sep 28 12:35:42 postgres postgres[7238]: [2-1] ERROR:  23505:
duplicate key value violates unique constraint
"spoleczniak_online_postac_id_key"
Sep 28 12:35:42 postgres postgres[7238]: [2-2] DETAIL:  Key
(postac_id)=(109387) already exists.
Sep 28 12:35:42 postgres postgres[7238]: [2-3] LOCATION:
_bt_check_unique, nbtinsert.c:388
Sep 28 12:35:42 postgres postgres[7238]: [2-4] STATEMENT:  INSERT INTO
"spoleczniak_online" ("postac_id", "data") VALUES (109387,
E'2010-09-28 12:50:40.813883')

Database of course is PostgreSQL, Django 1.2.3 (btw. nice version
number :)), psycopg2 ... what else? So, am I doing something wrong?

-- 
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: Re: DjangoCon 2011

2010-09-28 Thread Rev. Johnny Healey
It seems like no one has suggested New Orleans yet, so I'm just going
to toss that out there.

-Johnny

On Tue, Sep 28, 2010 at 7:31 AM, Franklin Einspruch
 wrote:
> You might also have a look at Providence, RI. There's an airport, it's
> an hour from Boston by car, and they have an active tech community
> there:
>
> http://rinexus.com/
> http://providencegeeks.org/
> http://www.pbn.com/Schillings-38-Studios-signs-lease-at-One-Empire-Plaza,52603
>
> Good restaurants abound and entertainment options are at least extant
> if not quite as rich as Portland, OR. Venues are likely to be far
> cheaper than Boston.
>
> - Franklin
>
> On Tue, Sep 28, 2010 at 7:11 AM, Steve Holden  wrote:
>> On 9/28/2010 1:19 AM, Kenneth Gonsalves wrote:
>>> On Mon, 2010-09-27 at 22:51 -0400, Steve Holden wrote:
 I'd just like to briefly report back on the inquiries Nancy and I have
 been making into East coast venues for DjangoCon 2011.
>>>
>>> just curious - why a hotel? In India we hold such conferences in
>>> universities/colleges - they provide all facilities free of cost (except
>>> accomodation - although some make their guest houses available for the
>>> VIPs), and in fact, compete with each other to offer hosting. We have
>>> just finished Pycon India where we got three state of art auditoriums
>>> free of cost.
>>
>> The choice of venue was made in advance for this year - effectively we
>> took over an existing contract. This is the first time anyone has
>> suggested a non-hotel venue.
>>
>> I haven't really heard much support for a university venue from the
>> community at large. They have both advantages and disadvantages. Of
>> course PyCon used a university location for the first three years. After
>> we outgrew the original location the conference's size made it difficult
>> to find university locations large enough (according to the people who
>> made the choices - I only chaired for three years).
>>
>> It would be best not to cast the net too wide, given that a year ahead
>> is a relatively short planning time frame for a conference of this size.
>>
>> regards
>>  Steve
>>
>> --
>> 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.
>>
>>
>
>
>
> --
> Art, writing, journal: http://einspruch.com
> Comics: http://themoonfellonme.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: form validation for empty checkboxes that are not required (and they are the only fields present)

2010-09-28 Thread Brian Neal
On Sep 27, 11:35 am, Skylar Saveland 
wrote:
> I have some modelforms within a .  Each form has one
> checkboxselectmultiple that is not required.  If I post nothing (all
> checkboxes are empty) then all of the forms are invalid.  If I post
> anything then all of the forms are valid.  This anything could be that
> one of the forms has a box checked, or that I add  name='omg' value='wtf'> to the form.
>
Can you please post your model and form code? Perhaps in a pastebin?

BN

-- 
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: DjangoCon 2011

2010-09-28 Thread Steve Holden
Without wishing to seem non-responsive, can I just point out that we
can't keep extending the search indefinitely. First of all, we need to
make a decision reasonably quickly.Secondly, these venue searches take
time. While it costs nothing to "toss something out there", there *are*
costs involved with investigating available venues.

Consequently I am unlikely to look at any particular place unless it is
clearly supported by a number of people. And having had Chicago, New
York and Washington DC in our sights I am not inclined to extend that
list without a strong indication of support from a broad cross-section
of the community.

I hope nobody takes this the wrong way.

regards
 Steve

On 9/28/2010 8:48 AM, Rev. Johnny Healey wrote:
> It seems like no one has suggested New Orleans yet, so I'm just going
> to toss that out there.
> 
> -Johnny
> 
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
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.



Admin returning the wrong string

2010-09-28 Thread Caomhin
I have a slightly strange occurrence happening which makes no real
sense to me so I thought I'd see if anyone had any helpful hints...

My app stores people's first and last names, however for privacy
reason unless a user is logged in when browsing the website they will
only see "Firstname Initial" instead of "Firstname Lastname".  This is
achieved by a models.py containing:

def __str__(self):
return self.full_name()

def full_name(self):
return smart_str('%s %s' % (self.first_name(), 
self.last_name()))

def anonymize_name(self):
if self.last_name():
return smart_str('%s %s' % (self.first_name(), 
self.last_name()
[0]))
else:
return smart_str('%s' % (self.first_name()))

What is confusing me however is the Admin site for this model, or more
accurately the Admin page for another model which uses Person in a
many-to-many inline.  The dropdown menu seems to show "Firstname
Lastname" about 75% of the time and "Firstname Initial" the other 25%,
obviously returning anonymize_name instead of full_name somewhat
randomly (this has been tested with a selection of records and across
multiple browsers with what can best be described as sporadic
variation.

The anonymize_name is only referenced in views.py for the specific
views that it's required, and admin.py doesn't import views.py so it's
making the choice purely from models.py it would see.  ANy insight or
suggests would be much appreciated.

Using Django 1.2.3 on FreeBSD 7.3 with a PostgreSQL 8.4.4 DB and
Apache 2.2.16

-- 
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: DjangoCon 2011

2010-09-28 Thread Dana Spiegel
Steve,

This seems totally reasonable.

Looking at this from a different perspective, given that there are a
large and increasing number of python-based startups in NYC, would it
make a difference re: which city was chosen if we (in NYC) were able
to solicit sponsorships from VCs and tech firms here (in NYC)?

On Sep 28, 8:54 am, Steve Holden  wrote:
> Without wishing to seem non-responsive, can I just point out that we
> can't keep extending the search indefinitely. First of all, we need to
> make a decision reasonably quickly.Secondly, these venue searches take
> time. While it costs nothing to "toss something out there", there *are*
> costs involved with investigating available venues.
>
> Consequently I am unlikely to look at any particular place unless it is
> clearly supported by a number of people. And having had Chicago, New
> York and Washington DC in our sights I am not inclined to extend that
> list without a strong indication of support from a broad cross-section
> of the community.
>
> I hope nobody takes this the wrong way.
>
> regards
>  Steve
>
> On 9/28/2010 8:48 AM, Rev. Johnny Healey wrote:> It seems like no one has 
> suggested New Orleans yet, so I'm just going
> > to toss that out there.
>
> > -Johnny
>
> --
> DjangoCon US 2010 September 7-9http://djangocon.us/

-- 
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: DjangoCon 2011

2010-09-28 Thread Steve Holden
On 9/28/2010 9:44 AM, Dana Spiegel wrote:
> Steve,
> 
> This seems totally reasonable.
> 
> Looking at this from a different perspective, given that there are a
> large and increasing number of python-based startups in NYC, would it
> make a difference re: which city was chosen if we (in NYC) were able
> to solicit sponsorships from VCs and tech firms here (in NYC)?
> 
It might, though the sponsors would need to commit in advance.

The main issue would be the cost of accommodation, which can be very
high in the city. Do you think you could get sponsors to offset those
costs? I'm finding it difficult to imagine how that could practically be
done.

regards
 Steve

> On Sep 28, 8:54 am, Steve Holden  wrote:
>> Without wishing to seem non-responsive, can I just point out that we
>> can't keep extending the search indefinitely. First of all, we need to
>> make a decision reasonably quickly.Secondly, these venue searches take
>> time. While it costs nothing to "toss something out there", there *are*
>> costs involved with investigating available venues.
>>
>> Consequently I am unlikely to look at any particular place unless it is
>> clearly supported by a number of people. And having had Chicago, New
>> York and Washington DC in our sights I am not inclined to extend that
>> list without a strong indication of support from a broad cross-section
>> of the community.
>>
>> I hope nobody takes this the wrong way.
>>
>> regards
>>  Steve
>>
>> On 9/28/2010 8:48 AM, Rev. Johnny Healey wrote:> It seems like no one has 
>> suggested New Orleans yet, so I'm just going
>>> to toss that out there.
>>
>>> -Johnny
>>
>> --
>> DjangoCon US 2010 September 7-9http://djangocon.us/
> 


-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
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: .dates() bug or feature?

2010-09-28 Thread derek
On Sep 28, 12:08 pm, dPeS  wrote:
> Hi all,
>
> Anyone has explanation to this? :
>
> >>> len(models.Rezerwacja.objects.all())
> 9
> >>> len(models.Rezerwacja.objects.annotate(przyjazd=Min('transza__zajetosc__dzien')))
> 9
> >>> models.Rezerwacja.objects.annotate(przyjazd=Min('transza__zajetosc__dzien')).dates('utworzona','year')
>
> [datetime.datetime(2010, 1, 1, 0, 0), datetime.datetime(2010, 1, 1, 0,
> 0), datetime.datetime(2010, 1, 1, 0, 0), datetime.datetime(2010, 1, 1,
> 0, 0), datetime.datetime(2010, 1, 1, 0, 0)]
>
> I expect to get ONE datetime.datetime(2010, 1, 1, 0, 0) rather then 5
> which is |Min('transza__zajetosc__dzien')| ...
>
> tested on django 1.2.1
>
> Regards,
> d.
Order matters when it comes to annotation.  Read this section very
carefully:
http://docs.djangoproject.com/en/dev/topics/db/aggregation/#order-of-annotate-and-filter-clauses

-- 
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: Validating or modifying admin inlines against main form

2010-09-28 Thread derek
On Sep 28, 12:16 pm, graeme  wrote:
> I need to do one of the following in the admin using Django 1.2:
>
> 1. Validate a value in a form against which objects have been added
> using an inline form.
> 2. Add or delete related objects depending on the value in the main
> model from.
>
> The first would be preferable as the user would be able to decide
> which was wrong and correct it appropriately.
>
> I have tried doing this using the model's clean() method, its save()
> method and a post_save signal. In all cases I cannot get the new
> related objects.
>
> I have thought of using form validation, but I cannot figure out how
> to get the values from the inlines in the validation of the
> ModelAdmin.form.

Have a look at:
http://keokilee.blogspot.com/2010/04/more-django-form-hacking.html
I think it seems related...

-- 
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: Where do you put your business logic in django? Organizing big projects in django.

2010-09-28 Thread bobhaugen
Seems to be a general ferment on the topics of reusable Django apps
and best practices for modularizing large projects.

For example, 
http://groups.google.com/group/django-users/browse_thread/thread/22875fd287d0aa81

I expect the situation to improve, or at least change, a lot over the
next year.

In general, this is mostly about refactoring, so maybe this is a good
reference, although it tends to be java-oriented:
http://www.refactoring.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.



JSON and Blackberry

2010-09-28 Thread nerv82
Hello django experts,

I'm creating a web service that returns a json application as content
type but every time that I try to consume this with a blackberry
application in a HttpConnection nothing is return in the inputstream.

I try with another json service and it's working fine in the
blackberry. Here is my example service, what i'm doing wrong? It's
something about the headers in the HttpResponse?

I have no clue why the httpconnection can retrieve any data of my
django service.

I hope someone can helpme.

kind regards,
César

in view.py:
def index(request, cedula):
sapnwrfc.base.config_location = '/home/xxx/Sites/sap/sap.yml'
sapnwrfc.base.load_config()

try:
conn = sapnwrfc.base.rfc_connect()
#print "connection attributes: ",
conn.connection_attributes()
#print "discover..."
fd = conn.discover("Z_WS_PANDA")
#print "finished discover..."
f = fd.create_function_call()
f.CEDULA(str(cedula))
f.invoke()
bp = f.BPART.value
pdata = f.PERSONALDATA_T.value
feedata = f.STUDENTFEEDATA.value
sctable = f.IT_STUDSEG_TEXT.value
message = "Access Granted!"
todo = {'pdata': pdata, 'feedata': feedata, 'sctable':
sctable, 'bp': bp, 'message': message}

except sapnwrf.RFCCommunicationError:
message = "bang!"

res = ''.join(['[', simplejson.dumps(todo), ']'])
return HttpResponse(res, mimetype='application/json')

-- 
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.



Really slow performance on webfaction

2010-09-28 Thread Peter Harley
Hi all,

I'm trying to figure out possible causes for really slow performance
of my site on my production server on webfaction - it can take up to
15s to load!

It only seems to be a problem on the home page of my site and it also
doesn't seem to be anything like too many queries. Using the debug
toolbar, I got the following information:

User CPU time   1060.838 msec
System CPU time 97.985 msec
Total CPU time  1158.823 msec
Elapsed time13099.062 msec

It also tells me that the cache has been hit, meaning only a few DB
hits. On my test server it loads very quickly on a cache hit.

Obviously from this information no one is going to solve the problem,
but if you can help me by suggesting where to look or how to get some
more useful profiling information on a production server that would be
great.

Cheers,

Pete

-- 
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.



Django in Depth

2010-09-28 Thread Gath
Guys,

James Bannett the release manager for Django gave a very comprehensive
talk during Pycon2010, "Django In Depth".
 Where can i get that video for download.

Download link please.

Gath.

-- 
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: Really slow performance on webfaction

2010-09-28 Thread Shawn Milochik
Do you see anything at all like this if you run your app from your development 
box? 

You can always use the Python debugger to trace for your code and look for 
bottlenecks.
(Awesome tutorial) http://www.doughellmann.com/PyMOTW/pdb/index.html

Also, put in logging and add log.debug statements in various stages of the 
code. From the timestamps you can home in on the trouble spot.

Shawn

-- 
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 in Depth

2010-09-28 Thread Shawn Milochik
http://djangocon.blip.tv/file/3322277/

-- 
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: Where do you put your business logic in django? Organizing big projects in django.

2010-09-28 Thread Thomas Weholt
Inspired by the discussions in this thread I've created a reusable app
that mainly consists of a couple of management commands, like
startbigapp ( working name ) which is a crude hack of the startapp
code in django. It creates module for models and views instead of the
standard views.py and models.py. Another command is addmodel
   which will support the module layout
created by startbigapp, but will also create scaffolding using generic
views and basic templates for new/update/list/delete of the specified
models ( the models doesn`t have fields, that will have to be added
manually ). It saves some time and reducing repetetive typing. I was
thinking of making a command that would take an existing app and
generate a new version of the app splitting models ( and perhaps views
? ) into modules. The app will be a collection of helper methods for
code organizing and generation of boilerplate code. Any thoughts or
ideas?

I`ll upload it to the cheeseshop as soon as I can get time to
debug/test a bit more. The code isn`t pretty at the moment, but it
seems to get the job done.

-- 
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-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: DjangoCon 2011

2010-09-28 Thread Dana Spiegel
Have you guys seen adoptahacker.com? I'm sure that Jon Wegener and the team at 
New Work City would be happy to help with finding places for visitors to stay 
(as in couches/extra rooms).

In terms of getting hotel rooms sponsored, we might be able to VCs to offer 
sponsorship for this (though we should at least reach out to  Charlie O'Donnell 
@ First Round Capital to get his take on this).

-- 
Dana Spiegel
sociableDESIGN
+1 917 402 0422
d...@sociabledesign.com







On Sep 28, 2010, at 10:10 AM, Steve Holden wrote:

> On 9/28/2010 9:44 AM, Dana Spiegel wrote:
>> Steve,
>> 
>> This seems totally reasonable.
>> 
>> Looking at this from a different perspective, given that there are a
>> large and increasing number of python-based startups in NYC, would it
>> make a difference re: which city was chosen if we (in NYC) were able
>> to solicit sponsorships from VCs and tech firms here (in NYC)?
>> 
> It might, though the sponsors would need to commit in advance.
> 
> The main issue would be the cost of accommodation, which can be very
> high in the city. Do you think you could get sponsors to offset those
> costs? I'm finding it difficult to imagine how that could practically be
> done.
> 
> regards
> Steve
> 
>> On Sep 28, 8:54 am, Steve Holden  wrote:
>>> Without wishing to seem non-responsive, can I just point out that we
>>> can't keep extending the search indefinitely. First of all, we need to
>>> make a decision reasonably quickly.Secondly, these venue searches take
>>> time. While it costs nothing to "toss something out there", there *are*
>>> costs involved with investigating available venues.
>>> 
>>> Consequently I am unlikely to look at any particular place unless it is
>>> clearly supported by a number of people. And having had Chicago, New
>>> York and Washington DC in our sights I am not inclined to extend that
>>> list without a strong indication of support from a broad cross-section
>>> of the community.
>>> 
>>> I hope nobody takes this the wrong way.
>>> 
>>> regards
>>> Steve
>>> 
>>> On 9/28/2010 8:48 AM, Rev. Johnny Healey wrote:> It seems like no one has 
>>> suggested New Orleans yet, so I'm just going
 to toss that out there.
>>> 
 -Johnny
>>> 
>>> --
>>> DjangoCon US 2010 September 7-9http://djangocon.us/
>> 
> 
> 
> -- 
> DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
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.



Bug in model inheritance?

2010-09-28 Thread phill
This looks quite a bit like a bug, but we may be off the reservation
in terms of how we're using the product. (Disclaimer: I'm relatively
new to Django, and extremely new to the codebase that I ran into this
on).

We've got a form of schema-inheritance going on in this project in
order to accomplish shared-id-space and the ability to relate models
to one of a number of different types. The way that we've broken it
out runs us into a strange inconsistency in Django that specifically
affects our ability to serialize the objects. Here's a simplified
version of what we're doing:

class Entity(models.Model):
entityType = models.CharField(editable=False,max_length=50)

def __init__(self, *args, **kwargs):
super(Entity, self).__init__(*args, **kwargs)
self.entityType = self.__class__.__name__

def __unicode__(self):
return 'Entity: %s %s' %(self.entityType, self.id)

class BasePerson(Entity):

entity = models.OneToOneField(Entity, parent_link=True)
name = models.CharField(max_length=50)

class Meta:
abstract = True

class Kid(BasePerson):
school = models.CharField(max_length=50)

class Adult(BasePerson):
job = models.CharField(max_length=50)



When I dump instances of these models out using the standard fixtures
serialization, instances of Kid will serialize the 'entity' field, but
instances of Adult won't. The reason is because Adult's entity field
is marked primaryKey=True. Kid's is not. There appears to be a caching
issue here, because if I swap the order that Kid and Adult are defined
in.. the error reverses (now Kid's field will be marked pk).

Is this a bug? If not, what's the reasoning behind this behavior? Is
there a better pattern for accomplishing this kind of inheritance?

Thanks in advance for your help.

Phill

-- 
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: IDE for Python/django

2010-09-28 Thread roberto
Don't forget Editra.
It is cross-platform (windows, linux, mac os).
It was code using python.
It is not heavy.
I like it.

I am currently using Coda (only for mac os)
It is beautiful but only for that platform.

My 2 cents

-- 
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: IDE for Python/django

2010-09-28 Thread Nikolay Panov
> can u please tell me which is it..

Emacs + Ropemacs + pylint + pyflakes + pep8.

Have a nice day,
   Nikolay.

-- 
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: Where do you put your business logic in django? Organizing big projects in django.

2010-09-28 Thread SivaTumma
A small feature suggestion for @All,

Please address with @ symbol and name if you are actually intending
someone to read,
and then please delete the already existing message in your reply.
That makes us poor people to read things clearly and make up something
out of important discussions like these.


-- 
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: IDE for Python/django

2010-09-28 Thread Masklinn
On 2010-09-28, at 01:03 , Jason wrote:
> PyCharm is pretty amazing but it costs $ after its out of beta. Best
> code completion I've seen for Django.
> 
> My ONLY complaint is you can't open up a python console during debug.
> It has a pretty good debugger but seeing as other IDEs have no problem
> here I don't know why they left it out.

Have you looked at the bug tracker? It might be a post-1.0 feature, or it's 
just that nobody mentioned it. You should check, their tracker is completely 
open and they're very responsive and reactive (I've reported a fair number of 
bugs on the EAPs and betas, and overall I enjoyed the interaction)

-- 
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: IDE for Python/django

2010-09-28 Thread Masklinn
On 2010-09-28, at 02:01 , tayfur yilmaz wrote:
> pycharm is very slow
It's not.

> ı think for pycharm is wrote java programming
> language..wing ide is best..
Wings is written in Python, which is slower than Java...

-- 
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: JSON and Blackberry

2010-09-28 Thread nerv82
Hi django group users,
I solved the problem with another solution, but i think that the issue
is with the Content-Length of the header.

Kind Regards,
César

On Sep 28, 11:43 am, nerv82  wrote:
> Hello django experts,
>
> I'm creating a web service that returns a json application as content
> type but every time that I try to consume this with a blackberry
> application in a HttpConnection nothing is return in the inputstream.
>
> I try with another json service and it's working fine in the
> blackberry. Here is my example service, what i'm doing wrong? It's
> something about the headers in the HttpResponse?
>
> I have no clue why the httpconnection can retrieve any data of my
> django service.
>
> I hope someone can helpme.
>
> kind regards,
> César
>
> in view.py:
> def index(request, cedula):
>         sapnwrfc.base.config_location = '/home/xxx/Sites/sap/sap.yml'
>         sapnwrfc.base.load_config()
>
>         try:
>                 conn = sapnwrfc.base.rfc_connect()
>                 #print "connection attributes: ",
> conn.connection_attributes()
>                 #print "discover..."
>                 fd = conn.discover("Z_WS_PANDA")
>                 #print "finished discover..."
>                 f = fd.create_function_call()
>                 f.CEDULA(str(cedula))
>                 f.invoke()
>                 bp = f.BPART.value
>                 pdata = f.PERSONALDATA_T.value
>                 feedata = f.STUDENTFEEDATA.value
>                 sctable = f.IT_STUDSEG_TEXT.value
>                 message = "Access Granted!"
>                 todo = {'pdata': pdata, 'feedata': feedata, 'sctable':
> sctable, 'bp': bp, 'message': message}
>
>         except sapnwrf.RFCCommunicationError:
>                 message = "bang!"
>
>         res = ''.join(['[', simplejson.dumps(todo), ']'])
>         return HttpResponse(res, mimetype='application/json')

-- 
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: Bug in model inheritance?

2010-09-28 Thread Alec Shaner
As to whether it's a bug or not I have no idea, though it seems so.

If you use:

entity = models.OneToOneField(Entity, parent_link=True, primary_key=True)

it will create the primary key in both Kid and Adult tables, which
sounds like what you want?

On Tue, Sep 28, 2010 at 1:06 PM, phill  wrote:
> This looks quite a bit like a bug, but we may be off the reservation
> in terms of how we're using the product. (Disclaimer: I'm relatively
> new to Django, and extremely new to the codebase that I ran into this
> on).
>
> We've got a form of schema-inheritance going on in this project in
> order to accomplish shared-id-space and the ability to relate models
> to one of a number of different types. The way that we've broken it
> out runs us into a strange inconsistency in Django that specifically
> affects our ability to serialize the objects. Here's a simplified
> version of what we're doing:
>
> class Entity(models.Model):
>    entityType = models.CharField(editable=False,max_length=50)
>
>    def __init__(self, *args, **kwargs):
>        super(Entity, self).__init__(*args, **kwargs)
>        self.entityType = self.__class__.__name__
>
>    def __unicode__(self):
>        return 'Entity: %s %s' %(self.entityType, self.id)
>
> class BasePerson(Entity):
>
>    entity = models.OneToOneField(Entity, parent_link=True)
>    name = models.CharField(max_length=50)
>
>    class Meta:
>        abstract = True
>
> class Kid(BasePerson):
>    school = models.CharField(max_length=50)
>
> class Adult(BasePerson):
>    job = models.CharField(max_length=50)
>
>
>
> When I dump instances of these models out using the standard fixtures
> serialization, instances of Kid will serialize the 'entity' field, but
> instances of Adult won't. The reason is because Adult's entity field
> is marked primaryKey=True. Kid's is not. There appears to be a caching
> issue here, because if I swap the order that Kid and Adult are defined
> in.. the error reverses (now Kid's field will be marked pk).
>
> Is this a bug? If not, what's the reasoning behind this behavior? Is
> there a better pattern for accomplishing this kind of inheritance?
>
> Thanks in advance for your help.
>
> Phill
>
> --
> 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: Where do you put your business logic in django? Organizing big projects in django.

2010-09-28 Thread bruno desthuilliers
On 28 sep, 17:32, Thomas Weholt  wrote:
> Inspired by the discussions in this thread I've created a reusable app
> that mainly consists of a couple of management commands, like
> startbigapp ( working name ) which is a crude hack of the startapp
> code in django. It creates module for models and views instead of the
> standard views.py and models.py.

Just for the record: "views.py" and "models.py" are actually modules.
What your command creates are packages (folders with an __init__.py
module).

-- 
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: Really slow performance on webfaction

2010-09-28 Thread Bill Freeman
Are you running with the same data set both places?

The biggest speed problem I ever had in deployment was because real data
blew the database up with a huge join.  My dummy data on the test box didn't
evoke it.  (Fix was to get a simple query set and loop over it so that another
query could be qualified without a m2m join).

Bill

On Tue, Sep 28, 2010 at 12:12 PM, Shawn Milochik  wrote:
> Do you see anything at all like this if you run your app from your
> development box?
> You can always use the Python debugger to trace for your code and look for
> bottlenecks.
> (Awesome tutorial) http://www.doughellmann.com/PyMOTW/pdb/index.html
> Also, put in logging and add log.debug statements in various stages of the
> code. From the timestamps you can home in on the trouble spot.
> Shawn
>
> --
> 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.



User.get_profile() not working

2010-09-28 Thread adj7388
Django newbie issue. Just trying to understand. I'm setting up a
simple UserProfile class to link to User (as described in several
places in documentation). Here's what I have --- a simple example of
storing the user's website in a profile

#In myapp/models.py
class UserProfile(models.Model):
def __init__(self, website='http://www.default.com'):
super(UserProfile, self).__init__()
self.website = website
user = models.ForeignKey(User, unique=True,
related_name="user_profile") <-- note related_name...see below
website = models.URLField()

#In myproject/settings.py
AUTH_PROFILE_MODULE = "myapp.UserProfile"

Now I create a empty db
run: python2.6 manage.py syncdb
All tables look good in postgres.

Now in the python shell:

Python 2.6.5 (r265:79063, May 12 2010, 10:28:19)
>>> from django.contrib.auth.models import User
>>> from myapp.models import UserProfile
>>> u = User(username='testuser', password='s')
>>> u.save()
>>> up = UserProfile(website='www.overridethesite.com')
>>> up.user=u
>>> up.save()

So far so good
Over in Postgres, everything looks fine:
mydb=> select au.id as id, au.username, up.id as upid, up.user_id as
fk_userid, up.website from auth_user au join myapp_userprofile up on
(au.id=up.user_id);
   id | username | upid | fk_userid | website
--+--+--+---+-
2 | testuser |1 | 2 | www.overridethesite.com
(1 row)

Now back in the python shell, trying to use the profile from the user
obj:

>>> u.user_profile.values()  <--- works fine using the related_name I set in 
>>> the UserProfile class
[{'website': u'www.overridethesite.com', 'user_id': 2, 'id': 1}]

### But get_profile() fails:

>>> myprofile = u.get_profile()
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
contrib/auth/models.py", line 370, in get_profile
self._profile_cache =
model._default_manager.using(self._state.db).get(user__id__exact=self.id)
  File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
db/models/query.py", line 336, in get
num = len(clone)
  File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
db/models/query.py", line 81, in __len__
self._result_cache = list(self.iterator())
  File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
db/models/query.py", line 282, in iterator
obj = self.model(*row[index_start:aggregate_start])
TypeError: __init__() takes at most 2 arguments (4 given)

Can anyone tell me what's going on, or what I'm doing wrong? Thanks in
advance.

-- 
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: notification in python

2010-09-28 Thread Erik Cederstrand
Harryos,

Den 28/09/2010 kl. 09.56 skrev harryos:

> thanks Erik,
> By 'update' I meant a major addition/removal of text(say 100
> characters).
> Initially I thought of making hash of a page and comparing it to the
> saved hash of the same page  at a different moment of time..But ,this
> would
> cause even a tiny change to be considered as an update..I would like
> to use a filter to set an update of x number of characters.
> May be using f=urllib.urlopen and
> currentsize=len(f.read())  will let me find the number of added/
> removed characters..and set the filter accordingly..


Content length (which you could also get using the HTTP header "Content 
Length") won't necessarily tell you if content has changed. I think your 
problem is a candidate for http://en.wikipedia.org/wiki/Levenshtein_distance 
(calculating the "distance" between two strings), for which I think there are 
Python implementations.

Depending on your requirements, you could add other heuristics to detect major 
changes, e.g. load the page into an XML parser and only check certain 's. 
But further suggestions would require more information on your problem.

Kind regards,

Erik


smime.p7s
Description: S/MIME cryptographic signature


Formsets, forms and related editing

2010-09-28 Thread Axel Bock
Hello again,

after some trying and not coming to a successful end I might need a hint or
two with the following construction.

Assume a pilots flight log: Each flight can have several legs, and a
purpose. So basically the model looks like this:

Mission:
Pilot
Purpose
...

Leg:
Mission: ForeignKey('mission')
Departure
Target
Time

The relationship is Mission (1) --> (*) Leg (one to many). The legs are
REQUIRED for the Mission to be complete.

Now I am trying to design a view which presents an input for the Mission AND
the leg part, so when submitting you create a Mission including its legs.
There are also several restrictions, one of them being that a pilot can only
log his own Missions. For this reason I do not present a "Pilot" entry
field, and intend to fill in the Pilot later (it's of course a registered
user, so I am following the procedure described in the Django docs -
save(commit=False), update the field value).

But this does not work. :/

The view is roughly this code:
mission = MissionForm()  # a modelform
LegFormSet = inlineformset_factory(Mission, Leg, form=LegForm, extra=1,
can_delete=False)
legforms = LegFormSet(prefix="legformset")
render_to_response("...", { ... }, context_instance=...)

The View seems to work all right, but the processing does not. The
processing code is roughly:
mission = MissionForm(request.POST).save(commit=False)
# it seems to abort here with the error "The Mission could not be
created because the data didn't validate"
legs =[f.save(commit=False) for f in LegFormSet(request.POST,
prefix="legformset")]

Are there any best practices when doing such kind of thing? Am I doing it
wrong?


thanks in advance for any help & greetings,
Axel.

-- 
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.



Fixing Missing Template Error

2010-09-28 Thread octopusgrabbus
I am getting a Missing Template exception

Exception Type: TemplateDoesNotExist
Exception Value:

registration/login.html

My urls.py looks like this:

from django.conf.urls.defaults import *
from django.contrib.auth.views import login
.
.
.
urlpatterns = patterns('',
(r'^$', main_page),
(r'^login/$', 'django.contrib.auth.views.login'),
 )

I would like to correct the exception, but do not know where to begin.
This does not work either under runserver or the default configuration
under Apache.

Small examples work with the general project. This is a login
application under a project.

Thanks for any pointers.
cmn

-- 
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: Fixing Missing Template Error

2010-09-28 Thread Rolando Espinoza La Fuente
On Tue, Sep 28, 2010 at 7:35 PM, octopusgrabbus
 wrote:
> I am getting a Missing Template exception
>
> Exception Type:         TemplateDoesNotExist
> Exception Value:
>
> registration/login.html

What's your TEMPLATE_DIRS value in settings.py?

Inside your template dir you need to create the file registration/login.html

The auth contrib app doesn't provides default templates.
http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.views.login

Regards,

Rolando Espinoza La fuente
www.insophia.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.



Re: IDE for Python/django

2010-09-28 Thread pixelcowboy
For me, at least in ubuntu 64 bit, pycharm is indeed terribly slow.
And this on a icore7 machine with 8 gigs of ram. Otherwise I like it,
but it does have a few bugs.

On Sep 28, 10:53 am, Masklinn  wrote:
> On 2010-09-28, at 02:01 , tayfur yilmaz wrote:> pycharm is very slow
>
> It's not.
>
> > ı think for pycharm is wrote java programming
> > language..wing ide is best..
>
> Wings is written in Python, which is slower than Java...

-- 
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: Really slow performance on webfaction

2010-09-28 Thread pjrhar...@gmail.com
Thanks for the help guys. I started trying to log things, and only
then did I notice that I'd missed the obvious - one of the few queries
was taking 11s!

Turns out it was a pointless join from a weird use of queries (a
queryset contructed one place with more filters added elsewhere in an
odd order). Also turns out that, as expected, it was a case of having
a much smaller set of test data on my dev server, so it wasn't all
that slow on there.

Fixed (I hope - its now loading in at most 2s, disappointingly it
still doesn't seem to make much odds whether it hits the cache or
not...) by just making the query a bit more sane. I suspect there's a
few more places where I can improve on similar things that just aren't
causing such a headache because the data set isn't so big for a
different model.

Thanks,

Pete

-- 
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.



iPhone talking to Django server (matching session)

2010-09-28 Thread Danny Bos
Heya,

I've got a Django application talking to an iPhone sending photos and
User data back and forth. I figured the best way to approach this
(tell me otherwise) was to log the user in on the server and pass the
iPhone back the 'session ID' in a JSON array.

Then when the iPhone sends me back some info, they send me that same
'session ID' and I match that to the associated user content in order
to get the User details. Does this make sense? Is it the way to go in
order to pass User details back and forth to an iPhone.

If so.

How do I find the User when the iPhone passes me back the 'session
ID'?

Thanks in advance,
Hope all is well your side of town ...


d.

-- 
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.



Model field choices

2010-09-28 Thread Derek
I have a model which has choices specified for the "offer_type" field:

class Coupon(models.Model):
offer_types = (
(1, 'Percentage Off'),
(2, 'Amount Off'),
(3, 'Free'),
)

business = models.ForeignKey(Business)
offer_type = models.IntegerField(choices=offer_types)

How do I then retrieve the "human readable" values when referencing a
Coupon object?  Right now Coupon.objects.get(id=1).offer_type returns
the numeric value only ("3" instead of "free"... which I suppose is to
be expected).

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-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: Model field choices

2010-09-28 Thread Steve Holden
On 9/28/2010 10:39 PM, Derek wrote:
> I have a model which has choices specified for the "offer_type" field:
> 
> class Coupon(models.Model):
>   offer_types = (
>   (1, 'Percentage Off'),
>   (2, 'Amount Off'),
>   (3, 'Free'),
>   )
> 
>   business = models.ForeignKey(Business)
>   offer_type = models.IntegerField(choices=offer_types)
> 
> How do I then retrieve the "human readable" values when referencing a
> Coupon object?  Right now Coupon.objects.get(id=1).offer_type returns
> the numeric value only ("3" instead of "free"... which I suppose is to
> be expected).
> 
> Thanks!
> 
You should find that your model instances have a
get_offer_type_display() method that you can call to retrieve the value
that the user sees in the interface. These methods are added for each
field with choices set in its definition.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
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: Removing the 'site' (not the website/url) field from django-comments

2010-09-28 Thread EJ
Hi Tim,

Good idea, but that won't work unfortunately as we use the 'Site'
functionality between the 40-odd sites.

Thanks though!

Ethan

On Sep 28, 7:50 pm, "Tim Sawyer"  wrote:
> > Hi all,
>
> > I'm trying to have comments on my sites shown on all other sites, as I
> > have a 'mobile' skin for my site on a separate domain and site_id.
>
> > So for example:
> > Joe posts a comment onhttp://www.site1.mydomain.com
>
> > Mary goes tohttp://www.mobilesite.mydomain.comand can see and
> > respond to Joe's comment.
>
> > I'm not highly experienced in Django or programming in general, it
> > looks like I will need to override some functions and classes such as
> > BaseCommentNode and some template tags, and remove 'site__pk =  but
> > I'm not sure which ones or how to do it.
>
> When I did something similar, I had the same SITE_ID for the two projects.
>  The two sites still had their own settings.py and application source.
> The key things that were different in settings.py were that ROOT_URLCONF
> pointed to different URLs, and TEMPLATE_DIRS pointed to different top
> level templates.  In that way I have different sites, but still referring
> to the same database tables, and crucially the same SITE_ID, so you
> wouldn't have the problem with django-comments.
>
> Would that work for you?
>
> Tim.

-- 
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: Model field choices

2010-09-28 Thread Derek
Thanks, Steve.  Sounds like a plan.



On Sep 28, 10:48 pm, Steve Holden  wrote:
> On 9/28/2010 10:39 PM, Derek wrote:
>
> > I have a model which has choices specified for the "offer_type" field:
>
> > class Coupon(models.Model):
> >    offer_types = (
> >            (1, 'Percentage Off'),
> >            (2, 'Amount Off'),
> >            (3, 'Free'),
> >    )
>
> >    business = models.ForeignKey(Business)
> >    offer_type = models.IntegerField(choices=offer_types)
>
> > How do I then retrieve the "human readable" values when referencing a
> > Coupon object?  Right now Coupon.objects.get(id=1).offer_type returns
> > the numeric value only ("3" instead of "free"... which I suppose is to
> > be expected).
>
> > Thanks!
>
> You should find that your model instances have a
> get_offer_type_display() method that you can call to retrieve the value
> that the user sees in the interface. These methods are added for each
> field with choices set in its definition.
>
> regards
>  Steve
> --
> DjangoCon US 2010 September 7-9http://djangocon.us/

-- 
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: form validation for empty checkboxes that are not required (and they are the only fields present)

2010-09-28 Thread Skylar Saveland
class Asset(models.Model):
languages = models.ManyToManyField('account.Language', null=True,
blank=True)


class AssetLanguageForm(forms.ModelForm):
languages = forms.ModelMultipleChoiceField(
queryset=Language.objects.all(),
required=False,
widget=forms.CheckboxSelectMultiple
)

class Meta:
model = Asset
fields = ('languages',)


Adding a hidden garbage field works.  Seems like it's just a little
edge-case bug/gotcha.



On Sep 28, 8:49 am, Brian Neal  wrote:
> On Sep 27, 11:35 am, Skylar Saveland 
> wrote:> I have some modelforms within a .  Each form has one
> > checkboxselectmultiple that is not required.  If I post nothing (all
> > checkboxes are empty) then all of the forms are invalid.  If I post
> > anything then all of the forms are valid.  This anything could be that
> > one of the forms has a box checked, or that I add  > name='omg' value='wtf'> to the form.
>
> Can you please post your model and form code? Perhaps in a pastebin?
>
> BN

-- 
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: notification in python

2010-09-28 Thread harryos
hi Erik
that was food for thought..content length may not work if
substitutions leave length unchanged..
Will look into L distance ..thanks for the suggestion
regards
harry

> Content length (which you could also get using the HTTP header "Content 
> Length") won't necessarily tell you if content has changed. I think your 
> problem is a candidate 
> forhttp://en.wikipedia.org/wiki/Levenshtein_distance(calculating the 
> "distance" between two strings), for which I think there are Python 
> implementations.
>
> Depending on your requirements, you could add other heuristics to detect 
> major changes, e.g. load the page into an XML parser and only check certain 
> 's. But further suggestions would require more information on your 
> problem.

-- 
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: iPhone talking to Django server (matching session)

2010-09-28 Thread Skylar Saveland
User.objects.get(pk=Session.objects.get(pk=session_id).get_decoded()
['_auth_user_id']) via @SmileyChris

On Sep 28, 9:36 pm, Danny Bos  wrote:
> Heya,
>
> I've got a Django application talking to an iPhone sending photos and
> User data back and forth. I figured the best way to approach this
> (tell me otherwise) was to log the user in on the server and pass the
> iPhone back the 'session ID' in a JSON array.
>
> Then when the iPhone sends me back some info, they send me that same
> 'session ID' and I match that to the associated user content in order
> to get the User details. Does this make sense? Is it the way to go in
> order to pass User details back and forth to an iPhone.
>
> If so.
>
> How do I find the User when the iPhone passes me back the 'session
> ID'?
>
> Thanks in advance,
> Hope all is well your side of town ...
>
> d.

-- 
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.



LOGIN FORM

2010-09-28 Thread Saad Sharif
Hi all,
   I want to create  a simple login form in django..Please
help I am a complete beginner

My Code:
{% csrf_token %}
username 
password 
 login 


Error Message (when I press login button) :

Forbidden (403)

CSRF verification failed. Request aborted.
Help

Reason given for failure: CSRF token missing or incorrect.


In general, this can occur when there is a genuine Cross Site Request
Forgery, or when Django's CSRF mechanism has not been used correctly.
For POST forms, you need to ensure:

* The view function uses RequestContext for the template, instead
of Context.
* In the template, there is a {% csrf_token %} template tag inside
each POST form that targets an internal URL.
* If you are not using CsrfViewMiddleware, then you must use
csrf_protect on any views that use the csrf_token template tag, as
well as those that accept the POST data.

You're seeing the help section of this page because you have DEBUG =
True in your Django settings file. Change that to False, and only the
initial error message will be displayed.

You can customize this page using the CSRF_FAILURE_VIEW setting."


Please help me out

-- 
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: User.get_profile() not working

2010-09-28 Thread Ale
On Tue, Sep 28, 2010 at 2:45 PM, adj7388  wrote:
> Django newbie issue. Just trying to understand. I'm setting up a
> simple UserProfile class to link to User (as described in several
> places in documentation). Here's what I have --- a simple example of
> storing the user's website in a profile
>
> #In myapp/models.py
> class UserProfile(models.Model):
>    def __init__(self, website='http://www.default.com'):
>        super(UserProfile, self).__init__()
>        self.website = website
>    user = models.ForeignKey(User, unique=True,
> related_name="user_profile") <-- note related_name...see below
>    website = models.URLField()


Why did you do that? and not:

 #In myapp/models.py
 class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True,

related_name="user_profile") <-- note related_name...see below
 website = models.URLField(default='http://www.default.com')


>
> TypeError: __init__() takes at most 2 arguments (4 given)
>

That's cause __init__() of a model actually takes more arguments than
you allow. Redefining __init__ goes something like:

> class UserProfile(models.Model):
>def __init__(self, *args, **kwargs):
  website = kwargs.get('website', "default_url")
>super(UserProfile, self).__init__(*args, **kwargs)
>self.website = website

Note, I said _something like_ there could be more ways to do it.

Cheers,
-- 
Ale.

-- 
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: User.get_profile() not working

2010-09-28 Thread adj7388
Good grief. After spending hours trying to figure out what was wrong,
I immediately found the problem after making this post. Here's the
solution:

I had overridden UserProfile.__init__() like this:

class UserProfile(models.Model):
def __init__(self, website='http://www.default.com'):

while its superclass looks like this:
class Model(object):
...
def __init__(self, *args, **kwargs):

Somewhere deep inside Django the 'model.__init__()' was being called
to create a UserProfile passing it a bunch of parameters it was not
prepared to accept. So I just changed it to:

class UserProfile(models.Model):
def __init__(self, website='http://www.default.com', *args,
**kwargs):

... and all was well. That explained the 'TypeError: __init__() takes
at most 2 arguments (4 given) ' message.

-- 
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: User.get_profile() not working

2010-09-28 Thread Daniel Roseman
On Sep 28, 6:45 pm, adj7388  wrote:
> Django newbie issue. Just trying to understand. I'm setting up a
> simple UserProfile class to link to User (as described in several
> places in documentation). Here's what I have --- a simple example of
> storing the user's website in a profile
>
> #In myapp/models.py
> class UserProfile(models.Model):
>     def __init__(self, website='http://www.default.com'):
>         super(UserProfile, self).__init__()
>         self.website = website
>     user = models.ForeignKey(User, unique=True,
> related_name="user_profile") <-- note related_name...see below
>     website = models.URLField()
>
> #In myproject/settings.py
> AUTH_PROFILE_MODULE = "myapp.UserProfile"
>
> Now I create a empty db
> run: python2.6 manage.py syncdb
> All tables look good in postgres.
>
> Now in the python shell:
>
> Python 2.6.5 (r265:79063, May 12 2010, 10:28:19)
>
> >>> from django.contrib.auth.models import User
> >>> from myapp.models import UserProfile
> >>> u = User(username='testuser', password='s')
> >>> u.save()
> >>> up = UserProfile(website='www.overridethesite.com')
> >>> up.user=u
> >>> up.save()
>
> So far so good
> Over in Postgres, everything looks fine:
> mydb=> select au.id as id, au.username, up.id as upid, up.user_id as
> fk_userid, up.website from auth_user au join myapp_userprofile up on
> (au.id=up.user_id);
>    id | username | upid | fk_userid |         website
> --+--+--+---+-
>     2 | testuser |    1 |         2 |www.overridethesite.com
> (1 row)
>
> Now back in the python shell, trying to use the profile from the user
> obj:
>
> >>> u.user_profile.values()  <--- works fine using the related_name I set in 
> >>> the UserProfile class
>
> [{'website': u'www.overridethesite.com', 'user_id': 2, 'id': 1}]
>
> ### But get_profile() fails:
>
> >>> myprofile = u.get_profile()
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
> contrib/auth/models.py", line 370, in get_profile
>     self._profile_cache =
> model._default_manager.using(self._state.db).get(user__id__exact=self.id)
>   File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
> db/models/query.py", line 336, in get
>     num = len(clone)
>   File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
> db/models/query.py", line 81, in __len__
>     self._result_cache = list(self.iterator())
>   File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
> db/models/query.py", line 282, in iterator
>     obj = self.model(*row[index_start:aggregate_start])
> TypeError: __init__() takes at most 2 arguments (4 given)
>
> Can anyone tell me what's going on, or what I'm doing wrong? Thanks in
> advance.

This seems to be because you have overwritten the __init__ method of
the model. Don't do that. There's no need to, as simply instantiating
a model with keyword parameters does what you want:

UserProfile(website='www.google.com')
--
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.



How to get an ajax call to return both QuerySet and paging info in Django

2010-09-28 Thread Dmitrij
I am trying to implement paging across ajax calls. The page should not
refresh when the user wants to see the next x num of results.

Here is my problem. Returning the QuerySet is super simple. I just do
(sumaJson is custom)

data = serializers.serialize('sumaJson', result_page.object_list,
relations=('first_major', 'country_of_origin', 'second_major'))
return HttpResponse(data, mimetype="application/json")

Now I also want to return things like

result_page.has_previous()
result_page.has_next()
result_page.paginator.count

and so on. I for the life of me can't figure out how to get both
across in one response. I can't add this info to
result_page.object_list because then the serializer fails. If I
something of the sort of

simplejson.dumps(paging_info + result_page.object_list)

Then in the javascript the QuerySet is no longer a list of objects but
just a big string of characters which can't be interpreted with

$.each(data.data, function(index, item){

I tried some bad hacks like creating a fake object and putting it in
the object_list, serializing this and then deleting the object. This
allows me to get the data across. However, I don't want to be creating
and deleting fake objects.

I don't want to meddle with the serializer. I don't want to send a
second ajax request once I get the querySet back to get the paging
info.

Am I missing something? Is there an easy way to get both across in one
response? 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-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: User.get_profile() not working

2010-09-28 Thread Skylar Saveland
Overriding __init__ might be a little shady, but you probably can get
away with it if you use *args and **kwargs

On Sep 28, 1:45 pm, adj7388  wrote:
> Django newbie issue. Just trying to understand. I'm setting up a
> simple UserProfile class to link to User (as described in several
> places in documentation). Here's what I have --- a simple example of
> storing the user's website in a profile
>
> #In myapp/models.py
> class UserProfile(models.Model):
>     def __init__(self, website='http://www.default.com'):
>         super(UserProfile, self).__init__()
>         self.website = website
>     user = models.ForeignKey(User, unique=True,
> related_name="user_profile") <-- note related_name...see below
>     website = models.URLField()
>
> #In myproject/settings.py
> AUTH_PROFILE_MODULE = "myapp.UserProfile"
>
> Now I create a empty db
> run: python2.6 manage.py syncdb
> All tables look good in postgres.
>
> Now in the python shell:
>
> Python 2.6.5 (r265:79063, May 12 2010, 10:28:19)
>
> >>> from django.contrib.auth.models import User
> >>> from myapp.models import UserProfile
> >>> u = User(username='testuser', password='s')
> >>> u.save()
> >>> up = UserProfile(website='www.overridethesite.com')
> >>> up.user=u
> >>> up.save()
>
> So far so good
> Over in Postgres, everything looks fine:
> mydb=> select au.id as id, au.username, up.id as upid, up.user_id as
> fk_userid, up.website from auth_user au join myapp_userprofile up on
> (au.id=up.user_id);
>    id | username | upid | fk_userid |         website
> --+--+--+---+-
>     2 | testuser |    1 |         2 |www.overridethesite.com
> (1 row)
>
> Now back in the python shell, trying to use the profile from the user
> obj:
>
> >>> u.user_profile.values()  <--- works fine using the related_name I set in 
> >>> the UserProfile class
>
> [{'website': u'www.overridethesite.com', 'user_id': 2, 'id': 1}]
>
> ### But get_profile() fails:
>
> >>> myprofile = u.get_profile()
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
> contrib/auth/models.py", line 370, in get_profile
>     self._profile_cache =
> model._default_manager.using(self._state.db).get(user__id__exact=self.id)
>   File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
> db/models/query.py", line 336, in get
>     num = len(clone)
>   File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
> db/models/query.py", line 81, in __len__
>     self._result_cache = list(self.iterator())
>   File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
> db/models/query.py", line 282, in iterator
>     obj = self.model(*row[index_start:aggregate_start])
> TypeError: __init__() takes at most 2 arguments (4 given)
>
> Can anyone tell me what's going on, or what I'm doing wrong? Thanks in
> advance.

-- 
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: User.get_profile() not working

2010-09-28 Thread Skylar Saveland
Using *args and **kwargs might work

then maybe

self.website = kwargs.get('website', 'default.com')

On Sep 28, 1:45 pm, adj7388  wrote:
> Django newbie issue. Just trying to understand. I'm setting up a
> simple UserProfile class to link to User (as described in several
> places in documentation). Here's what I have --- a simple example of
> storing the user's website in a profile
>
> #In myapp/models.py
> class UserProfile(models.Model):
>     def __init__(self, website='http://www.default.com'):
>         super(UserProfile, self).__init__()
>         self.website = website
>     user = models.ForeignKey(User, unique=True,
> related_name="user_profile") <-- note related_name...see below
>     website = models.URLField()
>
> #In myproject/settings.py
> AUTH_PROFILE_MODULE = "myapp.UserProfile"
>
> Now I create a empty db
> run: python2.6 manage.py syncdb
> All tables look good in postgres.
>
> Now in the python shell:
>
> Python 2.6.5 (r265:79063, May 12 2010, 10:28:19)
>
> >>> from django.contrib.auth.models import User
> >>> from myapp.models import UserProfile
> >>> u = User(username='testuser', password='s')
> >>> u.save()
> >>> up = UserProfile(website='www.overridethesite.com')
> >>> up.user=u
> >>> up.save()
>
> So far so good
> Over in Postgres, everything looks fine:
> mydb=> select au.id as id, au.username, up.id as upid, up.user_id as
> fk_userid, up.website from auth_user au join myapp_userprofile up on
> (au.id=up.user_id);
>    id | username | upid | fk_userid |         website
> --+--+--+---+-
>     2 | testuser |    1 |         2 |www.overridethesite.com
> (1 row)
>
> Now back in the python shell, trying to use the profile from the user
> obj:
>
> >>> u.user_profile.values()  <--- works fine using the related_name I set in 
> >>> the UserProfile class
>
> [{'website': u'www.overridethesite.com', 'user_id': 2, 'id': 1}]
>
> ### But get_profile() fails:
>
> >>> myprofile = u.get_profile()
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
> contrib/auth/models.py", line 370, in get_profile
>     self._profile_cache =
> model._default_manager.using(self._state.db).get(user__id__exact=self.id)
>   File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
> db/models/query.py", line 336, in get
>     num = len(clone)
>   File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
> db/models/query.py", line 81, in __len__
>     self._result_cache = list(self.iterator())
>   File "/home/myusername/webapps/django_boosters/lib/python2.6/django/
> db/models/query.py", line 282, in iterator
>     obj = self.model(*row[index_start:aggregate_start])
> TypeError: __init__() takes at most 2 arguments (4 given)
>
> Can anyone tell me what's going on, or what I'm doing wrong? Thanks in
> advance.

-- 
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: How to get an ajax call to return both QuerySet and paging info in Django

2010-09-28 Thread Steve Holden
On 9/28/2010 10:42 PM, Dmitrij wrote:
> I am trying to implement paging across ajax calls. The page should not
> refresh when the user wants to see the next x num of results.
> 
> Here is my problem. Returning the QuerySet is super simple. I just do
> (sumaJson is custom)
> 
> data = serializers.serialize('sumaJson', result_page.object_list,
> relations=('first_major', 'country_of_origin', 'second_major'))
> return HttpResponse(data, mimetype="application/json")
> 
> Now I also want to return things like
> 
> result_page.has_previous()
> result_page.has_next()
> result_page.paginator.count
> 
> and so on. I for the life of me can't figure out how to get both
> across in one response. I can't add this info to
> result_page.object_list because then the serializer fails. If I
> something of the sort of
> 
> simplejson.dumps(paging_info + result_page.object_list)
> 
> Then in the javascript the QuerySet is no longer a list of objects but
> just a big string of characters which can't be interpreted with
> 
> $.each(data.data, function(index, item){
> 
> I tried some bad hacks like creating a fake object and putting it in
> the object_list, serializing this and then deleting the object. This
> allows me to get the data across. However, I don't want to be creating
> and deleting fake objects.
> 
> I don't want to meddle with the serializer. I don't want to send a
> second ajax request once I get the querySet back to get the paging
> info.
> 
> Am I missing something? Is there an easy way to get both across in one
> response? Thanks!
> 
I don't know about a fake object, but surely if you put everything you
want in a Python dict and then serialize that it will arrive in
JavaScript as an object with named fields, which you can use as you want
by referencing the fields as object attributes. Or am I missing something?

regards
 Steve

-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
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: How to get an ajax call to return both QuerySet and paging info in Django

2010-09-28 Thread Dmitrij Petters
Well that would require me to use simplejson.dumps(data) right? I need to
use my custom serializer in order to do a deep serialization of the model to
model dependencies. As far as I understand, serializers are meant to take
querysets or something of the sort, not dictionaries containing various
kinds of data. Please correct me if I'm wrong. So I can't do something like
serializers.serialize('json" {'queryset' : queryset, 'paging_data' :
paging_data}). Similarly if I use simplejson.dumps, I lose the ability to
get that deep serialization.

-Dmitrij


On Tue, Sep 28, 2010 at 11:43 PM, Steve Holden  wrote:

> On 9/28/2010 10:42 PM, Dmitrij wrote:
> > I am trying to implement paging across ajax calls. The page should not
> > refresh when the user wants to see the next x num of results.
> >
> > Here is my problem. Returning the QuerySet is super simple. I just do
> > (sumaJson is custom)
> >
> > data = serializers.serialize('sumaJson', result_page.object_list,
> > relations=('first_major', 'country_of_origin', 'second_major'))
> > return HttpResponse(data, mimetype="application/json")
> >
> > Now I also want to return things like
> >
> > result_page.has_previous()
> > result_page.has_next()
> > result_page.paginator.count
> >
> > and so on. I for the life of me can't figure out how to get both
> > across in one response. I can't add this info to
> > result_page.object_list because then the serializer fails. If I
> > something of the sort of
> >
> > simplejson.dumps(paging_info + result_page.object_list)
> >
> > Then in the javascript the QuerySet is no longer a list of objects but
> > just a big string of characters which can't be interpreted with
> >
> > $.each(data.data, function(index, item){
> >
> > I tried some bad hacks like creating a fake object and putting it in
> > the object_list, serializing this and then deleting the object. This
> > allows me to get the data across. However, I don't want to be creating
> > and deleting fake objects.
> >
> > I don't want to meddle with the serializer. I don't want to send a
> > second ajax request once I get the querySet back to get the paging
> > info.
> >
> > Am I missing something? Is there an easy way to get both across in one
> > response? Thanks!
> >
> I don't know about a fake object, but surely if you put everything you
> want in a Python dict and then serialize that it will arrive in
> JavaScript as an object with named fields, which you can use as you want
> by referencing the fields as object attributes. Or am I missing something?
>
> regards
>  Steve
>
> --
> DjangoCon US 2010 September 7-9 http://djangocon.us/
>
> --
> 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: Bug in model inheritance?

2010-09-28 Thread phill
Alec,

Thanks.. yeah, your fix forces the fields to pk=True, which doesn't
redundantly serialize the field with it's custom name in my case. If
for some reason you wanted to ensure that the field was serialized
using it's custom field name though.. there doesn't appear to be a way
to do that. I'm pretty convinced this is a bug.

Phill

On Sep 28, 11:12 am, Alec Shaner  wrote:
> As to whether it's a bug or not I have no idea, though it seems so.
>
> If you use:
>
>     entity = models.OneToOneField(Entity, parent_link=True, primary_key=True)
>
> it will create the primary key in both Kid and Adult tables, which
> sounds like what you want?
>
>
>
> On Tue, Sep 28, 2010 at 1:06 PM, phill  wrote:
> > This looks quite a bit like a bug, but we may be off the reservation
> > in terms of how we're using the product. (Disclaimer: I'm relatively
> > new to Django, and extremely new to the codebase that I ran into this
> > on).
>
> > We've got a form of schema-inheritance going on in this project in
> > order to accomplish shared-id-space and the ability to relate models
> > to one of a number of different types. The way that we've broken it
> > out runs us into a strange inconsistency in Django that specifically
> > affects our ability to serialize the objects. Here's a simplified
> > version of what we're doing:
>
> > class Entity(models.Model):
> >    entityType = models.CharField(editable=False,max_length=50)
>
> >    def __init__(self, *args, **kwargs):
> >        super(Entity, self).__init__(*args, **kwargs)
> >        self.entityType = self.__class__.__name__
>
> >    def __unicode__(self):
> >        return 'Entity: %s %s' %(self.entityType, self.id)
>
> > class BasePerson(Entity):
>
> >    entity = models.OneToOneField(Entity, parent_link=True)
> >    name = models.CharField(max_length=50)
>
> >    class Meta:
> >        abstract = True
>
> > class Kid(BasePerson):
> >    school = models.CharField(max_length=50)
>
> > class Adult(BasePerson):
> >    job = models.CharField(max_length=50)
>
> > When I dump instances of these models out using the standard fixtures
> > serialization, instances of Kid will serialize the 'entity' field, but
> > instances of Adult won't. The reason is because Adult's entity field
> > is marked primaryKey=True. Kid's is not. There appears to be a caching
> > issue here, because if I swap the order that Kid and Adult are defined
> > in.. the error reverses (now Kid's field will be marked pk).
>
> > Is this a bug? If not, what's the reasoning behind this behavior? Is
> > there a better pattern for accomplishing this kind of inheritance?
>
> > Thanks in advance for your help.
>
> > Phill
>
> > --
> > 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 
> > athttp://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.



Import Error

2010-09-28 Thread Saad Sharif
Hi all,

I created a simple login form

My code:
{% csrf_token %}
username 
password 
 login 


 In views.py i added

def login(request):
return render_to_response('login.html')

In urls.py i added

(r'^login/', include('macrohms.views.login')),

The Error when i press login button:
ImportError at /login/

No module named login

 Request Method: POST  Request URL: http://localhost:8000/login/  Django
Version: 1.2.3  Exception Type: ImportError  Exception Value:

No module named login

 Exception Location:
/home/saad/www/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg/django/utils/importlib.py
in import_module, line 35  Python Executable: /home/saad/www/bin/python  Python
Version: 2.6.5  Python Path: ['/home/saad/www/webapps/macrohms',
'/home/saad/www/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg',
'/home/saad/www/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg',
'/home/saad/www/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg',
'/home/saad/www/lib/python2.6/site-packages/Coffin-0.3.3-py2.6.egg',
'/home/saad/www/lib/python2.6/site-packages/Jinja2-2.5.2-py2.6.egg',
'/home/saad/www/lib/python2.6/site-packages/WTForms-0.6.1-py2.6.egg',
'/home/saad/www/lib/python2.6', '/home/saad/www/lib/python2.6/plat-linux2',
'/home/saad/www/lib/python2.6/lib-tk',
'/home/saad/www/lib/python2.6/lib-old',
'/home/saad/www/lib/python2.6/lib-dynload', '/usr/lib/python2.6',
'/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk',
'/home/saad/www/lib/python2.6/site-packages']  Server time: Tue, 28 Sep 2010
23:40:56 -0500

-- 
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.



What is the correct way to copy an object from one model to a similar model?

2010-09-28 Thread Yo-Yo Ma
I have two models that are identical in structure except one has 2
extra fields. The second one is used for record keeping and is never
edited by users. The system takes the first model and copies it to the
second model, adding some extra meta information, all when a certain
action is performed against the first model.

What is the best practice for this?

spam.attribute_one = foo.attribute_one
spam.attribute_two = foo.attribute_two

Or, is there a pattern that works well?

-- 
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: Import Error

2010-09-28 Thread Yo-Yo Ma
(r'^login/', include('macrohms.views.login')),  is incorrect.

the include() function, pertaining to urls.py is for including other
URL confs (so you can have sub-sections of your site contain their own
urls.py). You'll want to replace that line with:

url(r'^login/$', 'macrohms.views.login')),

Note, I changed two additional things - I changed your tuple to a
url() function call instead, and I added a $ at the end of the URL
pattern (denotes the end of a string in regex). The url() function is
the "cool" way to define URLs.

On Sep 28, 10:41 pm, Saad Sharif  wrote:
> Hi all,
>
> I created a simple login form
>
> My code:
>  dojoType="dijit.form.Form" >{% csrf_token %}
> username 
> password 
>  login 
> 
>
>  In views.py i added
>
> def login(request):
>     return render_to_response('login.html')
>
> In urls.py i added
>
> (r'^login/', include('macrohms.views.login')),
>
> The Error when i press login button:
> ImportError at /login/
>
> No module named login
>
>  Request Method: POST  Request URL:http://localhost:8000/login/ Django
> Version: 1.2.3  Exception Type: ImportError  Exception Value:
>
> No module named login
>
>  Exception Location:
> /home/saad/www/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg/django/utils/importlib.py
> in import_module, line 35  Python Executable: /home/saad/www/bin/python  
> Python
> Version: 2.6.5  Python Path: ['/home/saad/www/webapps/macrohms',
> '/home/saad/www/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg',
> '/home/saad/www/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg',
> '/home/saad/www/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg',
> '/home/saad/www/lib/python2.6/site-packages/Coffin-0.3.3-py2.6.egg',
> '/home/saad/www/lib/python2.6/site-packages/Jinja2-2.5.2-py2.6.egg',
> '/home/saad/www/lib/python2.6/site-packages/WTForms-0.6.1-py2.6.egg',
> '/home/saad/www/lib/python2.6', '/home/saad/www/lib/python2.6/plat-linux2',
> '/home/saad/www/lib/python2.6/lib-tk',
> '/home/saad/www/lib/python2.6/lib-old',
> '/home/saad/www/lib/python2.6/lib-dynload', '/usr/lib/python2.6',
> '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk',
> '/home/saad/www/lib/python2.6/site-packages']  Server time: Tue, 28 Sep 2010
> 23:40:56 -0500

-- 
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: Import Error

2010-09-28 Thread Saad Sharif
Thanks a lo :)

but there is a new error

The Error:

Forbidden (403)

CSRF verification failed. Request aborted.
 Help

Reason given for failure:

CSRF token missing or incorrect.


In general, this can occur when there is a genuine Cross Site Request
Forgery, or when Django's CSRF
mechanismhas
not been used correctly. For POST forms, you need to ensure:

   - The view function uses
RequestContextfor
the template, instead of
   Context.
   - In the template, there is a {% csrf_token %} template tag inside each
   POST form that targets an internal URL.
   - If you are not using CsrfViewMiddleware, then you must use
csrf_protecton any views that use the
   csrf_token template tag, as well as those that accept the POST data.

You're seeing the help section of this page because you have DEBUG = True in
your Django settings file. Change that to False, and only the initial error
message will be displayed.

You can customize this page using the CSRF_FAILURE_VIEW setting.


On Wed, Sep 29, 2010 at 10:39 AM, Yo-Yo Ma  wrote:

> (r'^login/', include('macrohms.views.login')),  is incorrect.
>
> the include() function, pertaining to urls.py is for including other
> URL confs (so you can have sub-sections of your site contain their own
> urls.py). You'll want to replace that line with:
>
> url(r'^login/$', 'macrohms.views.login')),
>
> Note, I changed two additional things - I changed your tuple to a
> url() function call instead, and I added a $ at the end of the URL
> pattern (denotes the end of a string in regex). The url() function is
> the "cool" way to define URLs.
>
> On Sep 28, 10:41 pm, Saad Sharif  wrote:
> > Hi all,
> >
> > I created a simple login form
> >
> > My code:
> >  > dojoType="dijit.form.Form" >{% csrf_token %}
> > username 
> > password 
> >  login 
> > 
> >
> >  In views.py i added
> >
> > def login(request):
> > return render_to_response('login.html')
> >
> > In urls.py i added
> >
> > (r'^login/', include('macrohms.views.login')),
> >
> > The Error when i press login button:
> > ImportError at /login/
> >
> > No module named login
> >
> >  Request Method: POST  Request URL:http://localhost:8000/login/ Django
> > Version: 1.2.3  Exception Type: ImportError  Exception Value:
> >
> > No module named login
> >
> >  Exception Location:
> >
> /home/saad/www/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg/django/utils/importlib.py
> > in import_module, line 35  Python Executable: /home/saad/www/bin/python
>  Python
> > Version: 2.6.5  Python Path: ['/home/saad/www/webapps/macrohms',
> > '/home/saad/www/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg',
> > '/home/saad/www/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg',
> > '/home/saad/www/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg',
> > '/home/saad/www/lib/python2.6/site-packages/Coffin-0.3.3-py2.6.egg',
> > '/home/saad/www/lib/python2.6/site-packages/Jinja2-2.5.2-py2.6.egg',
> > '/home/saad/www/lib/python2.6/site-packages/WTForms-0.6.1-py2.6.egg',
> > '/home/saad/www/lib/python2.6',
> '/home/saad/www/lib/python2.6/plat-linux2',
> > '/home/saad/www/lib/python2.6/lib-tk',
> > '/home/saad/www/lib/python2.6/lib-old',
> > '/home/saad/www/lib/python2.6/lib-dynload', '/usr/lib/python2.6',
> > '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk',
> > '/home/saad/www/lib/python2.6/site-packages']  Server time: Tue, 28 Sep
> 2010
> > 23:40:56 -0500
>
> --
> 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: IDE for Python/django

2010-09-28 Thread Eric Elinow
While I wouldn't say Pycharm is 'terribly slow' (on my dual-quad xeon Mac Pro 
w/8 gigs of ram running OSX 10.6.4), I will say that it is noticeably slower 
than my current Python IDE of choice, Netbeans 6.9.1 which is relatively snappy 
though YMMV. 


On 28 Sep, 2010, at 20:46 , pixelcowboy wrote:

> For me, at least in ubuntu 64 bit, pycharm is indeed terribly slow.
> And this on a icore7 machine with 8 gigs of ram. Otherwise I like it,
> but it does have a few bugs.
> 
> On Sep 28, 10:53 am, Masklinn  wrote:
>> On 2010-09-28, at 02:01 , tayfur yilmaz wrote:> pycharm is very slow
>> 
>> It's not.
>> 
>>> ı think for pycharm is wrote java programming
>>> language..wing ide is best..
>> 
>> Wings is written in Python, which is slower than Java...
> 
> -- 
> 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: Import Error

2010-09-28 Thread Yo-Yo Ma
User logs into your site (SaadsDjangoSite.com). User goes to
CriminalCSRFSite.com while logged into yours. They put a script tag in
their page that has a post-back to 
ttp://saadsdjangosite.com/delete-everything-and-kill-kittens/.
This causes the user's logged in browser to make a request to your
site, and delete everything and kill kittens, all without the user
knowing what happened.

Follow those instructions. Make sure you put {% csrf_token %} right
after your open  tag.



On Sep 28, 11:38 pm, Saad Sharif  wrote:
> Thanks a lo :)
>
> but there is a new error
>
> The Error:
>
> Forbidden (403)
>
> CSRF verification failed. Request aborted.
>  Help
>
> Reason given for failure:
>
>     CSRF token missing or incorrect.
>
> In general, this can occur when there is a genuine Cross Site Request
> Forgery, or when Django's CSRF
> mechanismhas
> not been used correctly. For POST forms, you need to ensure:
>
>    - The view function uses
> RequestContextfor
> the template, instead of
>    Context.
>    - In the template, there is a {% csrf_token %} template tag inside each
>    POST form that targets an internal URL.
>    - If you are not using CsrfViewMiddleware, then you must use
> csrf_protecton any views that use the
>    csrf_token template tag, as well as those that accept the POST data.
>
> You're seeing the help section of this page because you have DEBUG = True in
> your Django settings file. Change that to False, and only the initial error
> message will be displayed.
>
> You can customize this page using the CSRF_FAILURE_VIEW setting.
>
> On Wed, Sep 29, 2010 at 10:39 AM, Yo-Yo Ma  wrote:
> > (r'^login/', include('macrohms.views.login')),  is incorrect.
>
> > the include() function, pertaining to urls.py is for including other
> > URL confs (so you can have sub-sections of your site contain their own
> > urls.py). You'll want to replace that line with:
>
> > url(r'^login/$', 'macrohms.views.login')),
>
> > Note, I changed two additional things - I changed your tuple to a
> > url() function call instead, and I added a $ at the end of the URL
> > pattern (denotes the end of a string in regex). The url() function is
> > the "cool" way to define URLs.
>
> > On Sep 28, 10:41 pm, Saad Sharif  wrote:
> > > Hi all,
>
> > > I created a simple login form
>
> > > My code:
> > >  > > dojoType="dijit.form.Form" >{% csrf_token %}
> > > username 
> > > password 
> > >  login 
> > > 
>
> > >  In views.py i added
>
> > > def login(request):
> > >     return render_to_response('login.html')
>
> > > In urls.py i added
>
> > > (r'^login/', include('macrohms.views.login')),
>
> > > The Error when i press login button:
> > > ImportError at /login/
>
> > > No module named login
>
> > >  Request Method: POST  Request URL:http://localhost:8000/login/Django
> > > Version: 1.2.3  Exception Type: ImportError  Exception Value:
>
> > > No module named login
>
> > >  Exception Location:
>
> > /home/saad/www/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg/django/utils/importlib.py
> > > in import_module, line 35  Python Executable: /home/saad/www/bin/python
> >  Python
> > > Version: 2.6.5  Python Path: ['/home/saad/www/webapps/macrohms',
> > > '/home/saad/www/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg',
> > > '/home/saad/www/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg',
> > > '/home/saad/www/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg',
> > > '/home/saad/www/lib/python2.6/site-packages/Coffin-0.3.3-py2.6.egg',
> > > '/home/saad/www/lib/python2.6/site-packages/Jinja2-2.5.2-py2.6.egg',
> > > '/home/saad/www/lib/python2.6/site-packages/WTForms-0.6.1-py2.6.egg',
> > > '/home/saad/www/lib/python2.6',
> > '/home/saad/www/lib/python2.6/plat-linux2',
> > > '/home/saad/www/lib/python2.6/lib-tk',
> > > '/home/saad/www/lib/python2.6/lib-old',
> > > '/home/saad/www/lib/python2.6/lib-dynload', '/usr/lib/python2.6',
> > > '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk',
> > > '/home/saad/www/lib/python2.6/site-packages']  Server time: Tue, 28 Sep
> > 2010
> > > 23:40:56 -0500
>
> > --
> > 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: Import Error

2010-09-28 Thread Saad Sharif
Thanks for your help :) Yup, I already did that, added {% csrf_token %} just
after  tag..still the same error comes up :(

On Wed, Sep 29, 2010 at 11:44 AM, Yo-Yo Ma  wrote:

> User logs into your site (SaadsDjangoSite.com). User goes to
> CriminalCSRFSite.com while logged into yours. They put a script tag in
> their page that has a post-back to ttp://
> saadsdjangosite.com/delete-everything-and-kill-kittens/.
> This causes the user's logged in browser to make a request to your
> site, and delete everything and kill kittens, all without the user
> knowing what happened.
>
> Follow those instructions. Make sure you put {% csrf_token %} right
> after your open  tag.
>
>
>
> On Sep 28, 11:38 pm, Saad Sharif  wrote:
> > Thanks a lo :)
> >
> > but there is a new error
> >
> > The Error:
> >
> > Forbidden (403)
> >
> > CSRF verification failed. Request aborted.
> >  Help
> >
> > Reason given for failure:
> >
> > CSRF token missing or incorrect.
> >
> > In general, this can occur when there is a genuine Cross Site Request
> > Forgery, or when Django's CSRF
> > mechanism<
> http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ref-contrib-csrf
> >has
> > not been used correctly. For POST forms, you need to ensure:
> >
> >- The view function uses
> > RequestContext<
> http://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-c..
> .>for
> > the template, instead of
> >Context.
> >- In the template, there is a {% csrf_token %} template tag inside
> each
> >POST form that targets an internal URL.
> >- If you are not using CsrfViewMiddleware, then you must use
> > csrf_protecton any views that use the
> >csrf_token template tag, as well as those that accept the POST data.
> >
> > You're seeing the help section of this page because you have DEBUG = True
> in
> > your Django settings file. Change that to False, and only the initial
> error
> > message will be displayed.
> >
> > You can customize this page using the CSRF_FAILURE_VIEW setting.
> >
> > On Wed, Sep 29, 2010 at 10:39 AM, Yo-Yo Ma 
> wrote:
> > > (r'^login/', include('macrohms.views.login')),  is incorrect.
> >
> > > the include() function, pertaining to urls.py is for including other
> > > URL confs (so you can have sub-sections of your site contain their own
> > > urls.py). You'll want to replace that line with:
> >
> > > url(r'^login/$', 'macrohms.views.login')),
> >
> > > Note, I changed two additional things - I changed your tuple to a
> > > url() function call instead, and I added a $ at the end of the URL
> > > pattern (denotes the end of a string in regex). The url() function is
> > > the "cool" way to define URLs.
> >
> > > On Sep 28, 10:41 pm, Saad Sharif  wrote:
> > > > Hi all,
> >
> > > > I created a simple login form
> >
> > > > My code:
> > > >  > > > dojoType="dijit.form.Form" >{% csrf_token %}
> > > > username 
> > > > password 
> > > >  login 
> > > > 
> >
> > > >  In views.py i added
> >
> > > > def login(request):
> > > > return render_to_response('login.html')
> >
> > > > In urls.py i added
> >
> > > > (r'^login/', include('macrohms.views.login')),
> >
> > > > The Error when i press login button:
> > > > ImportError at /login/
> >
> > > > No module named login
> >
> > > >  Request Method: POST  Request URL:
> http://localhost:8000/login/Django
> > > > Version: 1.2.3  Exception Type: ImportError  Exception Value:
> >
> > > > No module named login
> >
> > > >  Exception Location:
> >
> > >
> /home/saad/www/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg/django/utils/importlib.py
> > > > in import_module, line 35  Python Executable:
> /home/saad/www/bin/python
> > >  Python
> > > > Version: 2.6.5  Python Path: ['/home/saad/www/webapps/macrohms',
> > > >
> '/home/saad/www/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg',
> > > > '/home/saad/www/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg',
> > > > '/home/saad/www/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg',
> > > > '/home/saad/www/lib/python2.6/site-packages/Coffin-0.3.3-py2.6.egg',
> > > > '/home/saad/www/lib/python2.6/site-packages/Jinja2-2.5.2-py2.6.egg',
> > > > '/home/saad/www/lib/python2.6/site-packages/WTForms-0.6.1-py2.6.egg',
> > > > '/home/saad/www/lib/python2.6',
> > > '/home/saad/www/lib/python2.6/plat-linux2',
> > > > '/home/saad/www/lib/python2.6/lib-tk',
> > > > '/home/saad/www/lib/python2.6/lib-old',
> > > > '/home/saad/www/lib/python2.6/lib-dynload', '/usr/lib/python2.6',
> > > > '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk',
> > > > '/home/saad/www/lib/python2.6/site-packages']  Server time: Tue, 28
> Sep
> > > 2010
> > > > 23:40:56 -0500
> >
> > > --
> > > 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
> >

Re: Import Error

2010-09-28 Thread Russell Keith-Magee
On Wed, Sep 29, 2010 at 2:20 PM, Saad Sharif
 wrote:
> Thanks for your help :) Yup, I already did that, added {% csrf_token %} just
> after  tag..still the same error comes up :(

The error page that comes up comes with a list of three possible
sources of error.

Have you ruled out those?

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-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: Import Error

2010-09-28 Thread Saad Sharif
Thanks Russell :)

Now, no error pops up but when i press the login button the same page
reloads..by the way, Django is awesome :)

-- 
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.