Re: track change

2012-05-23 Thread Andre Terra
Google for Django Audit Log and/or Audit Trail. While some of the packages might not be under active development, they may be able to point you in the right direction. Cheers, AT -- Sent from my phone, please excuse any typos. -- On May 23, 2012 5:45 PM, "Carsten Jantzen" wrote: > Hi > > I am l

Re: Registering and authenticating via iPhone/Android app

2012-05-23 Thread Mario Gudelj
I read somewhere that Instagram use django-piston. But them some people are saying that Piston has had any development done in over a year. -m On 23 May 2012 23:12, Roarster wrote: > On Wednesday, 23 May 2012 13:02:15 UTC+1, bruno desthuilliers wrote: >> >> On May 23, 1:12 pm, Roarster wrote:

How to call RegexValidator explicitly?

2012-05-23 Thread forthfan
Hi all, I see in docs.djangoproject.com/en/dev/ref/validators/ how to include validators in a form field, but I have a field that needs to be validated with a regular expression determined by another field. Please help me call RegexValidator explicitly the right way. For one thing, I don't see ho

Re: Django site updater

2012-05-23 Thread Mike Dewhirst
I use buildbot to export the code from svn whenever I commit to trunk. It also performs other related tasks such as deleting the entire site first then running tests, compiling to .pyc, deleting source, chowning and chmoding etc. I really like buildbot because you can add programmed (in Python

Re: Question object permission approach

2012-05-23 Thread Kurtis Mullins
Hey, I think it really depends on how much complexity you want. We use a package called userena which depends upon Guardian. All that I know about Guardian is it's no fun when schema migrations get messed up :) In all honestly, though, I should have probably read more about it before using an appl

model form_set can not delete

2012-05-23 Thread Min Hong Tan
Hi there, i have a problem whereby, if i for form in formset line by line and run form.save(). my delete (ticked) item will not be deleted. and if i 'm direct using formset.save(). it did deleted. where am i code wrong already? q1 = modelformset_factory(CustomerDetail,

Question object permission approach

2012-05-23 Thread Paul
Assume i have a model as follows: class Website(models.Model): user = models.ForeignKey(User) name = models.CharField(unique=True, max_length=32) url = models.URLField(unique=True) Now i have a generic (detail) view as follows: class WebsiteRead(DetailView): model = Website

track change

2012-05-23 Thread Carsten Jantzen
Hi I am looking for a way to track a skill change for a player in a online game. model: Player 1 skill_x=1 skill_y=1 During next update I get a change Player 1 skill_x=2 skill_y=1 When I load the player I would like to see his latest stats. If I goto the players page I would like to be able to

derived fields and getattr

2012-05-23 Thread Larry Martell
I was asked to make a mod to a large django app that I didn't write. They wanted me to add a derived field to a query, e.g. select col1-col2 from table ... I did that and it works, but in some other part of the code it calls getattr(object, field) and when field == col1-col2 it blows up with"objec

Re: ordering m2m query based on through table

2012-05-23 Thread akaariai
On May 23, 3:36 pm, akaariai wrote: > I guess (again!) that the reason for the LEFT JOIN is this call in sql/ > compiler.py:_setup_joins() > > self.query.promote_alias_chain(joins, >      self.query.alias_map[joins[0]].join_type == self.query.LOUTER) > > This seems to promote the join to outer joi

Re: Generic views create_object and prefill form data?

2012-05-23 Thread Andre Terra
For the record, you could go even further (and you may already have), and make the get_initial part of a WebsiteMixin so that you can reuse it in other views without having to repeat yourself. Cheers, AT -- Forwarded message -- From: Paul Date: Wed, May 23, 2012 at 5:09 PM Subje

Re: Generic views create_object and prefill form data?

2012-05-23 Thread Paul
Solved it by migrating to the class based generic views, then fed initial form data to the constructor of the form by overloading get_initial on the view class. Paul -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send ema

Re: Django site updater

2012-05-23 Thread Alexis Bellido
I use Fabric to automate as much as possible, not only for production but also for my development and staging environments. I have shared some code in github: https://github.com/alexisbellido/The-Django-gunicorn-fabfile-project I'm currently finishing some changes for making this code more flex

Re: JQuery .get new url is not updating the page

2012-05-23 Thread Furqan Malik
Thanks Kurtis, *1. Get your dynamic page via AJAX with some given query* Here is work flow, a: when user clicks on "Result" button on the main menu, the table is displayed in which first column is "IDs". and url becomes http://127.0.0.1:8080/Home/Search/ b: when user clicks on any of the

Re: JQuery .get new url is not updating the page

2012-05-23 Thread Furqan Malik
Thanks Kurtis, 1. Get your dynamic page via AJAX with some given query Here is work flow, a: when user clicks on "Result" button on the main menu, the table is displayed in which first column is "IDs". and url becomes http://127.0.0.1:8080/Home/Search/ On Wed, May 23, 2012 at 12:54 PM, Kurtis M

Re: JQuery .get new url is not updating the page

2012-05-23 Thread Kurtis Mullins
I'm not sure of the use-case on this but you could possibly take the following approach: 1. Get your dynamic page via AJAX with some given query 2. Modify the URL to match the query 3. When a user accesses the same page with the given query (my/page/?foo=bar) then they'll see the same thing Of co

Re: JQuery .get new url is not updating the page

2012-05-23 Thread Furqan Malik
Thank you so much Lee, I am able to change the url but when i copy and past that url to new browser, it opens parent page. Any help? On Sat, May 19, 2012 at 10:49 AM, Lee Hinde wrote: > > On May 18, 2012, at 8:24 PM, Furqan Malik wrote: > > Thanks for the reply, > > You misunderstood my questi

Re: Need Help with ForeignKeys

2012-05-23 Thread Mark Phillips
Thanks! I think I understand it now! Mark On Wed, May 23, 2012 at 8:00 AM, Simone Federici wrote: > On Wed, May 23, 2012 at 4:40 PM, Mark Phillips > wrote: > >> Now, can you please explain why it worked? What does the related_name do >> and why do I need it? > > When you define a ForeignKey, dj

Re: Need Help with ForeignKeys

2012-05-23 Thread Simone Federici
On Wed, May 23, 2012 at 4:40 PM, Mark Phillips wrote: > Now, can you please explain why it worked? What does the related_name do > and why do I need it? When you define a ForeignKey, django creates dinamically a reverse relationship. take this example: A B.a -> A from an instance of b = B() yo

Re: Need Help with ForeignKeys

2012-05-23 Thread Kurtis Mullins
The related name, basically, specifies a way to back-reference that particular Team. If you don't specify it, it just uses an automatically generated variable name (for example, just 'team'). You'd have a conflict because there'd be two 'team' variables generated in your game class. The method Simo

Re: how to get text of a ChoiceField populated with ajax

2012-05-23 Thread Kurtis Mullins
Sorry, somehow I completely overlooked the post where it says you've solved the problem. Happy hacking! On Wed, May 23, 2012 at 10:52 AM, Kurtis Mullins wrote: > Hey, no problem! My apologies for missing out on this thread for a > while. I hope you got it figured out! > > Anyways, I'm thinking th

Re: how to get text of a ChoiceField populated with ajax

2012-05-23 Thread Kurtis Mullins
Hey, no problem! My apologies for missing out on this thread for a while. I hope you got it figured out! Anyways, I'm thinking that if you're actually basing this validation (done in your clean method), you may want to use a ForeignKey Field. You can define a custom queryset to filter through the

Re: Need Help with ForeignKeys

2012-05-23 Thread Mark Phillips
Thanks, that worked. Now, can you please explain why it worked? What does the related_name do and why do I need it? Thanks! Mark On Wed, May 23, 2012 at 7:34 AM, Simone Federici wrote: > class Game(models.Model): > game_id = models.IntegerField(primary_key=True) > gamedate = models.Dat

Re: After python upgrade, User.objects.get(username= doesn't work consistently

2012-05-23 Thread Kurtis Mullins
Wow, nice find! I would've never thought an index would cause that sort of a problem. I'm glad you figured it out and thanks for sharing that crazy find! On Wed, May 23, 2012 at 4:23 AM, Hanne Moa wrote: > On 23 May 2012 00:30, akaariai wrote: >> On May 22, 11:49 pm, Hanne Moa wrote: >>> I upgr

I need a django application to embed a chat javascript in admin site

2012-05-23 Thread Ariel Isaac Romero Cartaya
Hi everybody, I need a django application to embed a chat javascript in the admin app of my web site, I would like when the users are authenticated be able to contact by chat any other user authenticated in the admin site. How could I do this ??? Is there an application to make this ??? Regards,

Re: Need Help with ForeignKeys

2012-05-23 Thread Simone Federici
class Game(models.Model): game_id = models.IntegerField(primary_key=True) gamedate = models.DateField() gamestart = models.TimetField(blank=True) duration = models.IntegerField() innings = models.IntegerField() hometeam = models.ForeignKey(Team, related_name='homegame_set')

Need Help with ForeignKeys

2012-05-23 Thread Mark Phillips
I have two tables - Team and Game. class Team(models.Model): team_id = models.IntegerField(primary_key=True) teamname = models.CharField(max_length=255) division_id = models.ForeignKey(Division) class Game(models.Model): game_id = models.IntegerField(primary_key=True) gamedate

Re: Registering and authenticating via iPhone/Android app

2012-05-23 Thread Roarster
On Wednesday, 23 May 2012 13:02:15 UTC+1, bruno desthuilliers wrote: > > On May 23, 1:12 pm, Roarster wrote: > > I'm developing a site using Django using the built in user > authentication > > module. This is all working fine and users can register, login, etc. on > > the web site with no pro

Re: TypeError Exception Value: coercing to Unicode: need string or buffer, dict found

2012-05-23 Thread Waleria
It shows this line: File "C:\simuladores\..\simuladores\detector\views.py" in pdf 259. canvas.print_pdf(response, facecolor='w', edgecolor='w') File "C:\Python26\Lib\site-packages\matplotlib\backend_bases.py" in print_pdf 1334. return pdf.print_pdf(*args, **kwargs) In my code this

Re: TypeError Exception Value: coercing to Unicode: need string or buffer, dict found

2012-05-23 Thread kenneth gonsalves
On Wed, 2012-05-23 at 05:16 -0700, Waleria wrote: > Exception Type: TypeError Exception Value: coercing to Unicode: need > string or buffer, dict found you have to find out where in the code the error is coming. Then you will find that you are passing a dict instead of a string. -- regards Kenne

Re: ordering m2m query based on through table

2012-05-23 Thread akaariai
On May 23, 2:36 pm, bruno desthuilliers wrote: > > The interaction between > > multiple references to same reverse foreign key relation in single > > queryset is somewhat hard to remember. Could you post the generated > > SQL? > > here you go - reformated for readability: > > SELECT >   `blookcore

Re: Following multiple reverse relationships

2012-05-23 Thread akaariai
On May 23, 3:06 pm, sk <6b656...@gmail.com> wrote: > > On May 22, 12:51 pm, sk <6b656...@gmail.com> wrote: > > > > If I have a hierarchy of models such that: > > > > class A(models.Model): > > >     name = CharField(max_length=10) > > > > class B(models.Model): > > >     name = CharField(max_length

TypeError Exception Value: coercing to Unicode: need string or buffer, dict found

2012-05-23 Thread Waleria
Hi, Anyone know how to solve this error? Exception Type: TypeError Exception Value: coercing to Unicode: need string or buffer, dict found Can you help me?? See mycode: http://dpaste.com/751460/ And see my Traceback: http://dpaste.com/750773/ Thanks, -- You received this message because yo

Re: Following multiple reverse relationships

2012-05-23 Thread sk
> On May 22, 12:51 pm, sk <6b656...@gmail.com> wrote: > > > > > > > If I have a hierarchy of models such that: > > > class A(models.Model): > >     name = CharField(max_length=10) > > > class B(models.Model): > >     name = CharField(max_length=10) > >     a= ForeignKey(A) > > > class C(models.Mode

Re: Registering and authenticating via iPhone/Android app

2012-05-23 Thread bruno desthuilliers
On May 23, 1:12 pm, Roarster wrote: > I'm developing a site using Django using the built in user authentication > module.  This is all working fine and users can register, login, etc. on > the web site with no problems.  The plan is to also have companion > iPhone/Android apps where users can regi

Re: Is there a custom forms component of python-web?

2012-05-23 Thread bruno desthuilliers
On May 23, 12:27 pm, kevon wang wrote: > Is there a component as above Yes. > thanks! You're welcome. hint #1: google is your friend. Took me about 15 seconds to get the answer, so way less than the time you spent posting your question. hint #2: what you're looking for is usally named a form

Registering and authenticating via iPhone/Android app

2012-05-23 Thread Roarster
Apologies if this has been asked before but I'm struggling to find any real best practices. I'm developing a site using Django using the built in user authentication module. This is all working fine and users can register, login, etc. on the web site with no problems. The plan is to also have

Re: ordering m2m query based on through table

2012-05-23 Thread bruno desthuilliers
On May 23, 11:43 am, akaariai wrote: > I would guess you would get duplicate objects returned. We programmers are usually very bad at guessing. So when in doubt, check, don't guess ;) > I think the > query works as follows: >   - Fetch all Blook's categories >   - For those categories you fetch

Re: Is there a custom forms component of python-web?

2012-05-23 Thread kevon wang
Is there a component as above, 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.

Re: JQuery Django

2012-05-23 Thread cocoza4
Thank you -- 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/-/qGTuZfj5344J. To post to this group, send email to django-users@googlegroups.com. To unsubscribe f

Re: "Connection refused" with backend psycopg2

2012-05-23 Thread Tanuva
Am 23.05.2012 11:34, schrieb akaariai: > On May 23, 11:46 am, Tanuva wrote: >> If I connect manually using psql, I automatically get an ssl connection. >> Non-ssl isn't supposed to work in this case. Removing the sslmode from >> the django config doesn't change anything as I noted in the paste. >>

Re: ordering m2m query based on through table

2012-05-23 Thread akaariai
On May 23, 12:12 pm, bruno desthuilliers wrote: > On May 22, 4:34 pm, akaariai wrote: > > > So, you would want to do collection.songs.all() and have that ordered > > by the sequence defined in the m2m table? I agree - this seems to be > > somewhat hard currently. > > I currently have a similar sc

Re: "Connection refused" with backend psycopg2

2012-05-23 Thread akaariai
On May 23, 11:46 am, Tanuva wrote: > If I connect manually using psql, I automatically get an ssl connection. > Non-ssl isn't supposed to work in this case. Removing the sslmode from > the django config doesn't change anything as I noted in the paste. > > > The error you are getting is the same yo

Re: DB joining 3 tables in django admin, while searching on the primary table

2012-05-23 Thread bruno desthuilliers
On May 20, 9:42 am, Aditya Sriram M wrote: > I tried this but it failed? Can you pls correct me? yes : "it failed" is the worst possible way to describe a problem if you expect to get some help. If you get an exception and traceback, please read them carefully, and eventually post them. Else a

Re: ordering m2m query based on through table

2012-05-23 Thread bruno desthuilliers
On May 22, 4:34 pm, akaariai wrote: > So, you would want to do collection.songs.all() and have that ordered > by the sequence defined in the m2m table? I agree - this seems to be > somewhat hard currently. I currently have a similar scheme in one of our projects, works fine as far as I can tell

Re: Django site updater

2012-05-23 Thread bruno desthuilliers
git (or whatever versioning system you're using) + South for schema migrations + virtualenv / pip for depencies + a simple shell script on the server to update the whole damn thing and restart services (Apache, whatever). You can even have the script run by a cron job so the server is updated every

Re: "Connection refused" with backend psycopg2

2012-05-23 Thread Tanuva
Am 23.05.2012 08:06, schrieb akaariai: > On May 23, 8:41 am, Tanuva wrote: >> Am 22.05.2012 23:52, schrieb akaariai: >> >> >> >> >> >> >> >> >> >>> On May 22, 11:51 pm, Tanuva wrote: Moin, >> lately, I wanted to switch my database from the testing sqlite file to a more productive

Re: After python upgrade, User.objects.get(username= doesn't work consistently

2012-05-23 Thread Hanne Moa
On 23 May 2012 00:30, akaariai wrote: > On May 22, 11:49 pm, Hanne Moa wrote: >> I upgraded python to 2.6.8 today from an earlier 2.6, what an >> adventure! So much bizarre happenings so many places. > > Please provide these three things for further debugging: >  - the exact Python code you try i

Re: JQuery Django

2012-05-23 Thread Alec Taylor
This might be helpful: http://www.djangobook.com/en/beta/chapter04/ On Wed, May 23, 2012 at 4:06 PM, cocoza4 wrote: > I'm new to Django. > How can i connect Django with jQuery? > > is there any additional tool that i need to install? > > could you show me a sample code also? > > Thanks in advance