Re: ANN: Releasing Django Media Tree, a media file management application for the Django admin

2012-01-27 Thread Samuel Luescher
Hi,

I just pushed a massive update to django-media-tree that may interest you.

It now contains generic view classes, and the CMS plugins are actually
based on those. So creating FeinCMS plugins should now be quite easy.

It's all documented, these pages are relevant:

http://readthedocs.org/docs/django-media-tree/en/latest/custom_plugins.html
http://readthedocs.org/docs/django-media-tree/en/latest/bundled_plugins.html
http://readthedocs.org/docs/django-media-tree/en/latest/views.html

Sam

On 20 January 2012 15:34, Samuel Luescher  wrote:
> I'm not planning to create Fein CMS plugins myself, but I'm very much hoping
> the community will take a stab at this.
> Actually, now that I think of it, the actual output generated by the CMS
> plugins should be abstracted from the CMS and moved to the
> media_tree.contrib.widgets package so that people can easily build on them.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/FMW6EnGQe4IJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

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



Re: User-specific sites

2012-01-27 Thread Russell Keith-Magee
On Wed, Jan 18, 2012 at 5:35 AM, Eryn Wells  wrote:
> Hi all,
>
> This is my first post and it's a simple question... (I think)
>
> In my experience, it seems like Django allows users to log in to access and 
> modify the same content, like a blog with multiple authors or a CMS. I'm 
> trying to figure out how to do user-specific sites – something like a blog 
> site where every user has their own blog and they can log in to add, remove, 
> and edit their own posts (and no one else's). Each user has their own 
> preferences and the like as well. Is this something that Django's built-in 
> user framework can handle? Or could I maybe finagle the sites module into 
> doing something like this? Is it as simple as adding a ForeignKey to all my 
> models that points to the User that owns that particular db row (seems like 
> the brute force way of doing it...) or is there a more elegant way?

Hi Eryn,

It sounds to me like a foreign key to User is the best way to handle
what you're describing. If you set up the auth infrastructure, a
logged-in user will attach the current user to the request object, so
if you want to find the Posts for that user, it's a very simple
filtered query.

I'm not sure why you consider this to be "brute force"; you've pretty
much defined your requirements as "Show me all the blog posts for this
user", so that's what you encode in Django -- a view of blog posts,
filtered to those from the current user.

If your objection is that you need to code everything from scratch --
well, that's when you start looking for other people that have solved
the same problem, and use their code. There's a rich community of
reusable, open source Django applications, and unless you've got very
specific requirements, you'll probably find a "blog" package that will
meet those requirements. I'd suggest having a look around Django
Packages [1] to see if there is something that will meet your needs.

If you're looking for a more complex, CMS-like solution -- there are
pre-built solutions for those, too (Django CMS, FeinCMS, Mezzanine,
and others). Which one works best for you will depend on your
requirements.

[1] http://djangopackages.com/

Yours,
Russ Magee %-)

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



Re: Django silences exceptions raised by functions called during template rendering

2012-01-27 Thread Russell Keith-Magee
On Fri, Jan 13, 2012 at 9:30 PM, Ioan Alexandru Cucu
 wrote:
> Hi guys,
>
> Using django 1.1.1
> Example template snippet template snippet:
>
> {{ foo.bar }}
>
> If 'bar' raises an AttributeError, the exception is silenced and an
> empty string is displayed.
> I tried setting DEBUG, TEMPLATE_DEBUG, and DEBUG_PROPAGATE_EXCEPTIONS
> to True, but nothing changes.
>
> Digging through django's source code, it looks like silencing the
> error is a normal django behavior.
>
> Should this be considered a bug in django? I mean, even though the bug
> is in 'my' code and that code should be unit tested decoupled from the
> template rendering part, it would be nice to have a setting for
> showing the same django error page as if the exception would have been
> raised in the view code.

It's not a bug, it's a specific design decision.

The underlying philosophy is that the worst thing a web app can do is
show an error to the user in the middle of 'normal' content (think of
the PHP apps that dump MySQL stack traces in the middle of pages when
they fail).

As a side effect -- once you know that non-existent attributes won't
raise an error, you can actually start to rely on this fact in your
template design. Django's admin templates exploit this in a couple of
places.

If you need help finding places in your template where missing
attributes are being swallowed, you can use the
TEMPLATE_STRING_IF_INVALID setting -- this sets the value that is used
when a template variable can't be found, so you can force "NOT HERE"
to be rendered instead of an empty string. This isn't something you
want to keep turned on in production, and if it is enabled, Django's
admin will have some interesting rendering problems, but it can be a
helpful debugging tool.

Yours,
Russ Magee %-)

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



Re: Problem with Django! Please help

2012-01-27 Thread Tomas Neme
So, you need to create a "user registration" view.

Plus, I'd just use auth.models.User
https://docs.djangoproject.com/en/1.3/topics/auth/ because you're
saving the passwords as plain text, and that is A Bad Thing.

That, and because there's a bunch of stuff and apps you can use to
help you on all this if you use it (search for django-registration and
django-profiles, for example)

Cheers
Tomas

-- 
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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



Re: django noob question

2012-01-27 Thread adj7388
I forgot to address the issue of your LeagueTable, which appears to be
a way to keep track of standings. It looks like what you're really
doing is trying to keep track of matches won and lost, points earned,
etc i.e., the standings of a league.

One way to do this is with a Match model:

class Match(models.Model):
date = models.DateField()
home_team = models.ForeignKey(Team)
visiting_team = models.ForeignKey(Team)
home_score = models.IntegerField()
visiting_score = models.IntegerField()

For each match you would create an object in your Match table, with
the score for each team. Having this data would allow you to calculate
1) which team won, 2) number of points earned, etc.

So just querying the Match table would allow you to calculate on-the-
fly the record for each team, the number of points, then sort by the
number of points to produce a Standings queryset. I hope that makes
sense without giving examples of all the queries.

This is just one way to do what I think you're trying to do. It may
not be the best way. But hopefully it gives you some ideas about how
to use Django models.

Alan


On Jan 27, 4:03 pm, adj7388  wrote:
> Without knowing your problem domain, you might want to start off with:
>
> class League(models.Model):
>     name = models.CharField(max_length=200)
>
> class Team(models.Model):
>     name = models.CharField(max_length=200)
>     league = models.ForeignKey(League)
>
> Generally you don't want a model with a plural name (like 'Leagues').
> When you're dealing with more than one league, you will get leagues
> out of your League model with:
>
> my_leagues = League.objects.all()
>
> which will return a queryset with all your leagues.
>
> Likewise, for teams:
>
> my_teams = Team.objects.all()
>
> If you want to know the league for a specific team:
>
> my_team = Team.objects.get(pk=1)
> my_team_league = my_team.league
>
> HTH,
> Alan
>
> On Jan 26, 2:37 pm, yousuf  wrote:
>
>
>
>
>
>
>
> > this is my models.py
>
> > from django.db import models
>
> > # Create your models here.
>
> > class Leagues(models.Model):
> >     LeagueName = models.CharField(max_length=200)
>
> > class Team(models.Model):
> >     TeamName = models.CharField(max_length=200)
>
> > class LeagueTable(models.Model):
> >     league = models.ForeignKey(Leagues)
> >     team = models.CharField(max_length=200)
> >     matches_played = models.IntegerField()
> >     matches_won = models.IntegerField()
> >     matches_drawn = models.IntegerField()
> >     matches_lost = models.IntegerField()
> >     points = models.IntegerField()
>
> > class FixtureTable(models.Model):
> >     league = models.ForeignKey(Leagues)
> >     fixture_date = models.DateField('Fixture Date')
> >     team_one = models.CharField(max_length=200)
> >     team_one_score = models.IntegerField()
> >     team_two = models.CharField(max_length=200)
> >     team_two_score = models.IntegerField()
> > in the "class FixtureTable", i want team_one and team_two to be linked
> > to two differnt teams in "class Team" models. how to create multiple
> > relations, or is it possible.
>
> > PS: this is purely a noob, with a little experience in programming,
> > but no experience with either python or databases.
>
> > PPS: I found that the best way to learn is to create your own problem,
> > and solve the problem in parallel while following the tutorial. so i
> > am just stuck in the beginning. thankyou.
>
> > thankyou.

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



Re: django get value from oracle function

2012-01-27 Thread Ian
On Jan 20, 3:05 pm, citos88  wrote:
> I use Django and Oracle, and I want call oracle's function and catch
> and save to django's variable this what return that function. How can
> I do this?

You'll need to get a database cursor and use its callfunc method,
something like this:

from django.db import connection
import cx_Oracle

cursor = connection.cursor()
result = cursor.callfunc('degrees_to_celsius', cx_Oracle.NUMBER,
[212])
print(result)

For more information, see:

https://docs.djangoproject.com/en/1.3/topics/db/sql/#executing-custom-sql-directly
http://cx-oracle.sourceforge.net/html/cursor.html#Cursor.callfunc

Cheers,
Ian

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



Re: Django vs. Ruby on Rails

2012-01-27 Thread Chris Czub
> 3) Using one or the other for Geographic Information Systems work;

I know a lot of GIS people like GeoDjango a lot. I can't comment more than
that as I'm not familiar with the field, but it says something that I've
heard of GeoDjango but nothing similar for Rails.

On Thu, Jan 19, 2012 at 10:59 AM, Brian D  wrote:

> I'm wondering about diving into Ruby on Rails to qualify for a
> position, or spending my time instead going deeper into a full bells
> and whistles prototype Django site and betting on jobs opening up in
> my field. This is really a GIS career professional question.
>
> Has anyone here crossed the fence over to Ruby on Rails? What do you
> think when:
>
> 1) Comparing the framework to Django;
>
> 2) The communities -- friendliness, support, etc.;
>
> 3) Using one or the other for Geographic Information Systems work;
>
> 4) (I was going to leave this out but) Comparing Ruby to Python as
> languages.
>
> I think I've generally answered the last question from my own
> experience, great integration with spatial libraries, and from other's
> recommendations vis-a-vis Ruby on Rails.
>
> Answer any or all, if you like.
>
> What concerns me about Django is that, outside of forums like this,
> the chatter seems to have died down in the last couple of years from a
> peak in 2008/2009.
>
> I did search the group and haven't seen any recent discussions on this
> comparison.
>
> Any comment really very much appreciated.
>
> Kind regards,
> Brian
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Django vs. Ruby on Rails

2012-01-27 Thread Tim Chase

On 01/19/12 09:59, Brian D wrote:

1) Comparing the framework to Django;


In the broadest strokes (and from my understanding of it), Rails 
defaults to introspecting your database and building internal 
models of it while Django specifies models first and then builds 
the database out of it.  Django *can* introspect, and I think 
that Rails can go the other way.  But pretty much anything that 
can be done in one can be done in the other.



2) The communities -- friendliness, support, etc.;


I can speak to the Django community being generally friendly 
(usually more than the Python community which is itself pretty 
friendly unless folks come trolling).  I can't say I've heard 
horrible things about the Rails community, so I'd say that's 
likely a wash.



3) Using one or the other for Geographic Information Systems work;


can't speak to either of these


4) (I was going to leave this out but) Comparing Ruby to Python as
languages.


This is the make-or-break for me.  I tried multiple times to like 
Ruby and just couldn't.  I found it an atrocious language 
compared to the elegance of Python.  If you (or your team) have a 
strong leaning towards either language, that may be your biggest 
factor.



What concerns me about Django is that, outside of forums like this,
the chatter seems to have died down in the last couple of years from a
peak in 2008/2009.


I'd guess most of the chatter (both about Django & Rails) has 
subsided because folks are no longer buzzing about the Amazing 
Cool New Thing™ but they're instead simply implementing projects 
that do what they want using proven frameworks.  The incremental 
features don't generally garner buzz.


Just my $0.02USD.

-tkc





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



Re: django 1.4 orm standalone - GenericForeignKey

2012-01-27 Thread Vaal
 think I found a solution, but need to check[code]settings.configure( 
  DATABASES={        'default': {            'ENGINE':
'django.db.backends.sqlite3',            'NAME': 'db.sqlite',     
  }    },    INSTALLED_APPS=(    'django.contrib.contenttypes',))[/
code]

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



Re: Web Servers for Django Projects [WAS: Does anyone know any blogs...]

2012-01-27 Thread Stuart Laughlin
Hello Dale --

I see you asked this question nearly two weeks ago, but for some reason 
your message was delivered to my inbox just today.

Since your background is apache, I would stay there if I were you (and use 
mod_wsgi for your django apps). The only caveat is that I have no 
experience running php and django side-by-side, but presumably it is 
possible and perhaps even fairly common, e.g. 
http://stackoverflow.com/questions/1020390/how-do-i-run-django-and-php-together-on-one-apache-server


Hope that helps,

--Stuart

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



Re: django noob question

2012-01-27 Thread adj7388
Without knowing your problem domain, you might want to start off with:

class League(models.Model):
name = models.CharField(max_length=200)

class Team(models.Model):
name = models.CharField(max_length=200)
league = models.ForeignKey(League)

Generally you don't want a model with a plural name (like 'Leagues').
When you're dealing with more than one league, you will get leagues
out of your League model with:

my_leagues = League.objects.all()

which will return a queryset with all your leagues.

Likewise, for teams:

my_teams = Team.objects.all()

If you want to know the league for a specific team:

my_team = Team.objects.get(pk=1)
my_team_league = my_team.league

HTH,
Alan


On Jan 26, 2:37 pm, yousuf  wrote:
> this is my models.py
>
> from django.db import models
>
> # Create your models here.
>
> class Leagues(models.Model):
>     LeagueName = models.CharField(max_length=200)
>
> class Team(models.Model):
>     TeamName = models.CharField(max_length=200)
>
> class LeagueTable(models.Model):
>     league = models.ForeignKey(Leagues)
>     team = models.CharField(max_length=200)
>     matches_played = models.IntegerField()
>     matches_won = models.IntegerField()
>     matches_drawn = models.IntegerField()
>     matches_lost = models.IntegerField()
>     points = models.IntegerField()
>
> class FixtureTable(models.Model):
>     league = models.ForeignKey(Leagues)
>     fixture_date = models.DateField('Fixture Date')
>     team_one = models.CharField(max_length=200)
>     team_one_score = models.IntegerField()
>     team_two = models.CharField(max_length=200)
>     team_two_score = models.IntegerField()
> in the "class FixtureTable", i want team_one and team_two to be linked
> to two differnt teams in "class Team" models. how to create multiple
> relations, or is it possible.
>
> PS: this is purely a noob, with a little experience in programming,
> but no experience with either python or databases.
>
> PPS: I found that the best way to learn is to create your own problem,
> and solve the problem in parallel while following the tutorial. so i
> am just stuck in the beginning. thankyou.
>
> thankyou.

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



Re: how to lookup dictionary in filter return?

2012-01-27 Thread Reinout van Rees

On 16-01-12 10:10, snow leung wrote:

my filter return dictionary like this:

{{ somevalue | dic_filter }}


but when i try this

{%for itm in somevalue | dic_filter %}
   {{itm}}
{%endfor %}

it only print the key

how can i get the value with this ?


It is the same in Python. Looping over a dict returns the keys:

>>> my_dict = {'a': 'aaa',
...'b': 'bbb'}
>>> for key in my_dict:
... print key
a
b

If you want the values for those keys, you must use the key to get it 
out of the dict:


>>> for key in my_dict:
... print my_dict[key]
aaa
bbb

In your case:

{% for itm in somevalue | dic_filter %}
   {{ somevalue.itm }}
{% endfor %}

(And I'd replace 'itm' with 'key')



Reinout

--
Reinout van Reeshttp://reinout.vanrees.org/
rein...@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

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



Re: Error with Apache + mod_wsgi

2012-01-27 Thread Reinout van Rees

On 13-01-12 23:09, polar wrote:

ImproperlyConfigured: Error importing middleware
django.middleware.csrf: "No module named csrf"

I don't understand why because I didn't change anything in apache or
in the django.wsgi files. I just restart my cloud server. In the same
time, a php project running with apache is ok.


Probably something changed in your OS. Two common ones:

- You recently installed Django globally and now your project finds the 
(older) global django before it finds the one in your project.


- Your OS's default python version changed and you get different libraries.


I'd try looking at /usr/lib/pymodules/python2.6/django and figure out 
which Django version that is. And if python 2.6 is the same one as was 
running before.



Reinout

--
Reinout van Reeshttp://reinout.vanrees.org/
rein...@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

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



Re: I need help with Python Tools for Visual Studio 2010 and Django

2012-01-27 Thread JJ Zolper
Thanks a lot I was thinking I would learn the Google Maps API. Have you 
worked with OSM?

Do you have any input if you have used OSM and if you have used Google Maps 
what your comments are?

Thanks,

JJ Zolper

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



Re: I need help with Python Tools for Visual Studio 2010 and Django

2012-01-27 Thread JJ Zolper
Thanks a lot I was thinking I would learn the Google Maps API. Have you 
worked with OSM?

Do you have any input if you have used OSM and if you have used Google Maps 
what your comments are?

Thanks,

JJ Zoler

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



Re: I need help with Python Tools for Visual Studio 2010 and Django

2012-01-27 Thread JJ Zolper
> ActivePython for Windows includes the win32 extension libraries (if
>  one wants to go to native Windows code -- though the now standard ctypes
>  library permits similar capability if one knows the API), and PythonWin
>  IDE (as I recall, this started life as an included demo of the win32
>  extension libraries ). 

I don't necessarily want all my code to be native WIndows code. I'm 
starting to get the impression that since Django is developed on Unbuntu I 
should setup an interpreter on my VM with Unbuntu?

That's really all I am trying to understand. From A to B. A being where I 
am able to develop once I finally am able to make that decision and B how 
smart I picked A so that the move from my local computer to my server is 
smooth and simple.

I'm just unfamiliar with Python and how any of it is done besides just once 
you have an interpreter and type in simple functions. I've done everything 
from the interpreter I haven't even made a program yet. I just wanted to be 
in the right place when I started from the beginning just where I can send 
my work into production directly. If I loose compatibility with libraries 
and important features in Windows I will absolutely change my current 
course and move to where everyone is in the UNIX/LINUX realm.

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



Re: I need help with Python Tools for Visual Studio 2010 and Django

2012-01-27 Thread JJ Zolper
Since I will be deploying my Python code on a server that is based on Linux 
wouldn't it be smart that I develop my Python code on something similar to 
my VM for Django?

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



Re:

2012-01-27 Thread Babatunde Akinyanmi
I'm presently working on something very similar.
I created a model that holds a single question, its options and its answer.
I also created what I call QuestionForm which will draw the amount of
Question objects needed and then render them as a form. When the form is
submitted, the QueryDict is passed into a QuestionForm the correct answers
are processed.

On Sun, Jan 15, 2012 at 5:30 PM, Arun Ashok  wrote:

> Hai all,
>   I want to develop a django application for online objective type
> examination.For this i wish to use radio buttons for selecting answers
> and calculate mark and result at the time of the completion of exam.So
> i kindly request to my dear friends please give advice for creating
> this application
>   with regards
>  Arun
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Problem in Geodjango

2012-01-27 Thread Jeff Heard
Check that you are actually using the
django.contrib.gis.db.backends.postgis (or other) database backend in your
settings.py. It sounds like the SQL to create geometry columns is never
getting called.

On Thu, Jan 12, 2012 at 4:38 AM, Vicky .. wrote:

> Hi Everyone ..
>
> I am following the steps given in
> https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/#
>
> and the steps i followed before
> https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/#spatial-queries
>  were
> working fine but after that I got error in the ** qs =
> WorldBorder.objects.filter(mpoly__contains=pnt_wkt)* in this Statement .
>
>  Error it is showing is
>
>  *FieldError: Cannot resolve keyword 'mpoly' into field. Choices are:
> area, fips, geom, id, iso2, iso3, lat, lon, name, pop2005, region,
> subregion, un*
>
> and if I am executing this line
>
> * sm = WorldBorder.objects.get(name='San Marino')** *
>
> *Error is  *
>
> ***DatabaseError: column world_worldborder.geom does not exist LINE 1:
> ...ld_worldborder"."lon", "world_worldborder"."lat", "world_wor...**
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: GeoDjango - Error while importing data

2012-01-27 Thread Jeff Heard
you are using Postgres 9.1  There is a bug in the adapter for 9.1.  It is
addressed and fixed with this patch:

https://code.djangoproject.com/ticket/16778

On Mon, Jan 16, 2012 at 2:52 AM, Serge RABEVOHITRA <
serge.rabevohi...@gmail.com> wrote:

> Hi,
>
> I've just begun to learn GeoDjango. So I followed step by step the
> "geodjango tutorial".
> When I was at the step "Import data" (TM_WORLD_BORDERS-0.3.shp) , i've
> got this error message :
> "Failed to save the feature (id:0) into the model with the keyword
> arguments : {'iso2' : u'AG'
> DatabaseError: ERREUR: sequence d'octets invalide pour l'encodate
> UTF-8 : 0x00"
>
> I'm very pleased if anyone could help me.
> Thanks.
>
> Regards!
> Serge
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Inheriting Permissions from Abstract Class

2012-01-27 Thread Alec Koumjian
Just wanted to ping this as it just got approved.

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



Re: Confused with django model Limit and Offset Implementation

2012-01-27 Thread Swaroop Shankar V
got it working thanks anyway :)

Thanks and Regards,
Swaroop Shankar V



On Mon, Jan 23, 2012 at 12:00 PM, Leandro Ostera Villalva <
leost...@gmail.com> wrote:

> AFAIK it is [offset:page]
>
> El 22 de enero de 2012 20:40, Swaroop Shankar V escribió:
>
>> Hi,
>> Am trying to create a custom pagination for my project, but am seriously
>> struck with the django implementation of Limit and offset. I went through
>> the documents, instead of making me understand how it works, i ended up
>> more confused. So suppose I have a page limit of 3 records per page and if
>> i want to load the second set of records how should the following statement
>> be?
>>
>> Data = NewsFeedStory.objects.order_by('-updated_on')[?:?]
>>
>> and similarly if i want to load the 3rd set with same page limit, how
>> should the same statement be? I played with the django shell to figure out
>> how this works but am still confused. Please help.
>>
>> Thanks and Regards,
>>
>> Swaroop Shankar V
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Regards,
>
> Leandro Ostera,
> *BLOG - Check what I'm doing now 
> EMAIL - Write me an email 
> SHOWCASE - Check my latest projects *
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Group Moderation

2012-01-27 Thread Karen Tracey
On Wed, Jan 25, 2012 at 12:36 PM, Alec Koumjian  wrote:

> I posted early yesterday and still haven't been approved to post or
> comment. I could not find an administrative contact. Please advise.
>
>
Apologies -- something seems to have broken with the google groups
moderation emails -- I have not been getting them lately. There were nearly
100  items queued for moderation, so I'd guess none of the other moderators
were getting them either. For right now I have cleared the queue (passing
most things through, apologies if some are duplicates and marking as spam
things that were obvious spam). Hopefully I will have some time later today
to see if I can figure out why moderation emails have stopped getting sent
out to the moderators

Karen

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



Re: What am I doing wrong with this URL Pattern

2012-01-27 Thread Tim Chase

On 01/19/12 03:36, Django Newbie wrote:

Example.
url(r'^People/Info/(?P\d+)/$', 'iFriends.People.views.details'),
url(r'^People/Info/(?P[a-z]{3})/$',
'iFriends.People.views.detail_name'),

It works with numeric value.  if I use "http://localhost:8000/
People/Info/1/"

but not with  if I use http://localhost:8000/People/Info/Jan/

probably something small but still leaning.


I believe by default the regexps are case-sensitive, so if you're 
asking for "jan" it might work, while asking for "Jan" will 
likely fail.  Try using "[a-zA-Z]" instead.


-tkc


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



Re: Should someone with no programming experience start learning Python, or Django (along with Python) first?

2012-01-27 Thread Tim Chase

On 01/17/12 15:40, Steve wrote:

Just as the title says, I have basically no programming
experience.  I want to program purely for the web.  I know a
bit of HTML, CSS, and very minimal amounts of Java.  Can I
start learning Django first and go from there?  Is that a bad
idea?


Since Django is written in Python, I'd start with learning Python 
first.  Along the way, you'll develop a discernment for 
"pythonic" code, and it will help you as you learn Django.


Fortunately, if you know any other programming languages, 
learning the basics of Python is pretty uneventful.  It's very 
easy to learn.  Granted, it has a HUGE standard library, so keep 
that in mind:  whenever you reach for a solution to a somewhat 
obvious task, ask if somebody else has already solved it for you 
(perhaps even having a solution in the stdlib).  CSV parsing, 
email access (IMAP/SMTP/POP3), command-line parameter passing 
(optparse/argparse), shell-parameter lexing (shlex), etc are all 
"batteries included".


-tkc



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



django 1.4 orm standalone - GenericForeignKey

2012-01-27 Thread Vaal
Hi!
In version 1.3 I have no problem using GenericForeignKey in standalone
scripts with Django ORm and GenericForeignKey.
And in 1.4 there is a problem.

http://dpaste.com/694017/

(virtualenv) C:\Users\user\Desktop\django-test>python django14.py
Traceback (most recent call last):
  File "django14.py", line 62, in 
main()
  File "django14.py", line 54, in main
test1.parent = test2
  File "D:\Development\virtualenv\lib\site-packages\django\contrib
\contenttypes\generic.py", line 13
9, in __set__
ct = self.get_content_type(obj=value)
  File "D:\Development\virtualenv\lib\site-packages\django\contrib
\contenttypes\generic.py", line 58
, in get_content_type
return
ContentType.objects.db_manager(obj._state.db).get_for_model(obj)
AttributeError: 'NoneType' object has no attribute 'objects'

In version 1.4 this is possible? or no longer there?

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



problems running subprocess inside django view

2012-01-27 Thread Mark Lancaster
I'm having problems running subprocess inside a django view using:

result = subprocess.Popen([ , ],
stdout=subprocess.PIPE).communicate()[0]

exactly the same method works perfectly inside a regular python
script.

Should I be using a different method to initiate a script?

Thanks

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



Handling multiple parameters on URI via GET

2012-01-27 Thread Darren Spruell
I've puzzled my way into a corner. Figuring this will be a
palm-to-forehead moment.

I have a page on my site which is Paginator-ed for the object list.
I'm sticking to the vanilla setup from the docs so when it is in
effect I've got a URI query string of '?page=%d' processed via GET.
I've added a search form to the page and am passing the form data via
GET as well so when a search is in effect I have '?search=%s' on the
URI query. I'm incredibly creative (not) so most of this is done very
closely modeling the approach at
http://www.djangobook.com/en/1.0/chapter07/. I can do either of them
individually  just fine, but I can't figure a clean way to have both
pagination and search parameters operate properly across requests as
the user selects next/previous, etc. in the page navigation. It works
if I manually append the missing query parameter to the URI.

How is this typically best handled in Django? I thought about trying
to determine uri query in template and dynamically build the nav links
to include parameters for search and pagination but I didn't figure a
way that wasn't a complete mess.


## view

def list_submissions(request):
"""
Present list of submission logs, paginated.

"""
search_form = SubmissionLogSearchForm()
query = request.GET.get('search', '')
if query:
qset = (
Q(file_name__icontains=query) |
Q(file_md5=query) |
Q(file_sha1=query) |
Q(submitter__username=query)
)
submissionlog_list = SubmissionLog.objects.filter(qset)
else:
submissionlog_list = SubmissionLog.objects.all()

paginator = Paginator(submissionlog_list, 15)  # show N logs per page

# Make sure page request is an int. If not, deliver first page.
try:
page = int(request.GET.get('page', '1'))
except ValueError:
page = 1

# If page request () is out of range, deliver last page of results.
try:
submissionlogs = paginator.page(page)
except (EmptyPage, InvalidPage):
submissionlogs = paginator.page(paginator.num_pages)

return render_to_response('avsubmit/submissionlog_pages.html', {
'submissionlogs': submissionlogs,
'search_form': search_form,
}, context_instance=RequestContext(request))


## template

Showing {{ submissionlogs.object_list.count }} submission{{
submissionlogs.object_list.count|pluralize }} of {{
submissionlogs.paginator.count }} total

{% if submissionlogs %}

{{ search_form.as_p }}




  
File MD5File
NameSubmitterSubmission Date
  
  {% for log in submissionlogs.object_list %}
  {% cycle 'row1' 'row2' as rowcolors silent %}
  
{{ log.file_md5 }}
{{ log.file_name }}
{{ log.submitter }}
{{ log.date_submitted|date:"m/d/Y h:i A" }}
  
  {% endfor %}

{% endif %}



{% if submissionlogs.has_previous %}
<<
{% endif %}


Page {{ submissionlogs.number }} of {{
submissionlogs.paginator.num_pages }}


{% if submissionlogs.has_next %}
>>
{% endif %}



Thx,

-- 
Darren Spruell
phatbuck...@gmail.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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Parsing HTML

2012-01-27 Thread ddtopgun

i'am new to django and i want to try get the content of HTML.
can help me how to get the content of html.

f=urllib.request.urlopen("http://site_name.com";)
s=f.read()
f.close()

but the code is display all code html. i want to just take the contents 
of tag html.


thanks.

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



django noob question

2012-01-27 Thread yousuf
this is my models.py

from django.db import models

# Create your models here.

class Leagues(models.Model):
LeagueName = models.CharField(max_length=200)

class Team(models.Model):
TeamName = models.CharField(max_length=200)

class LeagueTable(models.Model):
league = models.ForeignKey(Leagues)
team = models.CharField(max_length=200)
matches_played = models.IntegerField()
matches_won = models.IntegerField()
matches_drawn = models.IntegerField()
matches_lost = models.IntegerField()
points = models.IntegerField()

class FixtureTable(models.Model):
league = models.ForeignKey(Leagues)
fixture_date = models.DateField('Fixture Date')
team_one = models.CharField(max_length=200)
team_one_score = models.IntegerField()
team_two = models.CharField(max_length=200)
team_two_score = models.IntegerField()
in the "class FixtureTable", i want team_one and team_two to be linked
to two differnt teams in "class Team" models. how to create multiple
relations, or is it possible.

PS: this is purely a noob, with a little experience in programming,
but no experience with either python or databases.

PPS: I found that the best way to learn is to create your own problem,
and solve the problem in parallel while following the tutorial. so i
am just stuck in the beginning. thankyou.

thankyou.

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



IntelliJ IDE, Running & Debugging Tests

2012-01-27 Thread Trevor Ewen
Hi -

Has anyone managed to run/debug their tests in IntelliJ IDE? If so,
are there any specific tricks to the launch configurations, IDE setup,
or version. Any information you have would be very helpful.

Thanks,

TE

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



Re: [pinax-users] Learning Django+Pinax - Recommend books and/or tutorials?

2012-01-27 Thread Steven Elliott Jr
> 
> What would you recommend?
> 
To get started with Python:
http://pragprog.com/book/gwpy/practical-programming
http://www.amazon.com/gp/product/1590599829/ref=pd_lpo_k2_dp_sr_3/182-5610174-4840816?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=lpo-top-stripe-1&pf_rd_r=1YTG71HMBVWK64HZ2TP2&pf_rd_t=201&pf_rd_p=486539851&pf_rd_i=0764596543

To get started with Django:
http://www.amazon.com/Django-Website-Development-Ayman-Hourieh/dp/1847196780/ref=sr_1_2?s=books&ie=UTF8&qid=1327587925&sr=1-2
http://www.amazon.com/Practical-Django-Projects-Experts-Development/dp/1430219386/ref=sr_1_2?s=books&ie=UTF8&qid=1327587948&sr=1-2

There is no reason why you could not learn both things at the same time. 
Contrary to previous statements, Django and Python are not hard to get started 
with but are hard to master (as is anything). I like both of the Django books 
because they actually focus on building something meaningful and not just 
giving you an overview of the framework. The Django book is also a great 
reference book but I have never read it through cover-to-cover. I use it more 
as a reference when I am stuck on something and need some clarity. Also, I 
would really recommend going through the documentation for both Python and 
Django extensively, both are excellent.

Cheers,
Steven

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



Django empty admin in Development

2012-01-27 Thread darwin_tech
Hi,

I have a problem which has stumped me for some time now. On my
development server my Django Admin works as expected, showing all my
models and the auth models. However, on the production server, even
though the whole application works fine, when I log into the admin I
see nothing. No models, no auth. Just a stack of empty boxes.

If anyone has any idea as to why this might be, your input would be
much appreciated.

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



Re: Determine gender from first name

2012-01-27 Thread Carsten Agger

Den 25-01-2012 09:59, Praveen Krishna R skrev:

*I don't know if there are any databases or webservices available for
the purpose. But how would you handle the exceptions ?! Like if it does
not exist in the db, and common names used across genders ?!*
*
*



In general this would not be possible.

Kim, e.g., is used as a female name in English and as a male name in 
Scandinavian languages.


Robin is used as a female and male name.

Then there's combinations such as José María and María José, which 
require knowledge of Spanish naming conventions.


Andrea is a male name in Italian.

I think you might go by a list but there'd always be errors.


--
Carsten Agger
Magenta ApS
Åbogade 15
8200 Århus N

Tlf  +45 2086 5010
http://www.magenta-aps.dk
carst...@magenta-aps.dk

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



Re: Moving a file manually

2012-01-27 Thread Jonathan Paugh

On 01/26/2012 03:44 AM, Tor Nordam wrote:

Hello,

I have a model with a FileField, that I use to store some user
uploaded files. After a while, I changed my mind about where to store
the files, so I was just wondering if there is a way to manually move
a file, and then update the location of the file as stored in the
database. I'm using a plain models.FileField, with no custom Storage
or anything advanced.

Cheers,
Tor

You could write a short script to do the rename, and run it under 
"./manage.py shell". Of special interest are the os.path.basename() and 
os.path.join() functions. I haven't worked with FileFields, though, so 
be wary of my advice.


something like this:
import os.path
from app.models import Model
prefix = #new folder location
ms = Model.objects.all()
for m in ms:
 oldname = m.fileField.?? #get old path name
 basename = os.path.basename(oldname) # Get the filename by itself
 newpath = os.path.join(prefix, basename)
#store it back on the object
m.save()


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



Re: Determine gender from first name

2012-01-27 Thread Jonathan Paugh
- Original Message -
From: Demetrio Girardi
Sent: 01/25/12 03:49 AM
To: django-users@googlegroups.com
Subject: Determine gender from first name

 This is not a django-specific question, but I couldn't find anything useful on 
the subject and have no better place to ask. Let's say I want to put "welcome 
{{user.first_name}}" on top of my template. In many languages, "welcome" has to 
be declined by gender. I have no use for the user's gender otherwise, so I 
don't want to ask for it in the registration process. How can I go about this? 
Is there a publicly available database of first names divided by language and 
gender? A public web-service that guesstimates the gender? -- You received this 
message because you are subscribed to the Google Groups "Django users" group. 
To post to this group, send email to django-users@googlegroups.com. To 
unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com. For more options, visit this group 
at http://groups.google.com/group/django-users?hl=en. 
 What about the boy named Sue?

 In some cultures, guessing "male" might be somewhat acceptable. On the other 
hand, any guess could be wrong---and offensive. My advice is to ask. Perhaps 
make it optional, with a default to one or the other; at least if they take 
offense they can fix it.

 Of course, you could reword your translation so as to get around this, but 
that may be more difficult and awkward than it's worth.

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



queryset[] returns different reference every time it is called

2012-01-27 Thread newme
users = User.objects.filter(pk=1)

user0 = user[0]
user1 = user[1]

user0 is user1
returns false

it seems [] returns different reference every time it is called?
how could this be done?
i know it's maybe a python question, if i post it in a wrong group,
i'm sorry.

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



Re: I need help with Python Tools for Visual Studio 2010 and Django

2012-01-27 Thread Steven Elliott Jr

On Jan 25, 2012, at 9:14 PM, JJ Zolper wrote:

> > The keywords were 'in production'. The development server (i.e. python
> > manage.py runserver) works fine under Windows. But when you want to
> > make the website accessible to your audience (the internet, company
> > etc.), you should host that on Linux. 
> 
> I still don't quite understand. Can you explain more? I would think this 
> means that my Django files should be on a Linux portion of my web server? I 
> am with Bluehost.com

It means when you actually go to deploy your app on an actual web server in 
production you're going to be deploying on Linux. I've never seen a Python host 
on Windows, but then again I've never looked because, to be honest most Django 
devs use some Unix variant for development.

> I have installed ActiveState and will give it a try. I have my VS up and 
> running with Python Tools for VS so that should be okay.
> 
> Hey Sam you've been a great help. Would you by chance mind giving me your 
> e-mail address? That way in the future I could work with you? I won't bother 
> you too much don't worry! lol. Just since I am trying your advice it could be 
> a great help to me.
> 
> What Virtual Machine did you pick? What Linux version are you running?

Most people use Ubuntu running in VirtualBox
> 
> If you prefer e-mailing/want to give me your address my next inquery would 
> just go to your e-mail.
> 
> Thanks so much!
> 
> JJ Zolper
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/nMqg8xOLXRcJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

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



Help with new version of django

2012-01-27 Thread itua ijagbone
Hello, please i need help as to how to update my project to the
lastest version of django 1.3.1. i have been using 1.1.1 to develop
the project. Please how do i go about it, making my project conform to
1.3.1

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



Django as app backend

2012-01-27 Thread jompa
I was thinking about using django as backend for a simple smartphone
app and, as I'm quite unexperienced with Django and it's
possibilities, was wondering if anybody has any experience of this.

Basics:
Abillity ro create a node with image, description etc (backend admin).
Retrieve nodes via JSON, XML API.
Possibility to rate node from app, with unique identifier.

Needed:
Imagefield handler (imagekit?). Prefered CDN pushing.
RESTish framework. Perhaps with user creation.

Anybody with similar experience that would like to share their
thoughts on good plugins, gotchas or recommendations would be deeply
appreciated.

Thanks
/J

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



Model object can be created in the admin, but cannot be edited after saving?

2012-01-27 Thread marshall
I've got a model that serves as a front-end to spawn celery tasks
called LaryerImportTask. I want the admin user to be able to create
LayerImportTask objects in the admin, but I don't want them to be able
to change it in the admin after it's been created. Any ideas on how I
could do this?

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



Group Moderation

2012-01-27 Thread Alec Koumjian
I posted early yesterday and still haven't been approved to post or 
comment. I could not find an administrative contact. Please advise.

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



Template Loader Error: (It's been really frustrating till now..!)

2012-01-27 Thread Tony Kyriakides
Hey all...  i get this error while i have a template directory and my
about.html file It doesn't display the home.html either...

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/about/

Django Version: 1.3.1
Python Version: 2.7.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')

Template Loader Error:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/home/tony/Documents/blog/blog/templates/about.html (File does not
exist)
Using loader django.template.loaders.app_directories.Loader:



Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/
base.py" in get_response
  111. response = callback(request,
*callback_args, **callback_kwargs)
File "/home/tony/Documents/blog/../blog/views.py" in about
  9. return render_to_response('about.html',)
File "/usr/local/lib/python2.7/dist-packages/django/shortcuts/
__init__.py" in render_to_response
  20. return HttpResponse(loader.render_to_string(*args,
**kwargs), **httpresponse_kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/template/
loader.py" in render_to_string
  181. t = get_template(template_name)
File "/usr/local/lib/python2.7/dist-packages/django/template/
loader.py" in get_template
  157. template, origin = find_template(template_name)
File "/usr/local/lib/python2.7/dist-packages/django/template/
loader.py" in find_template
  138. raise TemplateDoesNotExist(name)

Exception Type: TemplateDoesNotExist at /about/
Exception Value: about.html

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



TinyMCE, safe tag and wrong conversion of entities

2012-01-27 Thread jurgen
In my admin interface, I can create a database entry which contains
HTML using TinyMCE. I do this to create publication entries for my
website. In the database, a publication entry stores entities using
numeric encoding. To render a list of publications, I use the safe tag
in the django template. The result looks correctly like this:
http://visdom.at/publications/

All entities are correctly shown.

I use the same technique in another template to render only some of
the publications for a particular person:
http://www.visdom.at/jwaser

However, here the ü's and ö's are messed up. What puzzles me even
more, is that the entities for the name Ribičić are correctly
displayed.

What am I doing wrong?

Thx for any help,
Jürgen

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



Re: django docs __unicode__ return u'%s %s

2012-01-27 Thread Alec Koumjian
The '%' symbol is used for formatting inside of a string. This is Python, 
not Django specific. It is a shortcut to insert variables (and format them 
to your liking) instead of doing messy stuff like this:

adjective = 'messy'
print 'This is the ' + adjective + ' way to do it'

As opposed to:
adjective = 'preferred'
print 'This is the %s way to do it' % adjective

Full documentation is 
here: http://docs.python.org/library/stdtypes.html#string-formatting-operations

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



Inheriting Permissions from Abstract Class

2012-01-27 Thread Alec Koumjian
I have some custom permissions that I would like to give to about half a 
dozen different classes. If I did them individually they might look like 
this:

MyModel(models.Model):
...
Meta:
permissions = (('view_mymodel', 'View Mymodel'),)
...

That's all good and well, but following a DRY principle, I thought I would 
simply create an abstract class to inherit from. I thought it would look 
like this:

MyAbstractModel(models.Model):
...
Meta:
permissions = (('view_%s' % self.__class__, 'View %s' % 
self.__class__))
...

MyModel(MyAbstractModel):
...

The problem is that, as far as I can tell, there is no way to access the 
class name from inside the Meta class. I can't find a way to make the above 
work. I'm very much looking for suggestions.

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



Re: get_FOO_display() for generic/variable choice fields

2012-01-27 Thread Michael Elkins

On Tue, Jan 24, 2012 at 03:51:27AM -0800, katstevens wrote:

Obviously the 'val = obj.get_field_display()' line doesn't work!

Is there a generic way of doing this (something like
obj.get_display(fieldname) ?) or am I going to have to hard code
separate checks for get_country_display() and
get_dialing_code_display()?


I think you can do what you want like this:

obj = queryset[my_item]

for field in obj._meta.fields:
if field.choices:
val = obj._get_FIELD_display(field)
else:
val = getattr(obj, field.name)
row.append(val)

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



django-admin.py is not working.

2012-01-27 Thread Sammy
I am new to django and i have been trying to create a django project
with no success. Every time i type django-admin.py startproject
mysite. I get
C:\Users\WASSWA SAM\Documents\django\djcode>django-admin.py
startproject mysite
Usage: django-admin.py subcommand [options] [args]

Options:
  -v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal
output,
2=all output
  --settings=SETTINGS   The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't
provided, the
DJANGO_SETTINGS_MODULE environment variable
will be
used.
etc.
I have put django in my path variable  like so C:\Python26\Lib\site-
packages\django\bin. Also when i carry out import django in
interactive mode it works perfectly. I am  using windows 7.

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



Re: I need help with Python Tools for Visual Studio 2010 and Django

2012-01-27 Thread Jonathan Paugh

On 01/23/2012 03:58 PM, JJ Zolper wrote:
Yes I knew I was in the Python shell I just never saw anything that 
described you couldn't make Django commands within the Python 
interpreter. I mean it is based on Python isn't it? That's where I 
thought logically you could make Django calls from in Python?


SO

Shells run commands. Python is not a shell.  If you want to run the 
Python /command/ from inside of the Python interpreter prompt, the 
closest you can get is:

>>> import os
>>> os.system('python ./manage.py')

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



Recurly REST API

2012-01-27 Thread Zeeshan Syed
Hey guys,

I'm pretty new to Django. I was curious to know if someone could
provide me with an example of how to utilize the Recurly API using
Pyhon and Django. The API is here http://docs.recurly.com/api/subscriptions.
But I'm unsure of how to perform an action like reactivate a
subscription. If someone could please provide me with example code
that I could use, I'd really appreciate that.

Thanks,

Zeeshan

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



confusion about choosing the database user name (Postgresql/psycopg2)

2012-01-27 Thread MiddleForkGIS
I'm a little confused about the choice of the database user to specify
in the settings.py configuration file.

On the one hand, if I set the user to be 'www-data' (the Apache2
user), I can serve pages to the public just fine, but cannot use the
admin site.

DatabaseError at /admin/
permission denied for relation django_session

Which of course is desirable, because user 'www-data' should have read-
only access to the tables

--

Conversely, if I set the user to be a real user (ie "myself") then I
can utilize the admin site but cannot serve pages to the public.

File "/usr/lib/python2.7/dist-packages/django/db/backends/
postgresql_psycopg2/base.py", line 140, in _cursor

self.connection = Database.connect(**conn_params)
OperationalError: FATAL:  Peer authentication failed for user "myself"

-

What am I failing to do or to understand?




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



Re: Transition from VPS(WHM/CPanel) to EC2

2012-01-27 Thread Matt Stevens
I've never used EC2, but on my VPS with Linode I have:

1. Nagios with event handlers, can be configured to perform any
action when the state of a service or host changes.
2. I use Bind, no experience with Route 53.
3. pgAdmin is a brilliant program, much better than phpMyAdmin –
albeit it's not web based.
4. I use rsnapshot, I've never had a problem.
5. iptables

Matt. Stevens

On Jan 23, 1:54 am, brian  wrote:
> I'm in the process of transitioning from a VPS (WHM/CPanel) to EC2.
> I've found some great how to's on setting up a machine for the
> cloud[1] but I'm not sure the best setup to add some of the WHM/CPanel
> features.
>
> Here are some of the features of cpanel I use:
> 1. Cpanel monitors the services (i.e. apache) and restarts them if
> they crash.  I'm thinking about using supervisord for this.  Does
> anyone have experience with this or is there other tools I should be
> looking at?
> 2. I'm running a custom DNS(BIND).  I'm planning on switching to
> Amazon Route 53.
> 3. I'm switching to PostgreSQL and I'd like to have something similar
> to myPhpAdmin.
> 4. Creating a  backup script seems pretty straight forward.
> 5. What is the best way to create a firewall to block certain IPs?
> I'll have an nginx server in front of apache.
>
> How have others implemented these features?  Is there anything else I
> should be thinking about?  I don't mind a command line interface.
>
> Brian
>
> [1]http://blip.tv/pycon-us-videos-2009-2010-2011/django-deployment-works...

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



Re: Confused with django model Limit and Offset Implementation

2012-01-27 Thread Leandro Ostera Villalva
AFAIK it is [offset:page]

El 22 de enero de 2012 20:40, Swaroop Shankar V escribió:

> Hi,
> Am trying to create a custom pagination for my project, but am seriously
> struck with the django implementation of Limit and offset. I went through
> the documents, instead of making me understand how it works, i ended up
> more confused. So suppose I have a page limit of 3 records per page and if
> i want to load the second set of records how should the following statement
> be?
>
> Data = NewsFeedStory.objects.order_by('-updated_on')[?:?]
>
> and similarly if i want to load the 3rd set with same page limit, how
> should the same statement be? I played with the django shell to figure out
> how this works but am still confused. Please help.
>
> Thanks and Regards,
>
> Swaroop Shankar V
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards,

Leandro Ostera,
*BLOG - Check what I'm doing now 
EMAIL - Write me an email 
SHOWCASE - Check my latest projects *

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



pyodbc.connect timeout question

2012-01-27 Thread Luis Tavera
Hi all,

I have some code similar to the one below that runs slightly differently if
I run it outside Django and within Django. The difference is that within
Django it takes much longer to raise the pyodbc.Error (several minutes)
than outside Django (a few seconds). I am new to Django (and Python) and I
wonder why this may be happening.

Any hints will be appreciated.

thanks,

Luis



import pyodbc

def connect():
try:
cnxn = pyodbc.connect('DRIVER={SQL Server NATIVE Client
11.0};SERVER=%s;UID=uid;PWD=pwd' % '127.0.0.1',
  timeout=5)
except pyodbc.Error:
print "could not connect"
return None


connect()

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



Re: Setting Network settings from Python/Django

2012-01-27 Thread Leandro Ostera Villalva
I take it that, at the end of the day, Django is Python code, thus you can
execute whatever Python code you want in certain places (like views).

Hope that pointed somewhere!

El 22 de enero de 2012 01:20, Ganesh Kumar  escribió:

> Hi guys
>
> I'm working on a simple web interface for an embedded computer. The
> computer will ship with a static default ip that will then need to be
> updated by the install tech who may not be tech/linux savvy.
>
> Basicly I need to change the following system settings from a Django app.
>
>1. IP Addres
>2. Subnet
>3. Default Gateway
>4. DNS Servers 1&2
>
> I realize that I can could just overwrite the config files in linux but I
> was wondering if there is a more "Python" way of doing it.
>
> I want any ready to use module is there, please guide me.
>
>
> -Ganesh.
> Did I learn something today? If not, I wasted it.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Regards,

Leandro Ostera,
*BLOG - Check what I'm doing now 
EMAIL - Write me an email 
SHOWCASE - Check my latest projects *

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



Re: imagefiled don't Work

2012-01-27 Thread Tony Kyriakides
(in the terminal)
python manage.py syncdb

On Jan 21, 8:57 am, cha  wrote:
> Hello I reading this 
> tutorialhttps://pype.its.utexas.edu/docs/tutorial/unit6.html#answers
> it's work OK But When I want improve it and add ImageField in Category
> Model i have problem with ImageField It's Not uploaded
>
> file = models.ImageField(upload_to='img/%Y')
>
> see code please :
> _
> views.py
> _
> from django import forms
> class CategoryForm(forms.ModelForm):
>     class Meta:
>         model = Category
>
> def add_category(request):
>     if request.method == "POST":
>         form = CategoryForm(request.POST, request.FILES)
>         ## Handle AJAX  ##
>         if request.is_ajax():
>             if form.is_valid():
>                 form.save()
>                 # Get a list of Categories to return
>                 cats = Category.objects.all().order_by('name')
>                 # Create a dictionary for our response data
>                 data = {
>                     'error': False,
>                     'message': 'Category %s Added Successfully' %
> form.cleaned_data['name'],
>                     # Pass a list of the 'name' attribute from each
> Category.
>                     # Django model instances are not serializable
>                     'categories': [c.name for c in cats],
>                 }
>             else:
>                 # Form was not valid, get the errors from the form and
>                 # create a dictionary for our error response.
>                 data = {
>                     'error': True,
>                     'message': "Please try again! one",
>                     'name_error': str(form.errors.get('name', '')),
>                     'slug_error': str(form.errors.get('slug', '')),
>                     'file_error': str(form.errors.get('file', '')),
>                 }
>             # encode the data as a json object and return it
>             return http.HttpResponse(json.dumps(data))
>
>         ## Old Form Handler Logic ##
>         if form.is_valid():
>             form.save()
>             return http.HttpResponseRedirect('/category/')
>     else:
>         form = CategoryForm()
>     cats = Category.objects.all().order_by('name')
>     context = Context({'title': 'Add Category', 'form': form,
> 'categories': cats})
>     return render_to_response('ajax_form.html',
> context,context_instance=RequestContext(request))
>
> ___
> ajax_form.html
> ___
>
>      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
>    {{ title }}
>    
>       #message {width:250px; background-color:#aaa;}
>       .hide {display: none;}
>    
>    http://ajax.googleapis.com/ajax/
> libs/jquery/1.3.2/jquery.js">
> 
> 
>
>     
>     // prepare the form when the DOM is ready
>     $(document).ready(function() {
>         $("#add_cat").ajaxStart(function() {
>             // Remove any errors/messages and fade the form.
>             $(".form_row").removeClass('errors');
>             $(".form_row_errors").html('');
>             $("#add_cat").fadeTo('slow', 0.33);
>             $("#add_cat_btn").attr('disabled', 'disabled');
>             $("#message").addClass('hide');
>         });
>
>         // Submit the form with ajax.
>         $("#add_cat").submit(function(){
>             $.post(
>                 // Grab the action url from the form.
>                 "#add_cat.getAttribute('action')",
>
>                 // Serialize the form data to send.
>                 $("#add_cat").serialize(),
>
>                 // Callback function to handle the response from view.
>                 function(resp, testStatus) {
>                     if (resp.error) {
>                         // check for field errors
>                         if (resp.name_error != '') {
>                             $("#name_row").addClass('errors');
>                             $("#name_errors").html(resp.name_error);
>                         }
>                         if (resp.slug_error != '') {
>                             $("#slug_row").addClass('errors');
>                             $("#slug_errors").html(resp.slug_error);
>                         }
>                         if (resp.file_error != '') {
>                             $("#file_row").addClass('errors');
>                             $("#file_errors").html(resp.file_error);
>                         }
>                     } else {
>                         // No errors. Rewrite the category list.
>                         $("#categories").fadeTo('fast', 0);
>                         var text = new String();
>                         for(i=0; i                             var m = resp.categories[i]
>                             text += "
  • " + m + "
  • " >                         } >                         $("#categories").html(text); >                         $("#categories").fadeTo('slow', 1); >                         $("#id_name").attr('valu

    Re: How can I go about this?

    2012-01-27 Thread Leandro Ostera Villalva
    You can still use some of what Donald said to give you an idea of where to
    start. Have you went thru the tutorials? Do you know the basics?
    
    That would give us a better chance to help you! =)
    
    El 22 de enero de 2012 00:44, coded kid  escribió:
    
    > Thanks for the reply. I don't really mean twitter clone, just want
    > want users to post update, so their friends can comment, and reshare
    > the post. And it will be build in django.
    >
    > Donald Casson wrote:
    > > This is a very open ended question.  There are many different ways in
    > which you could achieve the same thing.
    > >
    > >
    > > Just offering a suggestion here:
    > >
    > > I would take a read through the retwis docs, although it is php and
    > redis it should give you enough of an understanding on how to implement
    > some of the ideas in django.
    > >
    > > http://redis.io/topics/twitter-clone
    > >
    > > Cheers
    > > Don
    > >
    > >
    > >
    > > On 22/01/2012, at 6:11 PM, coded kid wrote:
    > >
    > > > Hey guys, please I want you to give me a brief on how I can go about
    > > > making users post status update for their friends to see. Just like
    > > > how its been done on twitter. Where you tweet whats happening and
    > > > after tweeting its will display your status with reply, retweet and
    > > > favourite button below. Hope you get my point?
    > > >
    > > > --
    > > > You received this message because you are subscribed to the Google
    > Groups "Django users" group.
    > > > To post to this group, send email to django-users@googlegroups.com.
    > > > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com.
    > > > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    > > >
    >
    > --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To post to this group, send email to django-users@googlegroups.com.
    > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com.
    > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    >
    >
    
    
    -- 
    Regards,
    
    Leandro Ostera,
    *BLOG - Check what I'm doing now 
    EMAIL - Write me an email 
    SHOWCASE - Check my latest projects *
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: Why can't erase this model object? "AssertionError: Question object can't be deleted because its id attribute is set to None."

    2012-01-27 Thread Leandro Ostera Villalva
    AFAIK when you try to access it ( quests[579] ) it gets loaded so
    performing .delete is possible.
    
    My guess is that you are none-ifying the id somehow either by operating
    with it or by improper redefinition of the id field in your model.
    
    El 21 de enero de 2012 18:49, JohnA  escribió:
    
    > Is your code really that simple - I mean get the queryset and
    > immediately try to delete something out of it?  If so, maybe it's time
    > to step through the delete in the debugger.  Querysets are lazy but I
    > assume that referencing an item in the queryset kike you do will cause
    > the actual data to get feteched.  Maybe the problem is trying to
    > delete something directly out of the queryset, or maybe you're somehow
    > deleting the same record twice, or maybe django is somehow getting
    > confused while performing the operation.
    >
    > -- John
    >
    > On Jan 21, 6:39 pm, Chris Seberino  wrote:
    > > On Jan 21, 2:43 pm, JohnA  wrote:
    > >
    > > > How are you finding these objects?  That might point to the answer.
    > >
    > > > Probably the likeliest explanation is that you are creating the
    > > > objects but not saving them.
    > >
    > > In the Django shell I do
    > >
    > > quests = Question.objects.all()
    > > quests[579].delete()
    > >
    > > Why does the objects.all() invocation add this id=None crud to quests
    > > list?
    > >
    > > cs
    >
    > --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To post to this group, send email to django-users@googlegroups.com.
    > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com.
    > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    >
    >
    
    
    -- 
    Regards,
    
    Leandro Ostera,
    *BLOG - Check what I'm doing now 
    EMAIL - Write me an email 
    SHOWCASE - Check my latest projects *
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: Can't make 404.html template to be used. Keep getting Apache 500 Internal Server Error instead.

    2012-01-27 Thread Aaron Cannon
    Hi.
    
    Have you created a 500.html file in your templates directory?
    
    Aaron
    
    On 1/21/12, Chris Seberino  wrote:
    >
    >> Check your apache logs.
    >
    > Last line below says error is that there is no handler500.  I thought
    > a missing web page for some URL was a 404 error so I'm not sure why
    > this error is popping up.
    >
    > cs
    >
    >
    > [Sat Jan 21 13:24:44 2012] [error] [client 75.108.243.48] mod_wsgi
    > (pid=19346): Exception occurred processing WSGI script '/etc/apache2/
    > wsgi/phil4.com.wsgi'.
    > [Sat Jan 21 13:24:44 2012] [error] [client 75.108.243.48] Traceback
    > (most recent call last):
    > [Sat Jan 21 13:24:44 2012] [error] [client 75.108.243.48]   File "/usr/
    > lib/pymodules/python2.6/django/core/handlers/wsgi.py", line 241, in
    > __call__
    > [Sat Jan 21 13:24:44 2012] [error] [client 75.108.243.48] response
    > = self.get_response(request)
    > [Sat Jan 21 13:24:44 2012] [error] [client 75.108.243.48]   File "/usr/
    > lib/pymodules/python2.6/django/core/handlers/base.py", line 130, in
    > get_response
    > [Sat Jan 21 13:24:44 2012] [error] [client 75.108.243.48] return
    > self.handle_uncaught_exception(request, resolver, sys.exc_info())
    > [Sat Jan 21 13:24:44 2012] [error] [client 75.108.243.48]   File "/usr/
    > lib/pymodules/python2.6/django/core/handlers/base.py", line 179, in
    > handle_uncaught_exception
    > [Sat Jan 21 13:24:44 2012] [error] [client 75.108.243.48]
    > callback, param_dict = resolver.resolve500()
    > [Sat Jan 21 13:24:44 2012] [error] [client 75.108.243.48]   File "/usr/
    > lib/pymodules/python2.6/django/core/urlresolvers.py", line 263, in
    > resolve500
    > [Sat Jan 21 13:24:44 2012] [error] [client 75.108.243.48] return
    > self._resolve_special('500')
    > [Sat Jan 21 13:24:44 2012] [error] [client 75.108.243.48]   File "/usr/
    > lib/pymodules/python2.6/django/core/urlresolvers.py", line 253, in
    > _resolve_special
    > [Sat Jan 21 13:24:44 2012] [error] [client 75.108.243.48] callback
    > = getattr(self.urlconf_module, 'handler%s' % view_type)
    > [Sat Jan 21 13:24:44 2012] [error] [client 75.108.243.48]
    > AttributeError: 'module' object has no attribute 'handler500'
    >
    > --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To post to this group, send email to django-users@googlegroups.com.
    > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com.
    > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    >
    >
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: Why can't erase this model object? "AssertionError: Question object can't be deleted because its id attribute is set to None."

    2012-01-27 Thread Leandro Ostera Villalva
    Doesn't the Create method or the YourModel() constructor initialize the pk ?
    
    El 21 de enero de 2012 12:43, JohnA  escribió:
    
    > How are you finding these objects?  That might point to the answer.
    >
    > Probably the likeliest explanation is that you are creating the
    > objects but not saving them.
    >
    > On Jan 21, 12:31 pm, Chris Seberino  wrote:
    > > On Jan 21, 6:44 am, Tom Evans  wrote:
    > >
    > > > Models are representations of rows in a database.
    > > > Deleting a model instance implies removing a row from a database.
    > > > Model instances have an id attribute which denotes their row in the
    > database.
    > > > Models whose id is None don't exist in the database, and so it is
    > > > nonsense to delete them - they don't exist.
    > >
    > > That makes perfect sense but then why do these zombie id=None objects
    > > show up?
    > > *WHERE* are they living if not in the database?  Does the Django shell
    > > somehow have a secondary storage area for this zombie id=None object
    > > stuff I can delete somehow?
    >
    > --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To post to this group, send email to django-users@googlegroups.com.
    > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com.
    > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    >
    >
    
    
    -- 
    Regards,
    
    Leandro Ostera,
    *BLOG - Check what I'm doing now 
    EMAIL - Write me an email 
    SHOWCASE - Check my latest projects *
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    multiple modelforms in a single view not saving

    2012-01-27 Thread Chris Wolfe
    Hi - I am working on create form to save a lease made up the following
    model, view and form.
    
    Whenever I try to save a lease using the lease form, an integrityerror
    pops up saying that the lease.id field is null. Does anyone have an
    idea why this might be happening?
    
    #Views.py
    def register_new_tenant(request, template_name ='tenant/
    register_tenant.html'):
    """
    This view takes the three incomplete modelforms Lease, Tenant, and
    Rental
    period and creates a new lease made up of lease details, its rent
    periods
    (hopefully plural); and finds and assigns the asset that the
    lessee will
    occupy.
    """
    lform = Add_lease_form(request.POST or None)
    tform = Add_tenant_form(request.POST or None)
    rform = Rents_formset(request.POST or None)
    
    forms = {'tform' : tform, 'rform' : rform, 'lform' : lform }
    
    if lform.is_valid():
    Lease = lform.save(commit = False)
    rform = Rents_formset(request.POST or None, instance = Lease)
    if rform.is_valid():
    Lease.save()
    Rents_formset.save()
    # Now - how to save the tenant??!?
    if tform.is_valid():
    Tenant = tform.save(commit = False)
    Tenant.lease = Lease
    Tenant.save()
    return redirect('tenants')
    
    return render(request, template_name, forms)
    
    # Model - minus methods & extraneous fields/
    
    class Asset(models.Model):
    address = models.CharField(max_length=50)
    
    class Tenant(models.Model):
    lease = models.ForeignKey('Lease')
    
    class Rental_period(models.Model):
    lease = models.ForeignKey('Lease')
    
    class Lease(models.Model):
    asset = models.ForeignKey(Asset)
    
    
    #forms.py (with proper imports)
    
    class Add_center_form(ModelForm):
    class Meta:
    model = Center
    
    class Add_asset_form(ModelForm):
    class Meta:
    model = Asset
    
    class Add_tenant_form(ModelForm):
    class Meta:
    model = Tenant
    exclude = ['lease',]
    
    class Add_rental_period_form(ModelForm):
    class Meta:
    model = Rental_period
    
    Rents_formset = inlineformset_factory(Lease,
    Rental_period,
    can_delete = False,
    extra = MAX_RENT_PERIODS)
    
    class Add_lease_form(ModelForm):
    class Meta:
    model = Lease
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: Why can't erase this model object? "AssertionError: Question object can't be deleted because its id attribute is set to None."

    2012-01-27 Thread Leandro Ostera Villalva
    No that I know. Can you show us some more code like how you defined the
    model and how do you come to this id=None issue?
    
    El 21 de enero de 2012 09:31, Chris Seberino  escribió:
    
    >
    > On Jan 21, 6:44 am, Tom Evans  wrote:
    > > Models are representations of rows in a database.
    > > Deleting a model instance implies removing a row from a database.
    > > Model instances have an id attribute which denotes their row in the
    > database.
    > > Models whose id is None don't exist in the database, and so it is
    > > nonsense to delete them - they don't exist.
    >
    > That makes perfect sense but then why do these zombie id=None objects
    > show up?
    > *WHERE* are they living if not in the database?  Does the Django shell
    > somehow have a secondary storage area for this zombie id=None object
    > stuff I can delete somehow?
    >
    > --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To post to this group, send email to django-users@googlegroups.com.
    > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com.
    > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    >
    >
    
    
    -- 
    Regards,
    
    Leandro Ostera,
    *BLOG - Check what I'm doing now 
    EMAIL - Write me an email 
    SHOWCASE - Check my latest projects *
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: Can't make 404.html template to be used. Keep getting Apache 500 Internal Server Error instead.

    2012-01-27 Thread Aaron Cannon
    Any hints in the Apache error logs?
    
    Aaron
    
    On 1/21/12, Chris Seberino  wrote:
    > I am proxying my Django app behind Apache.  I created a 404.html in my
    > template directory but when I try to test it I get the following error
    > that appears to come from Apache...
    >
    > Internal Server Error
    >
    > The server encountered an internal error or misconfiguration and was
    > unable to complete your request.
    >
    > Please contact the server administrator, [no address given] and inform
    > them of the time the error occurred, and anything you might have done
    > that may have caused the error.
    >
    > More information about this error may be available in the server error
    > log.
    > Apache/2.2.16 (Ubuntu) Server at phil4.com Port 80
    >
    > Here is the relevant Apache settings...
    >
    > NameVirtualHost  72.14.188.15:80
    > NameVirtualHost  72.14.188.15:443
    > WSGIRestrictEmbedded On
    >
    > 
    > #
    > =
    > ServerName  phil4.com
    > ServerAlias www.phil4.com
    > DocumentRoot/var/www
    > Options Indexes FollowSymLinks
    > #
    > =
    > WSGIProcessGroupphil4.com
    > WSGIScriptAlias / /etc/apache2/wsgi/phil4.com.wsgi
    > WSGIDaemonProcess   phil4.com user=seb group=seb threads=25
    > #
    > =
    > 
    > Order Allow,Deny
    > Allow from All
    > 
    > #
    > =
    > Alias /favicon.ico /var/www/static/images/favicon.ico
    > Alias /base.css/var/www/static/base.css
    > Alias /static  /var/www/static
    > Alias /public  /var/www/static/public
    > Alias /misc/var/www/static/misc
    > Alias /images  /var/www/static/images
    > Alias /books/  /var/www/static/books/
    > Alias /homework/   /var/www/static/homework/
    > Alias /exams/  /var/www/static/exams/
    > #
    > =
    > Redirect /sign_in  https://phil4.com/sign_in
    > Redirect /register https://phil4.com/register
    > #
    > =
    > 
    >
    > --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To post to this group, send email to django-users@googlegroups.com.
    > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com.
    > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    >
    >
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: what is the best IDE to use for Python / Django

    2012-01-27 Thread Leandro Ostera Villalva
    I actually use a text editor (Sublime Text 2, simply stunning) and a lot of
    shell. For projects I have my own git server and hudson-ci which I use
    locally and can sync with the one we use at work easily, and with little
    effort those can be integrated into the editor, too, which is wonderfully
    made in Python under an extensible arch.
    
    El 21 de enero de 2012 06:10, goosfancito  escribió:
    
    > El 21/01/12 08:52, kenneth gonsalves escribió:
    >
    >  On Sat, 2012-01-21 at 03:34 -0800, John Yeukhon Wong wrote:
    >>
    >>> While it has been asked a trillion times already, let me say TRY UT
    >>> YOURSELF.
    >>>
    >> you were requested not to feed this thread. If the OP cannot search,
    >> here it is:
    >>
    >> http://duckduckgo.com/?q=site%**3Agroups.google.com%2Fgroup%**
    >> 2Fdjango-users
    >> +python+IDE
    >>
    > i used gedit only.
    >
    >
    > --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To post to this group, send email to django-users@googlegroups.com.
    > To unsubscribe from this group, send email to django-users+unsubscribe@**
    > googlegroups.com .
    > For more options, visit this group at http://groups.google.com/**
    > group/django-users?hl=en
    > .
    >
    >
    
    
    -- 
    Regards,
    
    Leandro Ostera,
    *BLOG - Check what I'm doing now 
    EMAIL - Write me an email 
    SHOWCASE - Check my latest projects *
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: How to use a DB table for choices=tuples in ChoiceField?

    2012-01-27 Thread Leandro Ostera Villalva
    Here's a nicer way to do it.
    
    CHOICES = list ( (obj.code,obj.name) for obj in Scac.objects.all() )
    
    Or you can always make a static method for it and call
    Scac.objects_as_list()
    
    El 21 de enero de 2012 05:01, Bill Beal  escribió:
    
    > It looks like the Pythonic way is to create the list in
    > models.py and invoke it from forms.py.
    >
    > Sorry about the heterogeneous names--some of
    > them match the document the requirements were
    > extracted from and others are more meaningful
    > to me.  The former were picked because we'll
    > need a requirements cross-reference and they'll
    > be easier to match up with the requirements.
    > And the dashes in place of spaces--most of the
    > code examples I see here are almost unreadable
    > because of leading spaces disappearing.
    > I saw one example of replacing all but the last
    > leading space with '-', and it was more readable.
    >
    > Regards
    >
    > On Fri, Jan 20, 2012 at 11:22 PM, Dennis Lee Bieber  > wrote:
    >
    >> On Fri, 20 Jan 2012 19:44:16 -0800 (PST), Bill Beal
    >>  wrote:
    >>
    >>Caveat: I've only looked at Django, but not in enough detail to be
    >> "expert"; my comments are based upon basic Python syntax/semantics (my
    >> apologies to the developers, but I work better with printed
    >> documentation and Django is too much of a moving target for the few
    >> books that did come out to be relevant four months later)
    >>
    >> >name 'scac_choicelist' is not defined at the marked
    >> >line in my form:
    >> >
    >> Which is true -- it is not defined at that point. (NOTE: your
    >> names
    >> don't really help understanding the purpose of the variables )
    >>
    >> >from django import forms
    >> >from django.forms.fields import ChoiceField
    >> >from myapp.models import *
    >> >
    >> >BOL_CODE_QUALIFIERS = (
    >> >  ('OB', 'Ocean Bill of Lading (OB)'),
    >> >  ('BM', 'House Bill of Lading (BM)'),
    >> >)
    >> >
    >> >class BolForm(forms.Form):
    >> >- scac = forms.ChoiceField(
    >> >- label=u'Ocean Carrier',
    >> >- choices=scac_choicelist()) ##
    >> >- bill_of_lading = forms.CharField(
    >> >- label=u'Bill of Lading #', max_length=50)
    >> >- bol_type = forms.ChoiceField(
    >> >- label=u'Type of B/L',
    >> >- choices=BOL_CODE_QUALIFIERS)
    >> >
    >> >Here's my model:
    >> >
    >> >from django.db import models
    >> >
    >> >class Scac(models.Model):
    >> >- code = models.CharField(max_length=4)
    >> >- name = models.CharField(max_length=60)
    >> >
    >> >- def __unicode__(self):
    >> >--- return self.code
    >> >
    >> >- def scac_choicelist():
    >> >--- q = Scac.objects.all()
    >> >--- scaclist = []
    >> >--- for x in q:
    >> >- scaclist.append((x.code, x.name))
    >> >- return scaclist
    >>
    >> Presuming the many "-"s represent indentation, "scac_choicelist"
    >> is
    >> a method of Scac. That means it should have at least one parameter: self
    >>
    >>def scac_choicelist(self):
    >>scaclist = []
    >>for item in self.objects.all():
    >>scaclist.append((item.code, item.name))
    >>return scaclist
    >>
    >> NOTE: based on your "-"s, your return statement is inside your loop, so
    >> you'd be returning after processing only one element.
    >>
    >>NOW... In the form module you need to reference an instance of the
    >> model! The method itself is not visible.
    >>
    >> >- scac = forms.ChoiceField(
    >> >- label=u'Ocean Carrier',
    >> >- choices=scac_choicelist()) ##
    >> >
    >>
    >> Something like:
    >>
    >>scac = forms.ChoiceField(   label=u"Ocean Carrier",
    >>
    >>  choices=Scac().scac_choicelist())
    >>
    >> --
    >>Wulfraed Dennis Lee Bieber AF6VN
    >>wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.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-users@googlegroups.com.
    >> To unsubscribe from this group, send email to
    >> django-users+unsubscr...@googlegroups.com.
    >> For more options, visit this group at
    >> http://groups.google.com/group/django-users?hl=en.
    >>
    >>
    >  --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To post to this group, send email to django-users@googlegroups.com.
    > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com.
    > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    >
    
    
    
    -- 
    Regards,
    
    Leandro Ostera,
    *BLOG - Check what I'm doing now 
    EMAIL - Write me an email 
    SHOWCASE - Check my latest projects *
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: Handling copy on a small project

    2012-01-27 Thread Leandro Ostera Villalva
    I'd vote for putting it in the db too. Flatpages are good to go.
    
    El viernes 20 de enero de 2012, Daniel Roseman escribió:
    
    > On Friday, 20 January 2012 04:39:44 UTC, Jeremy Boyd wrote:
    >>
    >> Hi all,
    >>
    >> For my side project, we have the need to rapidly iterate on the app's
    >> copy. As I see it, we have two options: make copy db-driven, or hardcode it
    >> into the templates. I'm leaning toward putting text in the db for now to
    >> avoid having to teach our product guy the intricacies of commits and
    >> deployment, but I'm curious a) whether I'm shooting myself in the foot, and
    >> b) whether there are any go-to apps for this sort of thing.
    >>
    >> I'm able to give more background as necessary, but just curious whether
    >> this question has an immediate answer.
    >>
    >> P.S.: Sorry if this has been asked before, but searching for "copy" and
    >> "text" seems a bit futile after a few pages of results.
    >>
    >
    > I'd vote for putting it in the db - you can use the built-in flatpages
    > app, and even throw on a rich-text editor like TinyMCE if you need to.
    > --
    > DR.
    >
    >
    >
    > --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To view this discussion on the web visit
    > https://groups.google.com/d/msg/django-users/-/GM8B0S1NSaIJ.
    > To post to this group, send email to 
    > django-users@googlegroups.com 'django-users@googlegroups.com');>
    > .
    > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com  'django-users%2bunsubscr...@googlegroups.com');>.
    > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    >
    
    
    -- 
    Regards,
    
    Leandro Ostera,
    *BLOG - Check what I'm doing now 
    EMAIL - Write me an email 
    SHOWCASE - Check my latest projects *
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: Why can't erase this model object? "AssertionError: Question object can't be deleted because its id attribute is set to None."

    2012-01-27 Thread Leandro Ostera Villalva
    When you have an instance of an object and it has no id (that means, id is
    set to None) then it actually does not represent any object in your
    database, ergo, you can't delete it because it's not there.
    
    Can you show us the portion of code where you are trying to delete it?
    
    El 20 de enero de 2012 19:49, Chris Seberino  escribió:
    
    > I get the following error when attempting to delete an object of my
    > model...
    >
    > "AssertionError: Question object can't be deleted because its id
    > attribute is set to None."
    >
    > The class definition is thus...
    >
    > class Question(django.db.models.Model):
    >"""
    >Represents a database table.
    >"""
    >
    >subject = django.db.models.CharField(max_length = 1000)
    >section = django.db.models.CharField(max_length = 1000)
    >text= django.db.models.CharField(max_length = 1000)
    >answer  = django.db.models.CharField(max_length = 1000)
    >answer_type = django.db.models.CharField(max_length = 1000)
    >
    > --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To post to this group, send email to django-users@googlegroups.com.
    > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com.
    > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    >
    >
    
    
    -- 
    Regards,
    
    Leandro Ostera,
    *BLOG - Check what I'm doing now 
    EMAIL - Write me an email 
    SHOWCASE - Check my latest projects *
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: How to use a DB table for choices=tuples in ChoiceField?

    2012-01-27 Thread Leandro Ostera Villalva
    I'm new to this list but a nice way to share code snippets is thru services
    like gist.
    
    Here's how the first source code would have looked:
    https://gist.github.com/1651488
    
    Ontopic: I believe that a method called 'as_list' would be more
    descriptive. Perhaps the manager included in models.Model has something
    like that.
    
    If I recall correctly you could use this: as_list = list(
    Scac.objects.all() )
    
    El 20 de enero de 2012 20:48, Bill Beal  escribió:
    
    > Thank you, Dennis.  I'll study your answer.  I have to do this kind of
    > thing for a lot of different tables.  And I discovered another thing:  In
    > the template I was reading the table in again from the database!  Before my
    > problem was solved, I could populate the selection list from the DB table,
    > but then there were no valid choices when I got back to the view.
    >
    > I'm getting to know Django just enough that I can sometimes answer
    > questions posted here, or at least make suggestions.
    >
    > Regards
    >
    >
    > On Fri, Jan 20, 2012 at 11:22 PM, Dennis Lee Bieber  > wrote:
    >
    >> On Fri, 20 Jan 2012 19:44:16 -0800 (PST), Bill Beal
    >>  wrote:
    >>
    >>Caveat: I've only looked at Django, but not in enough detail to be
    >> "expert"; my comments are based upon basic Python syntax/semantics (my
    >> apologies to the developers, but I work better with printed
    >> documentation and Django is too much of a moving target for the few
    >> books that did come out to be relevant four months later)
    >>
    >> >name 'scac_choicelist' is not defined at the marked
    >> >line in my form:
    >> >
    >> Which is true -- it is not defined at that point. (NOTE: your
    >> names
    >> don't really help understanding the purpose of the variables )
    >>
    >> >from django import forms
    >> >from django.forms.fields import ChoiceField
    >> >from myapp.models import *
    >> >
    >> >BOL_CODE_QUALIFIERS = (
    >> >  ('OB', 'Ocean Bill of Lading (OB)'),
    >> >  ('BM', 'House Bill of Lading (BM)'),
    >> >)
    >> >
    >> >class BolForm(forms.Form):
    >> >- scac = forms.ChoiceField(
    >> >- label=u'Ocean Carrier',
    >> >- choices=scac_choicelist()) ##
    >> >- bill_of_lading = forms.CharField(
    >> >- label=u'Bill of Lading #', max_length=50)
    >> >- bol_type = forms.ChoiceField(
    >> >- label=u'Type of B/L',
    >> >- choices=BOL_CODE_QUALIFIERS)
    >> >
    >> >Here's my model:
    >> >
    >> >from django.db import models
    >> >
    >> >class Scac(models.Model):
    >> >- code = models.CharField(max_length=4)
    >> >- name = models.CharField(max_length=60)
    >> >
    >> >- def __unicode__(self):
    >> >--- return self.code
    >> >
    >> >- def scac_choicelist():
    >> >--- q = Scac.objects.all()
    >> >--- scaclist = []
    >> >--- for x in q:
    >> >- scaclist.append((x.code, x.name))
    >> >- return scaclist
    >>
    >> Presuming the many "-"s represent indentation, "scac_choicelist"
    >> is
    >> a method of Scac. That means it should have at least one parameter: self
    >>
    >>def scac_choicelist(self):
    >>scaclist = []
    >>for item in self.objects.all():
    >>scaclist.append((item.code, item.name))
    >>return scaclist
    >>
    >> NOTE: based on your "-"s, your return statement is inside your loop, so
    >> you'd be returning after processing only one element.
    >>
    >>NOW... In the form module you need to reference an instance of the
    >> model! The method itself is not visible.
    >>
    >> >- scac = forms.ChoiceField(
    >> >- label=u'Ocean Carrier',
    >> >- choices=scac_choicelist()) ##
    >> >
    >>
    >> Something like:
    >>
    >>scac = forms.ChoiceField(   label=u"Ocean Carrier",
    >>
    >>  choices=Scac().scac_choicelist())
    >>
    >> --
    >>Wulfraed Dennis Lee Bieber AF6VN
    >>wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.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-users@googlegroups.com.
    >> To unsubscribe from this group, send email to
    >> django-users+unsubscr...@googlegroups.com.
    >> For more options, visit this group at
    >> http://groups.google.com/group/django-users?hl=en.
    >>
    >>
    >  --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To post to this group, send email to django-users@googlegroups.com.
    > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com.
    > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    >
    
    
    
    -- 
    Regards,
    
    Leandro Ostera,
    *BLOG - Check what I'm doing now 
    EMAIL - Write me an email 
    SHOWCASE - Check my latest projects *
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-u

    Re: Model-driven Django development

    2012-01-27 Thread Leandro Ostera Villalva
    Here with django you define models in Python code and the framework
    autogenerates layers for you to interact with the db. With utilities such
    as syncb from manage.py or sqlall you can let the framework create a db or
    just show you the sql behind those models you defined.
    
    It's really handy.
    
    El 20 de enero de 2012 19:50, Alec Taylor  escribió:
    
    > At University I've learned various techniques for model-driven
    > developments, such as:
    > - Class diagrams (generate code)
    > - ERD Diagrams (generate db code [e.g. SQL])
    >
    > Can any of these sorts of—or for that matter, any sort of—model-driven
    > development techniques be used for Django?
    >
    > --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To post to this group, send email to django-users@googlegroups.com.
    > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com.
    > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    >
    >
    
    
    -- 
    Regards,
    
    Leandro Ostera,
    *BLOG - Check what I'm doing now 
    EMAIL - Write me an email 
    SHOWCASE - Check my latest projects *
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    django get value from oracle function

    2012-01-27 Thread citos88
    I use Django and Oracle, and I want call oracle's function and catch
    and save to django's variable this what return that function. How can
    I do this?
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Hello there, and sort of a question

    2012-01-27 Thread Leandro Ostera Villalva
    Hello guys, I'm new to Django and looking for the best way to setup a site
    as soon as possible. I already went over the basics and did a pair of
    websites, a blog using some django.contrib stuff incluiding an xml-rpc
    interface for the metaweblog api and some other apps that I needed (like a
    random dungeons&dragons 4.0 npc creator).
    
    Currently I'm trying to setup websites as fast as I can. I've downloaded
    and installed django-cms, pinax, zinnia, mezzanine and more and I'm about
    to testdrive all of them. The thing is that time isn't free and I'm a bit
    short of it. Can anyone share some tips or experience on this?
    
    Thanks for everything in advice.
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Working with Geodjango fields in a form

    2012-01-27 Thread Jair Trejo
    Hello! I hope someone can help me.
    
    I've got a model with a required location field (a Geodjango Point)
    and some other information.
    
    I created a model form from it and use a simple textbox widget for the
    location field, so the user writes coordinates of the form:
    
    19.2, -97.1
    
    ¿How can I make this work with form validation? When I try to call:
    
    form = PlaceForm(request.POST)
    form.save()
    
    The form doesn't validate (obviously). What should I do to the
    "19.2, -97.1" string to make it validate properly? I tried
    manipulating it to look like "POINT(19.2 -97.1)" to no avail.
    
    It also ocurred to me to make the field not required, calling
    form.save(commit=False), manipulating the location field of the
    resulting object and then saving it, but I would really like to keep
    the field marked as required in the database.
    
    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-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: list_filter not showing up in admin

    2012-01-27 Thread Edvinas J
    https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter
    
    
    On Fri, Jan 13, 2012 at 8:28 AM, The Ape
    wrote:
    
    > Hi everyone,
    >
    > I am quite new to delevoping with django and I am trying to setup a
    > simple blog app.
    > I wanted to use a "list_filter" in the admin but it is somehow not
    > showing up at all...
    > I am using django 1.3 and python 2.7.1. (The models are listed
    > below...)
    >
    > Does anyone have a suggestion how to make it work?
    >
    > Thank you for help in advance!
    >
    >
    > The model:
    >
    > class Post(models.Model):
    >author = models.ForeignKey(User, related_name='posts')
    >title = models.CharField(max_length=255)
    >body = models.TextField()
    >pub_date = models.DateTimeField(auto_now_add=True)
    >edit_date = models.DateTimeField(auto_now=True)
    >is_public = models.BooleanField('public', default=False)
    >
    >class Meta:
    >order_with_respect_to = 'author'
    >get_latest_by = 'pub_date'
    >ordering = ['-pub_date']
    >
    >def __unicode__(self):
    >return self.title
    >
    >
    > The admin model:
    >
    > class PostAdmin(admin.ModelAdmin):
    >readonly_fields = ['pub_date', 'edit_date']
    >fieldsets = [
    > (None, {'fields': ['author', 'title',
    > 'body', 'is_public']}),
    > ('Date information',   {'fields': ['pub_date',
    > 'edit_date']})
    >]
    >list_display = ['title', 'author', 'pub_date']
    >list_filer = ['is_public']
    >ordering = ['-pub_date']
    >search_fields = ['title']
    >
    > --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To post to this group, send email to django-users@googlegroups.com.
    > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com.
    > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    >
    >
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    about QuerySet

    2012-01-27 Thread newme
    user = User.objects.filter(pk="")
    user is a QuerySet
    
    every time i call user[0], i returns a different reference.
    
    maybe it should be a python question.
    i want to know i QuerySet does that.
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: Retrieve repository information from the github using github API

    2012-01-27 Thread anoop mohan
    Hi friends,
    
    I need to Create a web app in  Django.
    
    This web app should take a list of github usernames and show the recent
    commits as well projects owned by this github user.
    The list of users should be stored in the DB and I should be able to update
    this from the Admin.
    Use the github API.
    
    Currently I have no idea about how to implement this application.
    
    Anybody can help me??
    
    Anoop
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    help-i'm a newbie

    2012-01-27 Thread Mahjabeen Akter
    Hi all, I want to start learning django, but the tutorial seems so
    difficult for me! :(
    " django-admin.py startproject mysite "  this line of code is not
    working. Could you please tell me what's wrong with it? or what should
    I do to set up a new project?
    Thank you.
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    ModelForm

    2012-01-27 Thread hack
    Hello,
    I am new to Python and have a Java background.
    
    I have created a bunch of models, and forms using ModelForm:
    class FormName(ModelForm):
    class Meta:
    model = FormName
    
    Whenever I display the form in my browser with {{ form.as_table }} the
    form queries all the foreign key data and displays it in a pulldown.
    
    Is there a way to disable this functionality and still be able to use
    Models for my forms?  Thanks.
    
    I expect there is a param or something similar to blank=False or
    something.
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    help with tutorial 01

    2012-01-27 Thread Cyd
    In the tutorial here:
    
     https://docs.djangoproject.com/en/1.3/intro/tutorial01/
    
    I get no errors up until the p.save() at the end:
    
     # No polls are in the system yet.
     >>> Poll.objects.all()
     []
    
     # Create a new Poll.
     >>> import datetime
     >>> p = Poll(question="What's up?",
    pub_date=datetime.datetime.now())
    
     # Save the object into the database. You have to call save()
    explicitly.
     >>> p.save()
    
    Right here, I get this error:
    
     RuntimeWarning: DateTimeField received a naive datetime
    (2012-01-19 15:52:43.171000) while time zone support is active.
    
    > What does it mean by naive datetime?
    
    > Thanks for the help,
    > Cyd
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Retrieve repository information from the github using github API

    2012-01-27 Thread anoop mohan
    I need to Create a web app Django.
    This web app should take a list of github usernames and show the recent
    commits as well projects owned by this github user.
    The list of users should be stored in the DB and I should be able to update
    this from the Admin.
    Use the github API.
    Currently I have no idea about how to implement this application.
    Anybody can help me??
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: ImageField filename

    2012-01-27 Thread Damian Soriano (Gmail)
    You can define a function that returns the path to upload the image, in
    this function you receive as argument the object being saved (instance) and
    the name of the file (filename). You can return whatever you want as a path
    (that include the filename)
    
    def upload_path(instance, filename):
    return 'category/' + str(instance.name) + '/image/' + filename
    
    class Category(models.Model):
    name = models.CharField(_('name'), max_length=200, unique=True)
    image = models.ImageField(_('image'), upload_to=upload_path, blank=True)
    
    BR
    
    Damián
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Django vs. Ruby on Rails

    2012-01-27 Thread Brian D
    I'm wondering about diving into Ruby on Rails to qualify for a
    position, or spending my time instead going deeper into a full bells
    and whistles prototype Django site and betting on jobs opening up in
    my field. This is really a GIS career professional question.
    
    Has anyone here crossed the fence over to Ruby on Rails? What do you
    think when:
    
    1) Comparing the framework to Django;
    
    2) The communities -- friendliness, support, etc.;
    
    3) Using one or the other for Geographic Information Systems work;
    
    4) (I was going to leave this out but) Comparing Ruby to Python as
    languages.
    
    I think I've generally answered the last question from my own
    experience, great integration with spatial libraries, and from other's
    recommendations vis-a-vis Ruby on Rails.
    
    Answer any or all, if you like.
    
    What concerns me about Django is that, outside of forums like this,
    the chatter seems to have died down in the last couple of years from a
    peak in 2008/2009.
    
    I did search the group and haven't seen any recent discussions on this
    comparison.
    
    Any comment really very much appreciated.
    
    Kind regards,
    Brian
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: ImageField filename

    2012-01-27 Thread wayne
    
    This is the same as the FileField. The UploadedFile class has a name
    property, which can be used..
    
    https://docs.djangoproject.com/en/dev/topics/http/file-uploads/#handling-uploaded-files
    
    
    
    On Jan 19, 9:56 am, Mike Dewhirst  wrote:
    > How do I get the actual filename of the uploaded image?
    >
    > The docs mention ...
    >
    > FileField.upload_to
    > A local filesystem path that will be appended to your MEDIA_ROOT setting
    > to determine the value of the url attribute.
    >
    > ... and presumably the widget which uploads the image knows the filename
    > to tack onto the end of upload_to when the webserver gets the request to
    > store the image.
    >
    > But how can I get access to that filename in the model so I can parse it
    > and give it a meaningful (to humans) name when being saved?
    >
    > The docs go on to mention upload_to as a callable but I'm sticking to a
    > fixed directory in MEDIA_ROOT for these images.
    >
    > Thanks for any hints
    >
    > Mike
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Retrieving repository details github using github API

    2012-01-27 Thread anoop mohan
    I need to create a web app in Djangok. 
    This web app should take a list of github usernames and show the recent 
    commits as well projects owned by this github user.
    The list of users should be stored in the DB and I should be able to update 
    this from the Admin.
    Use the github API.
    
    Currently I have no idea about how to done it. Anybody can help me??
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To view this discussion on the web visit 
    https://groups.google.com/d/msg/django-users/-/wdQrco3MAiIJ.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    What am I doing wrong with this URL Pattern

    2012-01-27 Thread Django Newbie
    Hi,
    
    I am trying to figure out a way to call a function depending on the
    parameter in the URL.
    
    Example.
    url(r'^People/Info/(?P\d+)/$', 'iFriends.People.views.details'),
    url(r'^People/Info/(?P[a-z]{3})/$',
    'iFriends.People.views.detail_name'),
    
    It works with numeric value.  if I use "http://localhost:8000/
    People/Info/1/"
    
    but not with  if I use http://localhost:8000/People/Info/Jan/
    
    probably something small but still leaning.
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: tutorial 2 admin site problem

    2012-01-27 Thread Alexandru Moldovan
    Did you declared a super user when you've created the database for the
    first time from you app?
    
    On Wed, Jan 18, 2012 at 12:39 PM, Denis Darii  wrote:
    
    > You can replace:
    >
    > url(r'^admin/', include(admin.site.urls)),
    >>
    > with:
    >
    > url(r'^/', include(admin.site.urls)),
    >>
    > in your *urls.py* if you really want to have the admin at /. But are you
    > aware of what this implies?
    >
    >
    > On Wed, Jan 18, 2012 at 12:31 PM, Krondaj  wrote:
    >
    >> Hi,
    >>
    >> I have just started tutorial part 2 and in part 2.4.1.
    >>
    >> I have added django.contrib.admin to the INTALLED_APPS part of
    >> mysettings.py
    >> I syncd the db
    >> I uncommented the requierd three lines from urls.py in mysite folder
    >>
    >> I ran the runserver, and go to 127.0.0.1:8000, using chromium
    >>
    >> This is what I see
    >>
    >> Page not found (404)
    >> Request Method: GET
    >> Request URL:http://127.0.0.1:8000/
    >> Using the URLconf defined in mysite.urls, Django tried these URL
    >> patterns, in this order:
    >> ^admin/
    >> The current URL, , didn't match any of these.
    >> You're seeing this error because you have DEBUG = True in your Django
    >> settings file. Change that to False, and Django will display a
    >> standard 404 page.
    >>
    >> If I type the url  127.0.0.1:8000/admin/
    >> it goes to the login page.
    >>
    >> Why do I get this message, I shouldn't have to type the url in for
    >> admin manually, i should be able to to this from the homescreen??
    >>
    >> Any idea's??
    >>
    >> --
    >> You received this message because you are subscribed to the Google Groups
    >> "Django users" group.
    >> To post to this group, send email to django-users@googlegroups.com.
    >> To unsubscribe from this group, send email to
    >> django-users+unsubscr...@googlegroups.com.
    >> For more options, visit this group at
    >> http://groups.google.com/group/django-users?hl=en.
    >>
    >>
    >
    >
    > --
    > This e-mail and any file transmitted with it is intended only for the
    > person or entity to which is addressed and may contain information that is
    > privileged, confidential or otherwise protected from disclosure. Copying,
    > dissemination or use of this e-mail or the information herein by anyone
    > other than the intended recipient is prohibited. If you are not the
    > intended recipient, please notify the sender immediately by return e-mail,
    > delete this communication and destroy all copies.
    >
    >  --
    > You received this message because you are subscribed to the Google Groups
    > "Django users" group.
    > To post to this group, send email to django-users@googlegroups.com.
    > To unsubscribe from this group, send email to
    > django-users+unsubscr...@googlegroups.com.
    > For more options, visit this group at
    > http://groups.google.com/group/django-users?hl=en.
    >
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Should someone with no programming experience start learning Python, or Django (along with Python) first?

    2012-01-27 Thread Steve
    Just as the title says, I have basically no programming experience.  I
    want to program purely for the web.  I know a bit of HTML, CSS, and
    very minimal amounts of Java.  Can I start learning Django first and
    go from there?  Is that a bad idea?
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    User-specific sites

    2012-01-27 Thread Eryn Wells
    Hi all,
    
    This is my first post and it's a simple question... (I think)
    
    In my experience, it seems like Django allows users to log in to access and 
    modify the same content, like a blog with multiple authors or a CMS. I'm trying 
    to figure out how to do user-specific sites – something like a blog site where 
    every user has their own blog and they can log in to add, remove, and edit 
    their own posts (and no one else's). Each user has their own preferences and 
    the like as well. Is this something that Django's built-in user framework can 
    handle? Or could I maybe finagle the sites module into doing something like 
    this? Is it as simple as adding a ForeignKey to all my models that points to 
    the User that owns that particular db row (seems like the brute force way of 
    doing it...) or is there a more elegant way?
    
    Thanks for your help.
    
    Eryn
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: cannot set GeometryProxy with value of type

    2012-01-27 Thread Ryan H.
    Hi Antony,
    
    I don't know if you've already gotten your answer (hopefully), but if
    not, I can share my notes on what I did to solve the problem when I
    saw the same error:
    
    First, check the spatial data in your database.  There should be a
    column called "type" with an entry for each geometry.  I'm betting
    some (if not all) will read "MULTIPOLYGON".
    
    Next, check your model definition for "SpatialFeatures".  Make sure
    that you've set "geometry = MultiPolygonField(..." or at least that
    the field type here matches the geometry type of the features stored
    in your database.
    
    Hope this helps,
    ~Ryan
    
    On Dec 14 2011, 6:50 am, Antony  wrote:
    > Hi,
    >
    > I am simply trying the following,
    >
    > outerWallPolygon = SpatialFeatures.objects.all()
    > print "outerWallPolygon: ",outerWallPolygon[0].geometry
    >
    > and get this error.
    > cannot set  GeometryProxywith value of type:  'django.contrib.gis.geos.collections.MultiPolygon'>
    >
    > I believe I have everything set up correctly, the Geomanager, the GIS
    > libraries in my settings.py etc.
    > Let me know if you need me to provide any further info. I have seen
    > some coding around like 
    > here,http://spygit.durden.webfactional.com/django/bf7b51452973fcca489b5734...
    > but i am not sure if I am supposed to use this or not and how?
    >
    > Anyway, any help would be appreciated!
    >
    > 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-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Problems with Django Form Processing

    2012-01-27 Thread zhyr28
    Hi all, I want to develop a survey app that has ten radio selects.
    After people submit the survey, the data will be processing and then
    output the result. I met a problem when I was trying to process the
    data from the form. Here is the code:
    
    forms.py: contains the survey questions.
    QUESTION_ONE= (('4','Black',), ('3', 'Red',), ('2', 'Green',), ('1',
    'Purple',))
    lass SurveyForm(forms.Form):
    q1 = forms.ChoiceField(
    widget=forms.RadioSelect, # radio select
    label=u" 1. What's your prefered colour?",
    choices = QUESTION_ONE # four choices
    )
    
    views.py
      def take_survey(request):
    if request.method=='POST':
    form = SurveyForm(request.POST)
    if form.is_valid():
    p1 = form.cleaned_data['q1']# get the result of 
    input
       p = p1[0]#get
    the number
       if p>2:
      return HttpResponseRedirect('a.html')   # if
    user choose black or red, then redirect user to a.html
    
     i cannot get the correct result, but I do not know which step is
    wrong. Hope someone could help me. Thank you.
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Multi-conference, multi-user version of Symposion? (Meetup.com/EventBrite style)

    2012-01-27 Thread Paul Schlacter
    Would anyone be interested in working with me to develop a multi-conference
    multi-user version of Symposion?
    
    Basically I want to create an open-source meetup.com/eventbrite style site
    allowing users to create events (including paid ones).
    
    An RSVP list will need to be shown on the event, as well as other expected
    features such as email attendees and follow events made by a certain
    organizer or group.
    
    Would anyone be interested in working with me on this?
    
    Thanks for considering,
    
    Paul Schlacter
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    failing django install on dreamhost

    2012-01-27 Thread ebhakt
    I have tried to install django on dreamhost using many ways :
    
       1. I have tried the official django install script from dreamhost
       2. tried to follow instructions as per
       http://jeffcroft.com/blog/2006/may/11/django-dreamhost/
    
    But in all the cases it fails at the syncdb step
    
    I tried the steps mentioned in jeff's blog with an older version of django
    even (v1.2.1)
    
    but nothing seem to work !!
    
    Here is the message that i get doing django-admin.py syncdb
    
    
    
    Traceback (most recent call last):
      File "/usr/bin/django-admin.py", line 5, in 
    management.execute_from_command_line()
      File
    "/home/shell_user/django/django_src/django/core/management/__init__.py",
    line 429, in execute_from_command_line
    utility.execute()
      File
    "/home/shell_user/django/django_src/django/core/management/__init__.py",
    line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
      File
    "/home/shell_user/django/django_src/django/core/management/__init__.py",
    line 252, in fetch_command
    app_name = get_commands()[subcommand]
      File
    "/home/shell_user/django/django_src/django/core/management/__init__.py",
    line 101, in get_commands
    apps = settings.INSTALLED_APPS
      File "/home/shell_user/django/django_src/django/utils/functional.py",
    line 276, in __getattr__
    self._setup()
      File "/home/shell_user/django/django_src/django/conf/__init__.py", line
    40, in _setup
    self._wrapped = Settings(settings_module)
      File "/home/shell_user/django/django_src/django/conf/__init__.py", line
    73, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
      File "/home/shell_user/django/django_src/django/utils/importlib.py", line
    35, in import_module
    __import__(name)
      File "/home/shell_user/django/django_projects/WebBuilder/settings.py",
    line 16
    'NAME': 'oncloud_database',  # Or path to database
    file if using sqlite3.
     ^
    SyntaxError: invalid syntax
    
    
    
    Please comment !!
    
    Any help is always welcome
    
    Thanks
    
    
    -- 
    Bhaskar Tiwari
    Freelancer Developer and Active Directory Specialist
    Previously with Directory Services, Microsoft
    Cell Phone: Home Town : +91 9808437438 (preferred) , Delhi: +91 9971697075
    
     All we have to decide is what to do with the time that has been given to us
    
    Personal:
    ===
    http://ebhakt.info/
    ===
    
    Professional:
    ===
    http://www.ebhakt.com/
    http://fytclub.net/
    http://crackzhack.net/
    ===
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    how to embedd video

    2012-01-27 Thread jak.plopelor
    how do can I embed video in a django template?
    
    what I tried is this (using jwplayer):
    
    '''
      {% if error_message %}{{ error_message }}{%
    endif %}
    
      
    
      
    
    Loading the player ...
    
    jwplayer("container").setup({
    flashplayer: "/player.swf",
    file: "{{movie.location.url}}",
    height: 270,
    width: 480
      });
    
    '''
    the problem is that the browser ask for 'jwplayer/jwplayer.js' and is
    replayed with '404 (NOT FOUND)'.
    
    thanx, yonatan
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: filebrowser not uploading

    2012-01-27 Thread Bojan Liu
    i got the same error, upload button can't work.
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To view this discussion on the web visit 
    https://groups.google.com/d/msg/django-users/-/S9gz6eKUU_QJ.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    how to lookup dictionary in filter return?

    2012-01-27 Thread snow leung
    my filter return dictionary like this:
    
    {{ somevalue | dic_filter }}
    
    
    but when i try this
    
    {%for itm in somevalue | dic_filter %}
      {{itm}}
    {%endfor %}
    
    it only print the key
    
    how can i get the value with this ?
    
    thx!
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    GeoDjango - Error while importing data

    2012-01-27 Thread Serge RABEVOHITRA
    Hi,
    
    I've just begun to learn GeoDjango. So I followed step by step the
    "geodjango tutorial".
    When I was at the step "Import data" (TM_WORLD_BORDERS-0.3.shp) , i've
    got this error message :
    "Failed to save the feature (id:0) into the model with the keyword
    arguments : {'iso2' : u'AG'
    DatabaseError: ERREUR: sequence d'octets invalide pour l'encodate
    UTF-8 : 0x00"
    
    I'm very pleased if anyone could help me.
    Thanks.
    
    Regards!
    Serge
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: One To One relationship with a generic relation?

    2012-01-27 Thread snow leung
    no way
    
    On 1月15日, 上午9时15分, Stodge  wrote:
    > I've used generic relations and they worked, but in one particular
    > case I need a one-to-one generic relation. Is this possible?
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Fcgi problem

    2012-01-27 Thread Angel Lacret
    It doesn't match the urls.py file even if i update the .fcgi file
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    LEARNING DJANGO- NEED HELP (ERROR 404)

    2012-01-27 Thread Dharmendra Verma
    NEED HELP-
    I started learning Django, and was following tutorial from
    http://www.djangobook.com/en/1.0/chapter02/ , but when i started server
    after editing view file (followed tutorial as it is) getting error-
    
    Page not found (404)
    Using the URLconf defined in mysite.urls, Django tried these URL patterns,
    in this order:
    ^time/$
    The current URL, , didn't match any of these.
    
    -- 
    Dharmendra Kumar Verma
    B-Tech Bioinformatics
    VIT University, TN (India)
    Web- http://www.dharmendralinuxdiary.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-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

    Re: Web Servers for Django Projects [WAS: Does anyone know any blogs...]

    2012-01-27 Thread Dale
    Hi everyone, great discussion for a Django noob, I'm learning lots!
    
    What's the consensus (wink) on choice of web server if one is forced
    to use the same server for dynamic Django/Python _and_ PHP content,
    and also static content? I guess no one's really forcing me, but it
    feels like if I have to setup multiple boxes/VMs with a different web
    server on each, and learn how to configure the web servers, I'll never
    have time to code my idea for next great web app that started me on
    this journey (my background is BSD/Apache/PHP, and while anything new
    will use Django/Python, there are a couple PHP apps I want to keep
    using).
    
    Dale
    
    
    On Jan 14, 8:46 pm, Graham Dumpleton 
    wrote:
    > On Jan 15, 9:40 am, Stuart Laughlin  wrote:
    >
    > > Graham turned up on a thread in another forum where I was asking about how
    > > to fix a strange error I had been seeing intermittently for months. He
    > > instructed me on how to put mod-wsgi into daemon mode, among other things,
    > > and finally solved my problem.
    >
    > > Here's a link to the thread, if you're interested.
    >
    > >http://groups.google.com/group/satchmo-users/browse_thread/thread/6a6...
    >
    > And the problem was actually due to a likely bug in psycopg2 and not
    > mod_wsgi.
    >
    > You would have had the same problems with knowing what the cause was
    > if you had hit this bug when using uWSGI in one of the ways that it
    > uses sub interpreters.
    >
    > So, that the issue could arise isn't unique to mod_wsgi, but an issue
    > for any system using sub interpreters, which for WSGI hosting means
    > both mod_wsgi and uWSGI.
    >
    > Ultimately, if an issue like this had occurred with gunicorn you would
    > have been equally stuffed. This is because the problem was in a C
    > extension module and problems in C extension modules like that are
    > hard to debug and invariably are fixed through thinking about the
    > problem and looking at source code and not through trying to run pdb
    > or even gdb on a running process. You are lucky when someone else
    > knows what the issue is already.
    >
    > That all said, that mod_wsgi and uWSGI in some modes use sub
    > interpreters does cause more than it share of problems. This though
    > pretty well always derives from the fact that people writing C
    > extension modules take short cuts and don't even contemplate that the
    > extension module may be used in sub interpreters or even in multiple
    > sub interpreters at the same time.
    >
    > There have even been examples where in the Python interpreter itself
    > they have broken things for sub interpreters. For example, fork() is
    > broken in Python 2.7.2 in sub interpreters. So, even the core
    > developers don't always get it quite right and they would generally
    > know more than most people who write C extension modules.
    >
    > One of the benefits at least is that mod_wsgi is configurable enough
    > that one can configure around broken third party software when these
    > sorts of issues arise, other systems may not provide you as much
    > flexibility. The config you used was also not a 'perfect config' in
    > the general sense, but was one that just solved your specific problem.
    > What configuration is best is going to be specific to a particular
    > application and the requirements.
    >
    > Now being part of the Apache eco system, mod_wsgi is a bit ham strung
    > by the default configs forced on people by PHP and Linux distros. So
    > the default isn't necessarily a good config for sites. Even so, it
    > still serves adequately for a lot people because the server generally
    > isn't the issue anyway. The only big problem is usually memory usage
    > because Apache/mod_wsgi for a Linux distro is embedded and prefork
    > MPM, which is bad for fat Python web applications.
    >
    > As to ease of debugging, if you are debugging your code and need to
    > run pdb or other IDE debugger, although it can be done under mod_wsgi
    > with the right knowledge, you are much better off doing it in a proper
    > development system. Debugging is not the missing thing here. What most
    > people really need is decent monitoring of their production systems.
    > What use is the ability to debug code if you have no idea what the
    > problems are that are occurring in your production system to start
    > with.
    >
    > So monitoring is going to be more important going forward. The WSGI
    > hosting issue is reasonably solved and debugging is something one
    > could always do.
    >
    > Think about it. Do you really have any idea what your production
    > system is doing? How much time is spent in your application vs
    > database, vs time spent calling out to external web services, memcache
    > etc etc. Do you know how long the application is even taking to do a
    > connect to your database for every Django request and how much time
    > that is as a percentage of overall response time. If you don't know,
    > how do you expect to be able to improve the performance of your
    > application. This is why monitoring is going to be key and where
    > Python web applications have been really lacking in the past.
    >
    > Graham
    >
    >
    >
    > > --Stuart
    > > On Jan 14, 2012 8

    [no subject]

    2012-01-27 Thread Arun Ashok
    Hai all,
       I want to develop a django application for online objective type
    examination.For this i wish to use radio buttons for selecting answers
    and calculate mark and result at the time of the completion of exam.So
    i kindly request to my dear friends please give advice for creating
    this application
       with regards
     Arun
    
    -- 
    You received this message because you are subscribed to the Google Groups 
    "Django users" group.
    To post to this group, send email to django-users@googlegroups.com.
    To unsubscribe from this group, send email to 
    django-users+unsubscr...@googlegroups.com.
    For more options, visit this group at 
    http://groups.google.com/group/django-users?hl=en.
    
    
    

      1   2   >