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 off
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 c
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 f
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 s
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 I
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 Ht
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 the
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 force_unicode()
ebugging and not
have the added complexity of the template.
Ok, thanks for your response, that clarified a lot.
Margie
On Oct 14, 10:21 pm, Karen Tracey wrote:
> On Wed, Oct 14, 2009 at 6:25 PM, Margie Roginski
> wrote:
>
>
>
> > Eventually I end up in the force_unicode(
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
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 dem
ng this clear.
>
> Here is the example of drag-n-drop images upload:
>
> http://www.appelsiini.net/2009/10/drag-and-drop-file-upload-with-goog...
>
> And here is the corresponding API documentation:
>
> http://code.google.com/intl/ru/apis/gears/api_desktop.html
>
&g
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,
m
Yeah, that makes sense. Thanks!
Margie
On Nov 5, 5:21 pm, Karen Tracey wrote:
> On Thu, Nov 5, 2009 at 6:53 PM, Margie Roginski
> wrote:
>
>
>
>
>
> > In my app, my user inputs one more more attachments and on the server
> > side I am successfull
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 r
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
Content-Transf
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 unicod
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:
http://loopj.com/2009/04/25/jquery-plu
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 o
n, 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 1, 2009 at 3:38 PM, Margie Rog
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:
f.save_form_
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 wrote:
> On Fri, Dec 4, 2009 at 6:23 AM, Margie Roginski
>
>
>
> wrote:
> > In forms/models.py I see this:
>
> >
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
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 addR
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 self.attrs.get(
o lines:
> e, 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
>
&
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 get
attribute values of the instance.
>
> Bill
>
> On Fri, Apr 23, 2010 at 3:15 PM, Margie Roginski
>
>
>
> wrote:
> > 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
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:
site_media/img/help/
web server. But why don't you make your own view/template on
> the url you want that will play the desired video? You can use the
> HTML file generated by camtasia for a reference on how to write the
> template.
>
> On Sat, Jun 5, 2010 at 2:59 AM, Margie Roginski
>
> wrote
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
che
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
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 par
hould 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 Rogin
m not sure whether REST is designed for multi-step processes like
> this.
>
> Euan
>
> On Jul 7, 4:10 pm, Margie Roginski wrote:
>
> > Actually, the confirmation page is not accessed via a GET. Using the
> > admin's auth model as an example: the user does a GET t
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 at
st('var')
>
> you will get:
>
> ['1', '2', '3']
>
> Hope that helps, Euan
>
> On 10 July, 23:40, Margie Roginski wrote:
>
> > I have a url in my app that needs to get info from a GET param. For
> > example, l
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 additiona
Thank you very much - that all makes perfect sense.
Margie
On Aug 6, 9:09 am, akaariai wrote:
> On 6 elo, 18:36, Margie Roginski wrote:
>
> > Could anyone give me some pointers as to how you deal with taking your
> > site down for maintenance? Is there some standard thing
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 nee
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 = models
; 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 wrote:
>
> > I finally turned off DEBUG on my site and got set up so that the
> > django code would email me th
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 m
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 objec
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 usi
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&q=template_debug#aaa3f89a2a77fa3f
I applied the very simple patch,
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 wrote:
> > Hi everyo
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 synta
hat documentation link describes it very well. Thanks Scott!
Margie
On Jan 11, 7:51 pm, Scott Maher 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)
&
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 hav
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 wrote:
> On Jan 14, 8:01 pm, Margie Roginski wrote:
>
>
>
> > As I've learned more about
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 fu
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 sele
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 co
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
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 are subscribed to th
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)
DisplayHobbyFie
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 minim
ork much, so I am looking forward to
learning from your book.
Thanks!
Margie
On Apr 29, 4:40 am, Karen Tracey wrote:
> On Thu, Apr 28, 2011 at 6:18 PM, Margie Roginski
> wrote:
>
>
>
> > I have a bit of time on my hands and was going to run through your
> > book to
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 (
, but what 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 wrote:
> On May 29, 2011, at 7:13 PM, Margie Roginski wrote:
>
> > Anyone kno
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 wrote:
> On Wed, Jun 01, 2011 at 11:59:28AM -0700, Margie Roginski wrote:
> > That's a good pointer, th
test 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 wrote:
> On Thu, Jun 2, 2011 at 10:04 AM, Margie Roginski
> wr
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 some
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
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 se
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 Membership(models.Mod
easy to get all 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 wrote:
> On Wednesday, February 16, 2011 12:36:49 AM UTC, Margie Roginski wrot
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 wrote:
> On Thursday, February 17, 2011 10:06:40 PM UTC, Margie Roginski wrote:
>
> > Thanks for your reply, Daniel. I didn'
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 que
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 wrote:
> On Mon, Mar 14, 2011 at 8:57 PM, Margie Roginski
>
> wrote:
> > class Queue(models.Model):
> > # fields here, n
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'))
finds
aceback (most recent 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 wrote:
> On Wed, Mar 16, 2011 at 3:49 PM, Margie Roginski
>
> wrote:
>
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 ExceptionUserInfoMiddle
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 T
75 matches
Mail list logo