Web Designer

2011-09-25 Thread christian.posta
I do most of the html code for my django templates in PyCharm and just write the code by hand. I've been evaluating WYSIWYG html/web designers recently (Dreamweaver). But, I find myself using the 'split' mode of Dreamweaver where I write the code and watch the auto-updating visual editor. But i

Re: Model.save() does nothing

2011-08-29 Thread christian.posta
No it shouldn't be dependent on anything like that. Im curious to know what the issue is for you. I know this might be a pain in the butt, but if you could put together a small sample program that demonstrates something like this, I would be more than happy to help you debug through it. On Aug

Re: Select all users that have undone jobs (select, groupby, count)

2011-08-29 Thread christian.posta
Try something like this: users = User.objects.filter(job__done=False).annotate(Count('job')) Then each object returned will be a 'User' object with a property named 'job__count' ex: users[0].job__count On Aug 29, 5:17 am, muzhig wrote: > Hello! > I have model

Re: Cant override change_form.html in Django..Why??

2011-08-04 Thread christian.posta
where did you read that? you don't say it explicitly, but i'm guessing you're trying to change the way things are edited/displayed within the admin application? On Aug 4, 3:29 am, Hayyan Rafiq wrote: > Hi i read that > "By default, the admin application will look for a

Re: Intro Tutorial-- Poll/Choice SQL writes

2011-08-04 Thread christian.posta
If you point me to exactly what part of the tutorial shows Choice objects being saved instantaneously, I can explain it to you. On Aug 3, 5:36 pm, Gall wrote: > I'm working through the introductory tutorial @ djangoproject.com. Why > does the poll object require an

Re: Django admin upload image to few folders

2011-07-29 Thread christian.posta
It's possible I'm a little slower this morning, so could you help me understand what you mean? What do you mean you want to use the index for the filename instead of the pk? On Jul 28, 7:36 pm, Jonathan of Cambridge wrote: > I've been working on using django-filetransfers. >

Re: Admin model listing custom ordering

2011-07-28 Thread christian.posta
Is this something that can work for you? https://docs.djangoproject.com/en/1.3/ref/models/options/#order-with-respect-to If not, then the only thing i can do is recommend you review the source code for how the ordering happens in the admin module for a model. The main spots to look at would be

Re: ALL CAPS input and Sentence case

2011-07-26 Thread christian.posta
Awesome, I'll take a look! Thanks! On Jul 26, 9:38 am, Kirill Spitsin <t...@0x746e.org.ua> wrote: > On Tue, Jul 26, 2011 at 07:19:46PM +0300, Kirill Spitsin wrote: > > On Tue, Jul 26, 2011 at 08:48:24AM -0700, christian.posta wrote: > > > For user input, I would like t

ALL CAPS input and Sentence case

2011-07-26 Thread christian.posta
Forgive me if this might be more of a python-centric or text-handling question more than Django, but it does come up within the context of web development, processing user input, etc in all web frameworks including django. I did a quick search on the forum and couldn't find an answer. (I've also

Re: Integrity Error with generic relation using ContentType

2011-06-15 Thread christian.posta
14, 10:06 am, Amit Sethi <amit.pureene...@gmail.com> wrote: > On Tue, Jun 14, 2011 at 8:00 PM, christian.posta<christian.po...@gmail.com> > wrote: > > Yes, it is. Any reason why you want the content-types to be part of > > your fixtures? Why not let django build that u

Re: Integrity Error with generic relation using ContentType

2011-06-14 Thread christian.posta
Yes, it is. Any reason why you want the content-types to be part of your fixtures? Why not let django build that up by itself? On Jun 14, 1:21 am, Amit Sethi <amit.pureene...@gmail.com> wrote: > On Tue, Jun 14, 2011 at 1:41 AM, christian.posta<christian.po...@gmail.com> >

Re: Integrity Error with generic relation using ContentType

2011-06-13 Thread christian.posta
Are you using your own fixtures (like initial_data.json)? Is it possible that in your initial_data.json ( or whatever fixture you're using) that you're including entries into the content_types table? You should probably remove that from your fixtures and let django build the content types

Re: ImportError at /admin/

2011-06-13 Thread christian.posta
Looks like you may have literally just uncommented the line without replacing the {{project_name}} token with what your project name really is. Did you use django-admin.py startproject to create the project? After doing so, use manage.py startapp to create the app. See the django tutorial for

Re: Add custom html between two model fields in Django admin's change_form

2011-06-08 Thread christian.posta
mporte_contratado',) >         }), >     ) >     readonly_fields = ('id', 'name',) > > admin.site.register(Presupuesto, PresupuestoAdmin) > > On 7 jun, 11:11, "christian.posta" <christian.po...@gmail.com> wrote: > > > > > > > > > Create a

Re: Add custom html between two model fields in Django admin's change_form

2011-06-07 Thread christian.posta
Create a different ModelForm that contains your readonly fields (and populate them however you want) and set this on your ModelAdmin form. See the ModelAdmin.form option in the docs. https://docs.djangoproject.com/en/1.2/ref/contrib/admin/#modeladmin-options On Jun 7, 6:01 am, mf

Re: Users not logging out

2011-06-07 Thread christian.posta
so, is that what you wanted? sounds like when the user is done with the session, and they navigate away (by closing the browser or closing the tab which browser are you using btw, chrome?), then the session closes as is indicated by the SESSION_EXPIRE_AT_BROWSER_CLOSE setting. Isn't that what

Re: Passing parameters to form class

2011-05-31 Thread christian.posta
Yes, you will want to do this within the __init__ method. Run the super class's init method first so that everything's initialized as normal. Then you will have to grab the field for that instance within the __init__ method (self.fields['vaihtoehdot']) and set the choices property for it. On

django-profile redirect to user's profile

2011-05-11 Thread christian.posta
I'm trying to understand the best way to redirect a user to their profile once they successfully login to the application. I'm using django-profiles to manage a custom user profile. By default, the redirect url is specified in settings.py as LOGIN_REDIRECT_URL. However, the url entry in the

Re: Javascript frameworks with Django

2011-04-27 Thread christian.posta
I'm not sure I completely understand your question, but let me provide an answer and maybe that'll get us started on the right track. For the dynamic parts of the application, you could absolutely use django and view methods/classes to return json/xml or whatever data format you use. The data can

Re: How can I force a browser to cache my view?

2011-04-27 Thread christian.posta
Hi, You're trying to cache a pdf file/attachment? why? What's the purpose of trying to do it that way? Why don't you just send it to the client when they ask for it? Also, there's no way on the server to 'force' content to be cached on the client. The browser has to specifically allow it. All I

Re: Versioning an app and displaying in template

2011-04-03 Thread christian.posta
Thank you so much for the suggestion. I did find the python-svn bindings and came up with a fairly cogent solution. I blogged about it here: http://www.christianposta.com/blog/?p=74 On Apr 2, 8:53 pm, Aryeh Leib Taurog <v...@aryehleib.com> wrote: > On Apr 2, 1:42 am, "c

Versioning an app and displaying in template

2011-04-01 Thread christian.posta
I would like to get some feedback on how others display the version of their apps to the users of the app. I tag each build/version of the app in SVN when I deploy to my clients, but i'm trying to figure out a good way to report that tag name. I could manually try to put it into the settings.py

Re: help to finish my 1st Django app.

2011-03-14 Thread christian.posta
Your template file checks to see whether a variable named "latest_poll_list" exists. I don't see anywhere in your views where you add this to your context. Look at part 3 of the tutorial about half way down. They add the "latest_poll_list" object to the Context that gets passed to your template.

Re: Querysets: returning a single item with the greatest id.

2011-02-23 Thread christian.posta
Does latest()[0] work exactly as the original poster was looking for? latest() works based on a date field, not the pk field (which *could* return a result different than expected). Tom's approach, explicitly ordering by pk, would work exactly as desired. On Feb 23, 6:08 am, Mike Ramirez

Re: Facebook session problems.

2011-01-31 Thread christian.posta
Which session are you losing? The django authenticated session, or the facebook session? On Jan 29, 10:30 pm, CrabbyPete wrote: > I managed to log into facebook using the graph api, I store the FB id > and tie it to a User, like this > > class FacebookUser(models.Model): >  

When to use Form API

2010-12-08 Thread christian.posta
Do django developers use the Form API any time form elements need to be displayed to users? Or do you just code the form yourself in the templates and manually process them for smaller forms? In general, is it always better to use the Form API for any form you display, regardless how simple,

Displaying Profile model in a form

2010-10-26 Thread christian.posta
I am relatively new to django. I've been reading the docs endlessly and hacking to try to get something to work, but I'm hoping to not re- create functionality that either exists or is part of the framework. I have a class named UserProfile that I'd like to use to extend the User object. I set it