Admin - Auto Generate user_id on save

2008-11-29 Thread AJ
I have a simple model like so: # models.py class Announcement(models.Model): """ Table containing intranet announcements """ category = models.ForeignKey(AnnouncementCategory) user = models.ForeignKey(User) text = models.TextField() timestamp = models.DateTimeField(auto

Re: Admin - Auto Generate user_id on save

2008-11-29 Thread AJ
6:38 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Sat, Nov 29, 2008 at 5:25 PM, AJ <[EMAIL PROTECTED]> wrote: > > to the vairables self and commit.  So as far as I can tell I can't do > > this in the Admin.  It looks like I would need to write my ow

Re: Self Join using QuerySet

2009-03-05 Thread AJ
I'm not sure if/how this is done in django version prior to 1.1, but if you are using the 1.1 alpha or working from the trunk you can use the F() expression: http://docs.djangoproject.com/en/dev/topics/db/queries/#filters-can-reference-fields-on-the-model On Mar 5, 1:46 pm, Adam Nelson wrote: >

Re: Error: No module named tp.urls | Exception Type: ImportError

2010-08-22 Thread AJ
ROOT_URLCONF: 'tp.urls' I just saw that line in my settings.py --AJ ` On Aug 22, 8:33 pm, Aman wrote: > I recently installed Django on my personal Ubuntu Dev Server and have > been trying with mod_wsgi (as mod_python is officially dead). I just > had some breakthrough

Re: Error: No module named tp.urls | Exception Type: ImportError

2010-08-22 Thread AJ
ROOT_URLCONF = 'tp.urls' Just saw this in my settings.py --AJ On Aug 22, 8:33 pm, Aman wrote: > I recently installed Django on my personal Ubuntu Dev Server and have > been trying with mod_wsgi (as mod_python is officially dead). I just > had some breakthrough where I

blocks in multiple inheritance

2008-03-02 Thread AJ
file.html I get the title of Edit Profile with an h1 tag and the word 'text' underneath it. However The form in the profile_content block is not rendered, and is in fact not on the page. I am doing something incorrect? Thanks, AJ --~--~-~--~~~---~--~~ Yo

Re: blocks in multiple inheritance

2008-03-02 Thread AJ
Turns out I figured out the problem. In the profile/profile.html file there was an {% ifequal %} block, and the {% block profile_content %} was inside that. This was causing the if to fail for the profile/ edit_profile.html template, thus no content. On Mar 2, 6:12 pm, AJ <[EMAIL PROTEC

Custom SQL only executing once

2008-04-04 Thread AJ
So I have a manager for an model that executes some custom sql. That custom sql on a certain page populates a select dropdown. For an example we'll say that the select is a list of colors, and there is also a page to add new colors. If I add a new color then go to the page that has the list of

Re: Custom SQL only executing once

2008-04-04 Thread AJ
s = Color.objects.custom_query() return render_to_response('page.html', {'colors' : colors}) Is this not the proper way to setup the code so that the manager's custom_query get's run every time it is called? Thanks, Aaron On Apr 4, 11:50 am, "Karen Tracey" &l

Re: Custom SQL only executing once

2008-04-04 Thread AJ
(c.id, c.name) for c in Color.objects.custom_query()] color = forms.Field(widget=widgets.Select(choices=colors), initial="") Is any sort of caching enabled by default? I haven't added/changed any settings involving caching in the settings.py On Apr 4, 2:11 pm, "Karen Tracey&qu

Re: Custom SQL only executing once

2008-04-04 Thread AJ
> On Fri, Apr 4, 2008 at 1:19 PM, AJ <[EMAIL PROTECTED]> wrote: > > > What would be the proper way to make sure the code is run each time > > the manager is called?  Here's a example of how I have my code > > currently setup: > > > //models.py >

Re: Custom SQL only executing once

2008-04-04 Thread AJ
s for all of your help. On Apr 4, 2:11 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Fri, Apr 4, 2008 at 1:19 PM, AJ <[EMAIL PROTECTED]> wrote: > > > What would be the proper way to make sure the code is run each time > > the manager is called?  Here&#x

Re: Custom SQL only executing once

2008-04-04 Thread AJ
> On Fri, Apr 4, 2008 at 2:25 PM, AJ <[EMAIL PROTECTED]> wrote: > > > The actual custom_query is called in forms.py, something similar to > > the following: > > > //views.py > > from app.forms import CrayonForm > > > def add_crayon(request): > &g

Custom SQL Escaping apostrophe

2008-04-15 Thread AJ
My custom sql works great unless there is an ' in the query, then of course it fails. The question is how do I escape the apostrophe? For example the query is "pete's". I first tried: query = query.replace("'", "\'") If you printed the query out it does say "pete\'s", but as soon as it gets su

Re: Template path error

2008-04-15 Thread AJ
Do you have your TEMPLATE_DIRS setting as a tuple or list? If it's a tuple and it has only one element you need a trailing comma like so: TEMPLATE_DIRS = ( 'C:/python25/django/templates', ) On Apr 15, 12:00 pm, "Gaurav Sharma" <[EMAIL PROTECTED]> wrote: > Hi All, > > I am very new to Django an

Re: Custom SQL Escaping apostrophe

2008-04-15 Thread AJ
HERE `table`.`name` LIKE '%%%s%%' GROUP BY `table`.`original_id`;", [kw]) And I get a sql error, it looks like there are quotes going on the inside of the %'s: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right

Re: Custom SQL Escaping apostrophe

2008-04-15 Thread AJ
e % to the keyword then pass it as a tuple to the 2nd paramater of the execute function. Using % in the actual query does not work, even if you escape it with a double %%. Not sure if this is the best way but it seems to work as expected now. On Apr 15, 2:03 pm, AJ <[EMAIL PROTECTED]> wrote: &

Problems using custom sql in manager

2008-07-08 Thread AJ
I've run into an issue using a manager for a model to run some custom sql. A dumbed down version of the code looks something like this: cursor = connection.cursor() # Get list of zipcodes zips = [zip.zipcode for zip in Zip_Co

Re: Problems using custom sql in manager

2008-07-08 Thread AJ
he parens around the params? I tried passing in a string like '("3", "33344")' and it didn't error, but it didn't return any results either. On Jul 8, 8:00 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-07-08 at 16:56 -0700,

Re: Problems using custom sql in manager

2008-07-09 Thread AJ
Thanks for your assistance, I got it working properly now. On Jul 8, 9:55 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2008-07-08 at 17:17 -0700, AJ wrote: > > Thanks for your quick reply.  I have been searching for a long time > > for good documentation on us

Re: Stackoverflow kind of Answer/commenting app in Django

2011-04-14 Thread AJ
>>Here's a fun thought, why can't a custom blog like enty and the comments >>framework be utilized to do this? Precisely but I was hoping I'd get something with modifications. Here is what I require: * Posts in the system: bunch of text. --- (This i already have.) * Each post gives user to be a

Re: Stackoverflow kind of Answer/commenting app in Django

2011-04-14 Thread AJ
>>Wait aren't we programmers or not? This should be something you can do >>in a couple days... Indeed. Just wanted opinions. :) Consider this resolved now. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dj

Re: Stackoverflow kind of Answer/commenting app in Django

2011-04-14 Thread AJ
Why has this become a case for me? I just wanted to know about a particular solution, that whether it exists or not. I did try Google and other forums. I never complained about 'a couple of days', someone else did. I apologize for asking a 'dumb' question by your standards. Please accept my since

Re: Stackoverflow kind of Answer/commenting app in Django

2011-04-15 Thread AJ
Thanks a lot for that suggestion. On Apr 15, 2011 8:52 AM, "Daniel Hilton" wrote: > On 15 April 2011 13:01, roberto wrote: >> You can also have a look at askbot. >> It seems to have more functionalities. >> Good luck ! >> >> www.askbot.org >> &

Re: Unable to access Dictionary values in Template (object pk is the dict key)

2011-05-05 Thread AJ
I see. Any clue where I can begin in my case (for filters etc.)? 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-us

Re: django-voting : How to get objects with number of votes.

2011-05-06 Thread AJ
Appreciate your response, Shawn. I am a newbie and struggling. Yea, but that is 'latest'. I need ascending descending order by score/votes. Can't seem to figure that one out. That would go in the else part. By default in my app, I want the comments to be sorted by vote/score. else:#This is

Re: django-voting : How to get objects with number of votes.

2011-05-06 Thread AJ
I am not aware what 'relations' can do or if there was anything like 'relations' let alone 'GenericRelations' :) What does the Sum('vote') done? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users

Re: how to use jquery for point of Sale

2011-05-06 Thread AJ
I am impressed at the maturity of folks around here. Keep up the good work folks. :) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email

Re: how to use jquery for point of Sale

2011-05-06 Thread AJ
Oh, I can agree with that. I am just saying that the way it was handled by Shawn and GKR...I liked 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

Re: Use Ajax to retrieve data from db based on data from input box and adding it to a table.

2011-05-13 Thread AJ
>From what you've tried to explain, I can see that you would really want to use AJAX, that means, for that page you have to write a JavaScript handler (function that handles the event of adding a new record by pressing Add or Enter). The JS will take care of the page not being submitted/refreshed.

Re: Use Ajax to retrieve data from db based on data from input box and adding it to a table.

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

Re: Use Ajax to retrieve data from db based on data from input box and adding it to a table.

2011-05-13 Thread AJ
t; > so shall i put the scripts directly on the template file to work out or is > there any better alternate.. > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-user

Re: Use Ajax to retrieve data from db based on data from input box and adding it to a table.

2011-05-13 Thread AJ
ango users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, 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 change field to "unique" in existing mysql database?

2011-05-14 Thread AJ
> "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-

Re: __unicode__() addition not working in basic poll application.

2011-05-16 Thread AJ
o the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group

Re: __unicode__() addition not working in basic poll application.

2011-05-16 Thread AJ
Sorry about that. It is indeed not right. I will take care of this from next time onwards. On Mon, May 16, 2011 at 11:45 AM, Fabian Ezequiel Gallina < galli...@gmail.com> wrote: > 2011/5/16 AJ : > > I think you are getting the poll object back. You need to specify the > method

Re: how use this snippet

2011-05-17 Thread AJ
;t comment on whether it works, what it does, > etc. > > Cheers > > Tom > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsub

Re: how use this snippet

2011-05-17 Thread AJ
Thanks for the great advice Tom. On Tue, May 17, 2011 at 12:33 PM, Tom Evans wrote: > On Tue, May 17, 2011 at 5:04 PM, AJ wrote: > > Many times I do not know how to use some snippets on djangosnippets.org. > has > > anyone else felt the same? I, obviously, am a newbie. >

Re: Question

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

Re: how to save image in postgreSQL database

2011-05-19 Thread AJ
As Simon mentioned that it is a bad idea and I agree but just for the answer's sake you could save them as BLOBs http://www.postgresql.org/files/documentation/books/aw_pgsql/node96.html Am I correct folks? <http://www.postgresql.org/files/documentation/books/aw_pgsql/node96.html>

Re: uber weird access problem from windows

2011-05-21 Thread AJ
Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/dja

Re: forum and blog for developers

2011-05-21 Thread AJ
ll become known as a valuable > community resource, and the entire community will benefit. > > 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

Re: Is there an HTML editor that's Django-aware

2011-05-23 Thread AJ
am yet to start with it properly. Is anyone using or used a cheatsheet for keyboard shortcuts with Komodo? Thanks. AJ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegrou

Re: Experiences with virtualenv + Django?

2011-05-23 Thread AJ
ot;Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=

Re: GET/POST

2011-05-23 Thread AJ
id you really mean 404? That would > change my reply. > > Best, > Gabe > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsu

Re: Is there an HTML editor that's Django-aware

2011-05-24 Thread AJ
Simon, Can you please give details of plugins that you use for Python/Django in MacVim? Thanks, AJ On Tue, May 24, 2011 at 12:51 PM, Simon Connah wrote: > > On 20 May 2011, at 21:18, Kevin Monceaux wrote: > > > On Fri, May 20, 2011 at 07:51:06AM -0400, Brian Bouterse wrote: >

Re: Is there an HTML editor that's Django-aware

2011-05-25 Thread AJ
://www.vim.org/scripts/script.php?script_id=69 but again, still have to deal with the learning curve. Having complained enough, I still think that if I do not give up this time, I will be better off with this editor as my primary. Best, AJ On Tue, May 24, 2011 at 4:02 PM, Simon Connah wrote

Re: Is there an HTML editor that's Django-aware

2011-05-26 Thread AJ
his group at > http://groups.google.com/group/django-users?hl=en. > -- AJ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send e

Re: Is there an HTML editor that's Django-aware

2011-05-26 Thread AJ
of django templates). Stick with one editor for a few weeks and > decide what additional functionality you might need. Then do some searching > based on those requirements to see if there's a better option. > > > On 26 May 2011 21:11, Shawn Milochik wrote: > >> On 05/26/20

Re: Is there an HTML editor that's Django-aware

2011-05-30 Thread AJ
o unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- AJ -- You received this message because you are subscribed to the Google Groups "Dja

Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread AJ
/test/ etc. but Dreamhost uses passenger and I am not sure how to install multiple instances of a Django app per domain on Dreamhost either. What are you suggestions? Please feel free to point me to earlier discussions or articles or tools that I can use to achieve this. Thanks a lot. AJ -- You receiv

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread AJ
web projects? Best, AJ On Fri, Jun 3, 2011 at 2:05 PM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > Hi AJ, > > Just a heads up, I have had a few clients in the past who used Dreamhost > (and I had to set it up for them). They are not

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread AJ
om. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- AJ -- You received this message because you are subscribed to the Google Groups &q

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread AJ
and users will not email amongst themselves. On Sat, Jun 4, 2011 at 12:21 AM, Kenneth Gonsalves wrote: > On Fri, 2011-06-03 at 14:12 -0400, AJ wrote: > > To change the question or ask a new one too: what name do you suggest > > as a > > good, reliable yet economical hostin

Re: VERY cheap django hosting?

2011-06-09 Thread AJ
django-users@googlegroups.com. >>> To unsubscribe from this group, send email to >>> django-users+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/django-users?hl=en. >>> >>> >> -- >> Y

Dynamic Form Fields in Django using JavaScript

2011-07-03 Thread AJ
be using to search for this kind of behaviour. If you want additional information, please let me know. Thanks. AJ -- 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

Re: Dynamic Form Fields in Django using JavaScript

2011-07-03 Thread AJ
Hi Shawn, Thanks for your reply. To begin with, I am trying this with a small test app. I have this so far. I tried with two textarea elements on a page and tried to save them but I cannot figure out how to save two elements. Each element list corresponds to one model instance or table row for Te

Re: Dynamic Form Fields in Django using JavaScript

2011-07-03 Thread AJ
I do realize that I need the number of elements so that I can loop over that many times... On Sun, Jul 3, 2011 at 4:30 PM, AJ wrote: > Hi Shawn, > > Thanks for your reply. To begin with, I am trying this with a small test > app. > > I have this so far. I tried with two text

Re: Dynamic Form Fields in Django using JavaScript

2011-07-03 Thread AJ
Nevermind. I did not know about and eventually solved it with formsets. Thanks. On Sun, Jul 3, 2011 at 4:34 PM, AJ wrote: > I do realize that I need the number of elements so that I can loop over > that many times... > > > On Sun, Jul 3, 2011 at 4:30 PM, AJ wrote: > >>

About using Django Auth with my app, Auto saving the User

2011-03-16 Thread AJ
I have a model like this: class Post (models.Model): name = models.CharField(max_length=1000, help_text="required, name of the post") description = models.TextField(blank=True) custom_hashed_url = models.CharField(unique=True, max_length=1000, editable=False) def save(self, *args, **k

Re: About using Django Auth with my app, Auto saving the User

2011-03-17 Thread AJ
No one? On Mar 16, 10:05 pm, AJ wrote: > I have a model like this: > > class Post (models.Model): >     name = models.CharField(max_length=1000, help_text="required, name > of the post") >     description = models.TextField(blank=True) >     custom_hashed_url

Re: About using Django Auth with my app, Auto saving the User

2011-03-17 Thread AJ
. --AJ On Mar 17, 10:39 am, Daniel Roseman wrote: > On Thursday, March 17, 2011 2:33:50 PM UTC, AJ wrote: > > > No one? > > > On Mar 16, 10:05 pm, AJ wrote: > > > I have a model like this: > > > > class Post (models.Model): > > >     name = models.C

Re: About using Django Auth with my app, Auto saving the User

2011-03-18 Thread AJ
I have tried both solutions but could not achieve the results. here is the actual code that I started working with. This is the simplest version that I did to test this feature. Model-- class Post (models.Model): name = models.Ch

Re: About using Django Auth with my app, Auto saving the User

2011-03-19 Thread AJ
OK. I believe that the form is invalid. "if post_form.is_valid():" actually fails and it prints "not working". I am using the default form that Django creates from class PostForm(ModelForm): class Meta: model = Post Is it not good? On Mar 18, 10:1

Re: About using Django Auth with my app, Auto saving the User

2011-03-20 Thread AJ
My form is not valid and I cannot figure out why. I am using Django's ModelForm to generate a form (As above). I printout out the request.POST and all it has is "csrfmiddlewaretokenname" Just putting it here. -- You received this message because you are subscribed to the Google Groups "Django

Re: About using Django Auth with my app, Auto saving the User

2011-03-20 Thread AJ
No, the form submits, with other values too, to the view but it just does not validate. AJ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this g

Stackoverflow kind of Answer/commenting app in Django

2011-04-11 Thread AJ
I was wondering if there is a pluggable application in Django that I can use which is a replica of Stackoverflow kind Answer and commenting. Each post on my web app will have answers and all answers can have comments discussing that answer, just like SO. Does anyone know such an app or has anyone

Re: Stackoverflow kind of Answer/commenting app in Django

2011-04-12 Thread AJ
Isn't there any app with just the commenting part? I mean the answer and comments on those answers part 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 fro

Re: Stackoverflow kind of Answer/commenting app in Django

2011-04-13 Thread AJ
I am kind of aware of that. I just want to add a Stackoverflow kind of a commenting system (with comments on answers and voting on answers) to my already present application. Does anyone know if Django's own comment app can be enhanced to be that or has anyone already done that? On Wed, Apr 13,

Re: How to subclass django-contact-form to create custom contact form?

2015-01-19 Thread AJ
if contactform.is_valid(): contactform.save() elif request.method == 'POST' && 'feedback' in request.post : feedbackform = feedbackForm(request.POST) if feedbackform.is_valid(): feedbackform.save() else: contactform = contactForm()

tutorial part3 : polls didn't match URL patterns

2014-01-10 Thread AJ NOURI
I have Python 2.7.3 I am new in django and I am following the tutorial 3 at : https://docs.djangoproject.com/en/1.6/intro/tutorial03/ I followed exactly the steps described: Here is a copy/paste from files in the project: *cat polls/views.py* from django.http import HttpResponse def index(r

Re: Error: No module named mysql.base when trying to sync.db

2014-05-17 Thread Arvind Aj
On Friday, April 15, 2011 2:59:32 PM UTC+5:30, paganplan paganplan wrote: > > Solved! > in settings.py file, option 'ENGINE' must be like this: > django.db.backends.mysql > > 2011/4/14, pagan >: > > same problem. apache2, mod_wsgi, python-mysqldb installed. When i add > > databases engine, name,

Re: Data Science and sql problem

2020-07-27 Thread AJ Wattoo
as far i understand you want to connect with postgreSQL database on jupyter notebook : you can do like this 1. install -c anaconda psycopg2 and install -c anaconda sqlalchemy *2. *from sqlalchemy import create_engine and import pandas as pd 3. engine=create_engine(‘postgres+psycopg2://postgres:

Re: django 1.9 - application does not

2015-12-24 Thread AJ Abrahamsen
This person had a similar problem. Hopefully this can give you some clue to help fix your issue: http://stackoverflow.com/questions/26276397/django-1-7-upgrade-error-appregistrynotready-apps-arent-loaded-yet -- You received this message because you are subscribed to the Google Groups "Django

Re: pip install django

2015-12-24 Thread AJ Abrahamsen
I don't know if it matters but I usually do pip upgrades this way: pip install --upgrade django -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsu