Translating tooltip key to tooltip text: use ugettext() and il8n?

2011-06-04 Thread Margie Roginski
I am trying to figure out if using the il8n stuff is the right approach for translating keyword names into multiline descriptions for use in ajax tooltips. The idea is I want to have a url that is like this: url(r'tooltip/(?P)/$', get_tooltip) Then in my get_tooltip() view method I'd have

Re: save out a test database?

2011-06-04 Thread Margie Roginski
from the web interface, but in reality, now that I am off and running writing tests, I guess I haven't ended up needing it after all ... In any case, thanks for your response. Margie On Jun 4, 5:47 am, Karen Tracey <kmtra...@gmail.com> wrote: > On Thu, Jun 2, 2011 at 10:04 AM, Margie

Re: save out a test database?

2011-06-02 Thread Margie Roginski
that there is no more standard way of dumping the database from inside a test so that the state can be replicated for use in a runserver environment. Margie On Jun 1, 2:01 pm, Kirill Spitsin <t...@0x746e.org.ua> wrote: > On Wed, Jun 01, 2011 at 11:59:28AM -0700, Margie Roginski wrote: > >

Re: save out a test database?

2011-06-01 Thread Margie Roginski
do I call from that point to create the mydata.json file that then gets loaded with the command django-admin.py testserver mydata.json Thanks! Margie On May 29, 7:28 pm, Jason Culverhouse <ja...@mischievous.org> wrote: > On May 29, 2011, at 7:13 PM, Margie Roginski <margierogin.

save out a test database?

2011-05-29 Thread Margie Roginski
Anyone know if there is a way to save out a test database that is created through the django TestCase module? IE, say I have a test that runs part way through. I'd like to save it out and then modify my settings.py to refer to the saved out test database and take a look at it via my web client

Re: Question about "Django 1.1 Testing and Debugging" Book for Karen

2011-04-29 Thread Margie Roginski
forward to learning from your book. Thanks! Margie On Apr 29, 4:40 am, Karen Tracey <kmtra...@gmail.com> wrote: > On Thu, Apr 28, 2011 at 6:18 PM, Margie Roginski > <margierogin...@yahoo.com>wrote: > > > > > I have a bit of time on my hands and was going to run t

Question about "Django 1.1 Testing and Debugging" Book for Karen

2011-04-28 Thread Margie Roginski
Hi Karen, I have a bit of time on my hands and was going to run through your book to cement my understanding of the best way to test. I started out and was immediately confronted with the fact that there seem to be some differences between django 1.1 and django 1.2 in terms of testing. At a

Intermediary model with many to many from model to itself not fully documented?

2011-04-06 Thread Margie Roginski
Hi developers - your review would be appreciated here! It seems to me, based on my experimentation, that if I have an intermediary model that has a many-to-many relationship from the model to itself, that the order of the two fields that point back to the model is important. For example: class

Re: How i can get username into the error mail?

2011-03-16 Thread Margie Roginski
I found the basics for this by googling around, and I can't remember where I got it, but thanks to whomever gave me the basics because it is very useful. Put this in your middleware and it will make the mail that you receive have the name of the user and their email: class

Re: How to use extra to count based on the value of a field?

2011-03-16 Thread Margie Roginski
call last) /home/mlevine/django/chipvision74/chip_vision_2/ in () AttributeError: 'Queue' object has no attribute 'num_tasks_closed' Margie On Mar 16, 9:13 am, Tom Evans <tevans...@googlemail.com> wrote: > On Wed, Mar 16, 2011 at 3:49 PM, Margie Roginski > > <margierogin...@ya

Re: How to use extra to count based on the value of a field?

2011-03-16 Thread Margie Roginski
Hmmm ... so I just got back to trying this and I actually don't think the annotate call as suggested does what I am looking for. Say I want to annotate queues with the number of closed tasks. This call: Queue.objects.filter(task__status=Task.STATUS_CLOSED).annotate(num_tasks=Count('task'))

Re: How to use extra to count based on the value of a field?

2011-03-15 Thread Margie Roginski
Ah, right - so obvious! I'm not sure why it didn't occur to me to filter first, then annotate. Thank you! On Mar 15, 2:43 am, Tom Evans <tevans...@googlemail.com> wrote: > On Mon, Mar 14, 2011 at 8:57 PM, Margie Roginski > > <margierogin...@yahoo.com> wrote: > &g

How to use extra to count based on the value of a field?

2011-03-14 Thread Margie Roginski
class Queue(models.Model): # fields here, not relevant for this discussion class Task(models.Mode): queue = models.ForeignKey("Queue") status = models.IntegerField(choices=STATUS_CHOICES) I am trying to create a Queue queryset that will annotate each Queue with the number of tasks whose

Re: how to get attribute of intermediary model?

2011-02-27 Thread Margie Roginski
Ah yes, that is *much* better. Thank you! Sorry for the delay, forgot to check back on this thread till now. Margie On Feb 17, 2:28 pm, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Thursday, February 17, 2011 10:06:40 PM UTC, Margie Roginski wrote: > > > Thanks for your

Re: how to get attribute of intermediary model?

2011-02-17 Thread Margie Roginski
membership info for a given group, but I'm guessing that my original solution is the appropriate solution for getting the join date for just a single person? Margie On Feb 16, 2:05 am, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Wednesday, February 16, 2011 12:36:49 AM UTC, Margie Rogin

how to get attribute of intermediary model?

2011-02-15 Thread Margie Roginski
Say I am using an intermediary model like that in the doc: class Person(models.Model): name = models.CharField(max_length=128) class Group(models.Model): name = models.CharField(max_length=128) members = models.ManyToManyField(Person, through='Membership') class

Bug when OR'ing an empty Q() with a non-empty Q()?

2011-01-03 Thread Margie Roginski
I find that if I filter by ORing an empty Q() with a non-empty Q() that I don't get the expected result. I would expect that this should return all objects of the specified model that the empty Q() would return. Let me use an example to be more clear: I have a single Task object with its name

Utility of select_related when rendering ForeignKeys in a form? [Developer eyes appreciated]

2010-12-13 Thread Margie Roginski
Could someone with some developer background take a look at my question below and let me know if my understanding is correct? Let's say I have a Task model that contains a foreign key to a User: class Task(models.Model) owner = models.ForeignKey('auth.User') Now let's say I have a ModelForm

SQL mystery with INNER JOIN?

2010-12-09 Thread Margie Roginski
I'm diving into the sql that is being generated by django and am having trouble understanding something. Could someone give me a hand? Say I have a Book class like this: class Book(models.Model): readers = models.ManyToMany('auth.user', blank=True, null=True) Let's say for a given book

How to remove an app and its tables

2010-11-05 Thread Margie Roginski
I've stopped using a particular app in my project. I've used South to remove its tables, but I still see those tables referenced by the auth, content_type, and django_project_version tables. Is this ok? Anyone know if it will cause me any problems down the line? Margie -- You received this

Re: How to get request.user when Django emails a 500 error report?

2010-11-05 Thread Margie Roginski
they show up in emails. > > Seehttp://gist.github.com/646372 > > You can modify that to add any info to the emails. > > Sidhttp://sidmitra.com > > On Oct 16, 3:20 am, Margie Roginski <margierogin...@yahoo.com> wrote: > > > I finally turned off DEBUG on my s

How do I associate a mime_type with a file?

2010-11-04 Thread Margie Roginski
Hi, I have an Attachment model that has a mime_type field. Here's my basic model: class Attachment(models.Model): id = models.AutoField(primary_key=True) comment=models.ForeignKey(Comment, null=True) file = models.FileField('File', upload_to=get_attachments_path) filename =

How to get request.user when Django emails a 500 error report?

2010-10-15 Thread Margie Roginski
I finally turned off DEBUG on my site and got set up so that the django code would email me the exceptions. This is ultra-cool! So I got m first one in the mail today, and was hard-pressed to figure out the user that ran into the error. I don't find request.user anywhere in the report. Do I

Re: what do you do to take your site down?

2010-08-06 Thread Margie Roginski
Thank you very much - that all makes perfect sense. Margie On Aug 6, 9:09 am, akaariai <akaar...@gmail.com> wrote: > On 6 elo, 18:36, Margie Roginski <margierogin...@yahoo.com> wrote: > > > Could anyone give me some pointers as to how you deal with taking your >

what do you do to take your site down?

2010-08-06 Thread Margie Roginski
Could anyone give me some pointers as to how you deal with taking your site down for maintenance? Is there some standard thing that people do to redirect all page requests to some sort of "Sorry, the site is down" page?Do you do this directly via apache or do you do it via django? I

Re: How to pass a GET param that contains multiple items

2010-07-12 Thread Margie Roginski
.GET.getlist('var') > > you will get: > > ['1', '2', '3'] > > Hope that helps, Euan > > On 10 July, 23:40, Margie Roginski <margierogin...@yahoo.com> wrote: > > > I have a url in my app that needs to get info from a GET param.  For > > example, let's say my ur

How to pass a GET param that contains multiple items

2010-07-10 Thread Margie Roginski
I have a url in my app that needs to get info from a GET param. For example, let's say my url is retrieving books by any of a set of authors, so the url might be this to get books authored by smith, johnson, or klein: www.example.com/books/?author=smith+johnson+klein I notice that when I look

Re: Is Django admin's "delete confirmation" considered RESTful?

2010-07-07 Thread Margie Roginski
to work properly. > > I'm not sure whether REST is designed for multi-step processes like > this. > > Euan > > On Jul 7, 4:10 pm, Margie Roginski <margierogin...@yahoo.com> wrote: > > > Actually, the confirmation page is not accessed via a GET.  Using the

Re: Is Django admin's "delete confirmation" considered RESTful?

2010-07-07 Thread Margie Roginski
uld be > using the DELETE verb. However, since some browsers don't support > DELETE and PUT, most web apps use just GET and POST. > > I'm not sure whether that answers your question, but hopefully clears > it up a bit. > > Euan > > On Jul 7, 2:49 am, Margie Roginski <margiero

Is Django admin's "delete confirmation" considered RESTful?

2010-07-06 Thread Margie Roginski
I have an app that is modeled after the django admin app. In general it seems to me that the admin app is RESTful. However, I am encountering a situation that is similar to the admin apps delete confirmation process, and I'm curious if anyone out there could comment on whether this particular

Re: How To Create POST data without an actual POST?

2010-06-29 Thread Margie Roginski
fields). Then it will fill in the data supplied by the user, then POST it back. This allows me to get all the same defaults that people see in their forms, and also leverage all of the form validation. So I think this will work well, thanks for all the input! Margie On Jun 28, 1:22 pm, Margie

How To Create POST data without an actual POST?

2010-06-28 Thread Margie Roginski
I'd like to find a way to let my users submit form data without submitting it via an actual web form. For example, I have users that would like to send their data via email, or perhaps provide it in an excel spread sheet, I'm trying to figure out how to do this and still leverage all the error

help with serving up mp4 with "nice" url

2010-06-04 Thread Margie Roginski
Hi, I am trying to serve up an mp4 video from my django app. I've generated the video using a tool called Camtasia, and it creates a set of files for me that all go in a single directory. I've put these down in my site_media directory with a directory structure like this:

Re: Filtering for an object that is modified in memory loses those modifications?

2010-04-23 Thread Margie Roginski
according to the > attribute values of the instance. > > Bill > > On Fri, Apr 23, 2010 at 3:15 PM, Margie Roginski > > > > <margierogin...@yahoo.com> wrote: > > I have a situation where I have a handle to a db object and I've > > modified a field in it.  The

Filtering for an object that is modified in memory loses those modifications?

2010-04-23 Thread Margie Roginski
I have a situation where I have a handle to a db object and I've modified a field in it. Then I later end up executing a filter that finds that same object (among others) and saves all of the objects it finds. In this situation the modified fields do not get saved out. It's like the filter is

Re: Forms with read only fields

2010-03-22 Thread Margie Roginski
I implement read-only fields by using widgets that render html that does not include any . For example, if I have a field called hobby in a Customer model, in my form I have something like this: self.fields["hobby"] = CharField(widget=DisplayHobbyField(customer), required=False)

Re: why is __exact filter really doing an inexact match?

2010-03-10 Thread Margie Roginski
Ah yes - I am using mysql. Thanks for that pointer. Margie On Mar 10, 1:34 pm, Karen Tracey wrote: > Are you using MySQL? See the note about MySQL here: > > http://docs.djangoproject.com/en/dev/ref/models/querysets/#exact > > Karen -- You received this message because you

why is __exact filter really doing an inexact match?

2010-03-10 Thread Margie Roginski
me: u'margie.rogin...@gmail.com' I thought this is supposed to be a case sensitive operation - am I missing something here? I'm running with the 1.1 final release. Thanks, Margie Roginski -- You received this message because you are subscribed to the Google Groups "Django users" gro

Re: debugging server code problems in server code that is invoked via ajax request

2010-02-25 Thread Margie Roginski
Hi - thanks for your responses. Was on vacation and forgot to check back on this thread. The idea of middleware is good. I'm not sure, however, if the views.py code generates an exception, that it can be caught by the middleware? I guess the question is how to catch exceptions. The views.py

Re: AJAX Autocompletion Field

2010-02-13 Thread Margie Roginski
Hi Jon, I have used this very successfully: http://loopj.com/2009/04/25/jquery-plugin-tokenizing-autocomplete-text-entry/ The demo is here: http://loopj.com/tokeninput/demo.html One thing that differentiates it from the jquery autocomplete package is that it allows you to specify multiple

debugging server code problems in server code that is invoked via ajax request

2010-02-11 Thread Margie Roginski
I have a question about debugging django server side code in the case where the request is an ajax request. For example I have an autocomplete widget. It makes a request to a particular url that takes me to one of my views.py functions, get_users(request). If I have some sort of error in that

Re: Ok to load many .js files to support lots of interactive widgets?

2010-01-14 Thread Margie Roginski
Thanks Daniel, I will look into Yahoo YSlow. Is there a particular tool/toolset that you have used/recommend for doing the combining? Margie On Jan 14, 2:37 pm, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Jan 14, 8:01 pm, Margie Roginski <margierogin...@yaho

Ok to load many .js files to support lots of interactive widgets?

2010-01-14 Thread Margie Roginski
As I've learned more about jquery/javascript, I've added more and more jquery interactive widgets to my app (which is sort of like a ticket tracking app). I'm wondering if having too many .js files is a bad thing (or a good thing)? Here's an example to make my question more understandable. I

Re: Order model objects by foreign key "set" count

2010-01-11 Thread Margie Roginski
. Thanks Scott! Margie On Jan 11, 7:51 pm, Scott Maher <sc...@thereceptor.net> wrote: > Margie Roginski wrote: > > Say I have a Reader model that has a foreign key to a Book > > > class Reader(models.Model): > >   book = models.ForeignKey(Book) > > > Now say

Order model objects by foreign key "set" count

2010-01-11 Thread Margie Roginski
Say I have a Reader model that has a foreign key to a Book class Reader(models.Model): book = models.ForeignKey(Book) Now say I want to find all books and order them by the number of readers. Is that possible, ie something like this? Book.objects.all().order_by(reader_set__count) This

Re: form.has_changed always true?

2010-01-06 Thread Margie Roginski
If you look at the form's _changed_data attribute, it will give you a list of the fields that have changed. That should tell you what is causing has_changed() to return True. Margie On Jan 6, 6:50 pm, Karen Tracey wrote: > On Wed, Jan 6, 2010 at 7:34 PM, Alastair Campbell

Re: Unhelpful template traceback

2010-01-04 Thread Margie Roginski
I had also noticed that errors from templates were quite hard to debug. Some time ago I saw this thread on on this group: http://groups.google.com/group/django-users/browse_thread/thread/ee29c542dcc0dc95/aaa3f89a2a77fa3f?lnk=gst=template_debug#aaa3f89a2a77fa3f I applied the very simple patch,

Business logic versus rendering code and how it affects OO code organization

2009-12-29 Thread Margie Roginski
Is it considered preferable to use tags to render html, versus using an object method? For example, in the admin app I see that the following tag is used like so: {% result_list cl %} cl is an object, and I'm wondering what is the advantage of creating result_list as a tag, rather than just

Re: Best way to handle class attribute as a space separated string?

2009-12-21 Thread Margie Roginski
, a, p = self.attrs.get('class'), self.attrs, self.pastClass > a['class'] = ' '.join([x for x in e and e.split(' ') or []] + [p]) > > Could fit the final version in with three tabs and it's only 79 chars! > > Kieran > > On Dec 22, 10:32 am, Margie Roginski <margierogin...@yahoo.com> w

Best way to handle class attribute as a space separated string?

2009-12-21 Thread Margie Roginski
I have a variety of places in my code where I add a class to a widget. For example, I have a render() function for a DateWidget that contains this code, which adds a special class if the date is in the past. if date < datetime.datetime.now(): if

Re: Pre-populating forms with foreign keys

2009-12-16 Thread Margie Roginski
I do something similar in my app. I display a whole bunch of posts to the user, and they can choose to reply to any one. In my case all the displayed posts are in a single form. Associated with each post is a reply button whose onclick handler makes a call to a jquery function I wrote called

Re: Using Forms to display and edit?

2009-12-15 Thread Margie Roginski
When I want to just display data in a form (as opposed to letting user edit it), I create a specialized widget. For example, I have a model that has multiple datetime fields, and I don't want the user to be able to edit them, but I do want to display their values. Here's a widget I use where you

Re: save_m2m() incorrectly ignoring exclude?

2009-12-04 Thread Margie Roginski
Ok, thanks Russell, I will do that. Just first wanted to confirm I wasn't missing something. Margie On Dec 3, 3:59 pm, Russell Keith-Magee <freakboy3...@gmail.com> wrote: > On Fri, Dec 4, 2009 at 6:23 AM, Margie Roginski > > > > <margierogin...@yahoo.com> wrote: &

save_m2m() incorrectly ignoring exclude?

2009-12-03 Thread Margie Roginski
In forms/models.py I see this: def save_m2m(): opts = instance._meta cleaned_data = form.cleaned_data for f in opts.many_to_many: if fields and f.name not in fields: continue if f.name in cleaned_data:

Re: How to get rid of anchor in url when rendering via render_to_response()

2009-12-01 Thread Margie Roginski
in your view > function, create a copy of the url with such stuff removed, easy to do > with python > string manipulations, or maybe just use reverse on the view function > itself, and pass > that as, say, form_action, and in your template use: > >     > On Tue, Dec

How to get rid of anchor in url when rendering via render_to_response()

2009-12-01 Thread Margie Roginski
I have a scenario where I have redirected the user to a particular url, something like: http://www.example.com/taskmanager/edit_task/5#comment_4 In other words, they are viewing a particular comment associated with task 5. This comment is say a page or two down (ie, scrolled down) from the top

Re: Best UI for letting users select an item from a large selection of records?

2009-11-27 Thread Margie Roginski
After much struggling on this same topic, I found that autocomplete was by far better than a dropdown or a set of chained dropdowns. I looked at a variety of jquery autocomplete packages, and eventually settled on this one, which has worked very well for me:

For DateField, render() gets date object in some cases, but unicode datestring in other

2009-11-25 Thread Margie Roginski
I have a TaskForm that contains a DateField. If I create my form from an instance of a Task, I find that when I render the DateField field, the value argument to render() is an actual datetime.date object. However, if I create my form from POST data, the value argument to render() is just a

help with EmailMultiAlternatives attach_file() or attach()

2009-11-09 Thread Margie Roginski
I asked a question earlier about trying to send an outlook message as an attachment, but didn't get a response. I'm so confused ... so I'm going to see if I can some up with a simpler question. I've have a file called 'foo.mht' that begins like this: Content-Type: message/rfc822

how to send an rfc822 email attachment

2009-11-09 Thread Margie Roginski
I am trying to write some add code to my app that accepts an email from the user that contains attachments, adds those attachments to the database and then sends an email containing those attachments. I am trying to get my code to work for the case were the attachment is an outlook mail (ie, an

Re: Original path associated with an InMemoryUploadedFile

2009-11-05 Thread Margie Roginski
Yeah, that makes sense. Thanks! Margie On Nov 5, 5:21 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Thu, Nov 5, 2009 at 6:53 PM, Margie Roginski > <margierogin...@yahoo.com>wrote: > > > > > > > In my app, my user inputs one more more atta

Original path associated with an InMemoryUploadedFile

2009-11-05 Thread Margie Roginski
In my app, my user inputs one more more attachments and on the server side I am successfully getting them via code like this: for file in request.FILES.getlist('attachment'): a = Attachment( filename = filename,

Re: how to cut and paste image into django app

2009-10-23 Thread Margie Roginski
desktop.html > > On 24 окт, 03:22, Margie Roginski <margierogin...@yahoo.com> wrote: > > > Thanks everyone for all of your comments - I've been off looking at > > these various choices, learning a bit about java/flash this morning. > > I was not able to gethttp://www.radink

Re: how to cut and paste image into django app

2009-10-23 Thread Margie Roginski
Thanks everyone for all of your comments - I've been off looking at these various choices, learning a bit about java/flash this morning. I was not able to get http://www.radinks.com/upload/dnd.php to work. It seems that even with the demo I have access privilege issues. Ariel, when you run the

how to cut and paste image into django app

2009-10-22 Thread Margie Roginski
I have a django app that uses Eric Florenzano's threadedcomments app to allow my users to comment on issues. My users are asking for the ability to cut and paste images into their comments. They want to use an windows app called mwsnap to basically snap images from their desktop, then ctrl-v to

Re: Developer help appreciated: unicode() not returning SafeString correctly - possibly a bug?

2009-10-15 Thread Margie Roginski
response, that clarified a lot. Margie On Oct 14, 10:21 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Wed, Oct 14, 2009 at 6:25 PM, Margie Roginski > <margierogin...@yahoo.com>wrote: > > > > > Eventually I end up in the force_unicode() function at code that looks

Developer help appreciated: unicode() not returning SafeString correctly - possibly a bug?

2009-10-14 Thread Margie Roginski
I am seeing some odd behavior related to the django.utils.safestring.SafeString class. What I see is that if my render function returns a SafeString, the "safeness" of it is lost and its tags end up getting escaped. I've looked at this in detail in pdb and I think the issue is in

how to return ajax info in one case, and redirect to a different url in another?

2009-09-15 Thread Margie Roginski
I have a situation where the user fills in a form and hits submit to post the form. If my views.py code detects an error in the form, I want to return some info to the client and put it into the dom via jquery. If there is no error, I want to redirect to another page. Can anyone advise me on

redirect after post caches anchor?

2009-09-12 Thread Margie Roginski
I'm seeing some strange behavior related to anchors that I can't really explain. I'm going to give an example of what I'm seeing and I'm hoping that someone can point me in the right direction. Let's say I do a post and my views.py code that services the post returns like this: return

how to deploy an app that gets used by people in multiple time zones

2009-09-03 Thread Margie Roginski
I've created a django app and I soon am going to have users that are in multiple timezones. My app is a task management system and it is important for users to see dates and times with respect to their own time zone. IE, if here in California I create a task at 3PM on Sept 3, I want someone in

how to identified what changed in an instance due to save of a ModelForm?

2009-08-26 Thread Margie Roginski
Let's say I have a model and an associated ModelForm and am doing the typical save of the ModelForm to modify the instance. I'd like to generate a report that identifies what fields were changed and what the old and new values were. I initially did this by doing a deepcopy of my instance, then

how to return an html snippet using ajax $.post()?

2009-08-20 Thread Margie Roginski
Could someone give me a hand with a very simple ajax problem? I want to post some data and have the server just return a small snippet of html, which I then want to insert into my dom at a particular id. Let's say the html snippet to be returned is just a string: hello world. Does my views.py

explanation of: {{ action.action_time|date:_("DATETIME_FORMAT") }}

2009-08-18 Thread Margie Roginski
I was trying to figure out how to run the date filter, using SETTINGS.DATETIME_FORMAT as an argument. When I grepped in the admin app I found this in object_history.html: {{ action.action_time|date:_("DATETIME_FORMAT") }} Can anyone give me a pointer as to how this works? What is '_' in this

Success at using "reusable apps"?

2009-08-16 Thread Margie Roginski
I have a general question about how people manage "reusable apps" in the web app world. Let me give an example of what I am encountering, maybe those of you with experience can comment. I'm developing an app that is a task management app. IE, an engineering manger creates tasks, spawns them