Re: How to hide the password of postgresql in settings.py

2018-11-30 Thread ljh . holmes
I typically create a second file which stores my sensitive data and import it as a variable. Then can exclude say.. credentials.py when sharing code. I don't know that this is an ideal solution, just something that I've taken as habit. On Friday, November 30, 2018 at 11:51:44 AM UTC-6,

Re: Send E-mail to User When Account is Activated though Django Admin Application

2018-11-19 Thread ljh . holmes
I've done this recently by importing smtplib into my views.py file, and made executing a mail send a result of a view. I didn't realize at the time, but there is Django specific tools for this as well. https://docs.djangoproject.com/en/2.1/topics/email/ On Monday, November 19, 2018 at

Re: NoReverseMatch

2017-04-28 Thread Will Holmes
Hey, Traceback: == ERROR: test_event_view (cal.tests.EventsTestCase) -- Traceback (most recent call last): File

NoReverseMatch

2017-04-28 Thread Will Holmes
Hey all, Can anyone tell me the (probably quite obvious) reason my reverse match isn't working? Template: Url: url(r'^events/(\d+)/delete_event$', views.delete_event, name='delete_event'), View: def delete_event(request, id): Events.objects.filter(id=id).delete() return

Re: Using Django with groupby

2017-04-21 Thread Will Holmes
in return_dict: return_dict[event.start_date.day].append(event) else: return_dict[event.start_date.day] = [event] return return_dict On Thursday, April 20, 2017 at 4:35:36 PM UTC+1, Will Holmes wrote: > > Hi guys, > > > I

Using Django with groupby

2017-04-20 Thread Will Holmes
Hi guys, I am using django to develop a calendar web app where users can create events that are then displayed on a month by month view. I have written a custom template tag that takes Python's HTMLCalendar formatmonth function and overlays events that are on that day. It is currently

Re: NoReverseMatch when trying to use get_absolute_url with custom template tag

2017-03-30 Thread Will Holmes
Oh yeah i see. Brilliant sorted it! Thanks for your help Melvyn. -- 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+unsubscr...@googlegroups.com. To

NoReverseMatch when trying to use get_absolute_url with custom template tag

2017-03-29 Thread Will Holmes
I am making a calendar app which has a custom template tag that takes the python HTML template function and overlays objects from the Events model on the correct days. I am trying to get the displayed objects to have a link directly to an object detail/edit view and am trying to use

Re: A migration in one app that adds a field to another

2014-11-08 Thread jMyles Holmes
/1150 On Tue, Nov 4, 2014 at 4:54 PM, Justin Myles Holmes <twotonespi...@gmail.com> wrote: > Carl: > > Actually, the "subclass the operation" method fails for obvious reasons > here: > > https://github.com/django/django/blob/df0523debcc2d0984f1bc11d323f04227d4

Re: A migration in one app that adds a field to another

2014-11-04 Thread Justin Myles Holmes
ezzanine's migration is the simplest solution. I sense that I'm going to face some resistance if I suggest changing their docs to reflect this. I'll start with a blog post. On 11/04/2014 04:30 PM, Justin Myles Holmes wrote: > Well, as I say, I don't particularly like this field injection noti

Re: A migration in one app that adds a field to another

2014-11-04 Thread Justin Myles Holmes
ng models in your > project, you're not going to be able to use anything makemigrations > outputs and expect it to Just Work™. > > Andrew > > On Tuesday, November 4, 2014 3:59:23 PM UTC-8, Carl Meyer wrote: > > Hi Justin, > > On 11/04/2014 04:42 PM, Justin

Re: A migration in one app that adds a field to another

2014-11-04 Thread Justin Myles Holmes
urpose and document how to import and use it in a migration? Well, the problem there is that Operation isn't used directly, but subclassed for each individual type of migration operation. On 11/04/2014 03:33 PM, Carl Meyer wrote: > Hi Justin, > > On 11/04/2014 04:17 PM, Justin Myl

Re: A migration in one app that adds a field to another

2014-11-04 Thread Justin Myles Holmes
urpose and document how to import and use it in a migration? On 11/04/2014 03:33 PM, Carl Meyer wrote: > Hi Justin, > > On 11/04/2014 04:17 PM, Justin Myles Holmes wrote: >> Hey Carl. Missed you so very much at DjangoCon. :-) > Thanks :-) > >>> I'm no

Re: A migration in one app that adds a field to another

2014-11-04 Thread Justin Myles Holmes
11/01/2014 04:35 PM, jMyles Holmes wrote: >> Using Django 1.7, how can the user perform a migration operation (say, >> AddField) on an app other than the app in which the migration lives? >> >> Here's the use case: >> >> Mezzanine lets you inject fields

A migration in one app that adds a field to another

2014-11-01 Thread jMyles Holmes
Hey friends! Using Django 1.7, how can the user perform a migration operation (say, AddField) on an app other than the app in which the migration lives? Here's the use case: Mezzanine lets you inject fields on its own stock models using the EXTRA_MODEL_FIELDS setting. However, as the Mezzanine

Re: ORM Question

2014-04-02 Thread Justin Holmes
t; > On Wed, Apr 2, 2014 at 12:04 PM, Justin Holmes <jus...@justinholmes.com>wrote: > >> No no, the annotate doesn't work - that's the whole reason for my >> question. See, the annotate doesn't associate instances with the annotated >> attribute, it associated results.

Re: ORM Question

2014-04-02 Thread Justin Holmes
fixed, your original > annotate might work. > > > On Tue, Apr 1, 2014 at 6:20 PM, Justin Holmes <jus...@justinholmes.com>wrote: > >> You say "use the reverse relation manager in LlamaHerd to build up your >> annotation," but that answer the question. >>

Re: ORM Question

2014-04-01 Thread Justin Holmes
You say "use the reverse relation manager in LlamaHerd to build up your annotation," but that answer the question. How can I sort LlamaHerd objects by the DOB of their largest llama? On Tue, Apr 1, 2014 at 6:13 PM, Justin Holmes <jus...@justinholmes.com>wrote: > Yes, abso

Re: ORM Question

2014-04-01 Thread Justin Holmes
Tue, Apr 1, 2014 at 6:09 PM, Bill Freeman <ke1g...@gmail.com> wrote: > Aren't you missing a ForeignKey relationship to tell which LlamaHerd a > Llama belongs to? > > Then you would use the reverse relation manager in LlamaHerd to build up > your annotation. > > > On Tu

ORM Question

2014-04-01 Thread Justin Holmes
might be able to use annotate: LlamaHerd.annotate(largest_llama=Max('llama__size')).order_by('largest_llama__dob') ...but the annotate here creates fields with float values, not with the model instances. -- Justin Holmes Chief Chocobo Breeder, slashRoot slashRoot: Coffee House and Tech Dojo New

Re: Http404 and process_exception

2012-03-30 Thread Justin Holmes
ary at all, as the Http404 page makes it clear that it's an exception. On Wed, Mar 28, 2012 at 7:22 PM, Russell Keith-Magee <russ...@keith-magee.com> wrote: > > > On 29/03/2012, at 12:10 AM, Justin Holmes wrote: > > > Russell, > > > > Thanks for the reply. > >

Re: Http404 and process_exception

2012-03-28 Thread Justin Holmes
that I simply hadn't raised Http404 since implementing this middleware. It makes perfect sense that it behaves the way it does. On Tue, Mar 27, 2012 at 11:29 PM, Russell Keith-Magee < russ...@keith-magee.com> wrote: > > On 28/03/2012, at 6:31 AM, Justin Holmes wrote: > > &

Http404 and process_exception

2012-03-27 Thread Justin Holmes
Heretofore, I had always believed that Http404 did not cause Middleware process_exception() to be run. Am I right in this thinking? I have a get_object_or_404 that, when the object in question isn't found, is running process_exception. -- Justin Holmes Head Instructor, SlashRoot Collective

Re: New way to run your Django projects

2012-03-18 Thread Justin Holmes
quot; group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to django-users+unsubscribe@** > googlegroups.com <django-users%2bunsubscr...@googlegroups.com>. > For more options, visit this group at http://groups.g

django-deeper

2011-12-28 Thread Justin Holmes
n this direction. http://groups.google.com/group/django-deeper -- Justin Holmes Head Instructor, SlashRoot Collective SlashRoot: Coffee House and Tech Dojo 60 Main Street New Paltz, NY 12561 845.633.8330 -- You received this message because you are subscribed to the Google Groups "Django users" g

contrib.auth tests - not respecting TEMPLATE_DIRS?

2011-10-10 Thread Justin Holmes
specified in the TEMPLATE_DIRS setting. The same code is executed just fine in production. -- Justin Holmes Head Instructor, SlashRoot Collective SlashRoot: Coffee House and Tech Dojo 60 Main Street New Paltz, NY 12561 845.633.8330 -- You received this message because you are subscribed to

test_invalid_key failing

2011-10-04 Thread Justin Holmes
I am having a problem with contrib.sessions.tests.test_valid_key (line 159). It's a mixin which in the failure case is mixed with CacheDBSessionTests. The test raises: "AttributeError: 'bool' object has no attribute 'get'" The error is actually raised by session.save() on 164. Stepping inward

Re: Create socket server in django

2011-09-20 Thread Preston Holmes
On Sep 20, 12:07 am, Micke wrote: > Thank you for your quick reply! > > My socket server is ready, but I dont know where to import it in > django so it starts when django starts? You are going to run your socket server in a different python process than Django.

Re: Virtualenv and Django in Production

2011-09-20 Thread Preston Holmes
How you use a virtualenv in production depends on all the parts of your production stack. If you are using mod_wsgi, search mod_wsgi + virtualenv, gunicorn, etc You might also consider one of the new "platform-as-a-service" hosting options that basically solve this for you. -P On Sep 19, 10:55 

django-packagemaker a paster tool for making reusable apps

2011-03-30 Thread Preston Holmes
I've just pushed an initial release of a tool that will hopefully make it easier to make apps more easily shareable. The idea is something like this: manage.py startapp gets you a start, but once you get something to the point where you might want to share it, now you've got to wrap it up in all

representing a possible future object in a form?

2010-11-15 Thread Preston Holmes
This is a cart/horse pattern I run now and then, and while I can think of several sort of ugly ways to do it, I'm wondering if someone has a clean solution in Django. I'm going to use a gradebook as an example. The goal is to present a user with a grid of lets say students and assignments to

Nesting related object in formset

2010-10-13 Thread Preston Holmes
I'm pretty comfortable with the concept of mixing multiple objects in one form. But I have a case where I have a model formset and want to add a form field that represents a field from a related model, such that the related model can be created if it is filled out. As a simple example: I have a

Re: Mutli-column composite keys

2010-09-20 Thread Preston Holmes
On Sep 19, 1:50 pm, "J. P. Smyth" wrote: > Someone here wrote: > > "Mutli-column composite keys are not currently supported by Django. > Adding support for multi-column keys (primary or otherwise) is > something that has been long discussed, and there is

Re: Tying a model to a specific database using the model's meta data?

2010-09-18 Thread Preston Holmes
On Friday, September 17, 2010, Stodge wrote: > I have a bunch of models and I want to specify which models (tables) > are stored on which PostgreSQL database. I've read the documentation > and I know I can use the using() function. I'm just wondering this > can't be specified in

Re: Filter for non-True NullBooleanField

2010-09-11 Thread Preston Holmes
On Sep 10, 2:43 pm, Christos Jonathan Hayward wrote: > P.S. Setting: > > .filter(is_invisible__in = [False, None]) how about: .exclude(is_invisible__exact = True) > > is not working as intended; I seem to be getting no matches when I should be > getting

Re: django-simple-freinds: template tags and Friendship request

2010-09-09 Thread Preston Holmes
On Sep 9, 5:11 am, justin jools wrote: > Hi Muhuk, > > I am using django-simple-friends app, much easier to setup than django- > friends. > but need a little help and was hoping for some guidance. > > I have set up friends_list.html no problem: >  Friend List > Friends

Re: upload_to vs FileSystemStorage

2010-09-09 Thread Preston Holmes
On Sep 8, 5:04 am, Dave wrote: > Hi everyone, > > I've found in documentation usage of custom file storage. There it is > like that > (http://docs.djangoproject.com/en/1.2/topics/files/#the-built-in-files... > ) - > > from django.db import models > from

Re: PayPAL-IPN-request doesn't call the view

2010-09-09 Thread Preston Holmes
On Sep 8, 11:47 pm, Max_ wrote: > Hello, > I created a website, using the IPN-Function. > Everything worked fine at first - the notification view was called and > the signal was sent. > But now (without any changes on the code), the IPN-Request from PayPAL > doesn't call the

Re: Advice needed on bundling applications

2010-09-07 Thread Preston Holmes
On Sep 7, 1:45 am, Benedict Verheyen wrote: > Hi, > > i've written a calltracking application for my company and other apps will > follow soon. > Now, i would want a central way to access them and to assign rights on who > can see > and run what application. > The

Re: Generate a daily serial/batch/lot number

2010-09-06 Thread Preston Holmes
On Sep 6, 2:39 am, kmpm wrote: > First of all to everyone, thanks for all good suggestions so far. > > Regarding UUIDs, one of the business requirements (which I don't > control) is that the identifier that is to be used on barcodes and > what not is to be in the format

Re: Chat application in Django

2010-09-04 Thread Preston Holmes
On Aug 31, 4:31 am, Shamail Tayyab wrote: > Hi, > >    I am working on a chat application in Django, how can I ensure that I > do not have to poll the server for any chat data. > > Possible approaches that I've been to: > > 1. BAD - use polling. > > 2. Use long polling -

choices based on existing entries

2010-05-11 Thread Preston Holmes
Filemaker has a pattern where you can set the choices of a field to be the indexed contents of that field. Along with an "Other..." choice option to add a new value. This is a very handy way of having user modified choices for a given field. Now I can think of several ways to do this in a form

permissions like widget to add users to groups

2010-04-27 Thread Preston Holmes
Has anyone adapted the interfaced used for adding permissions to a group/user to allow one to add users to a group? How reusable is the CSS/JS? -Preston -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: How to use CommaSeperatedIntegerList with CheckboxSelectMultiple

2010-04-26 Thread Preston Holmes
On Apr 26, 2:28 am, Kevin Renskers wrote: > I also used the multiple select field found > onhttp://www.djangosnippets.org/snippets/1200/ > with success, until I updated Django to the 1.2 beta release. It now > longer works, always giving the validation error. I have no clue

Re: Disabling Messaging

2010-03-23 Thread Preston Holmes
On Mar 23, 8:20 am, jrs wrote: > Is there a flag somewhere which will allow me to disable django > messaging? > > Thanks You give too few details. The messaging system is something that is opt in, you have to create messages, and then display them in your template. Are

Re: how can i use manage.py as a command in script file

2010-03-16 Thread Preston Holmes
On Mar 15, 10:27 pm, pyleaf wrote: > I want to use manage.py as a command in script file. > e.g, > > >> python manage.py shell > >>from testproject.testapp.models import Testee > >>from testproject.others.modules import utils > >>utils.do(Testee) > > Above are commands in

Re: A bit of a modeling question

2010-03-16 Thread Preston Holmes
On Mar 16, 3:21 am, ALJ wrote: > This is a bit of a modeling question that I am struggling to get my > head around. How would you model this scenario? > > I have to record expenses that are of 3 different types. > > 1. Fixed - The name of the expense and unit amount

Re: dynamically excluding fields in admin form

2010-02-28 Thread Preston Holmes
On Feb 28, 12:21 pm, Simon Davies wrote: > figured out how to do it using the get_form method like this: > > class AccessoryStockOrderAdmin(admin.ModelAdmin): >     form = AccessoryStockOrderForm >     def get_form(self, request, obj=None, **kwargs): >         form =

Re: Creating new Thread in a view?

2010-02-18 Thread Preston Holmes
On Feb 17, 9:36 am, justind wrote: > I have an unusual Django application. I was wondering if someone could > offer advice to the best way to handle a requirement. This isn't a > standard application (and might not even seem like a good use of > Django, but that's

Re: Single Login for two different applications?

2010-02-09 Thread Preston Holmes
On Feb 9, 3:43 am, djangonoob wrote: > Hello, > > I have the following problem which I hope someone could shed some > light on. > > In my project I have the main site with login. I now implemented a > questionnaire app  that also requires a login. It would be great if >

Re: entering scores (one model) for a list of students (another model)

2010-02-05 Thread Preston Holmes
Assuming you want to create a score per class - you should have students go to a form that: creates a student and first score if student does not already exist creates a score for the student for that class and date Basically the students should be creating the 'blank' scores when they come in.

Re: How to customize form styled by django-uni-form?

2009-12-15 Thread Preston Holmes
On Dec 15, 12:02 pm, Continuation wrote: > This is a question about django-uni-form. But I figure many people > here may have experienced with django-uni-form so I'd try asking here. > > I'm using django-uni-form to style my form using the filter my_form| > as_uni_form:

aggregation puzzle

2009-12-12 Thread Preston Holmes
I've hit a case where I want to use aggregation, but I think I'll have to end up using a for loop. I have items. They have an estimated cost and an actual cost They may have one, the other, or both defined. They are both DecimalFields I can get the sum of the estimated cost with a simple

Re: Should empty formsets call their own clean method?

2009-12-11 Thread Preston Holmes
Well something wonky is going on. >From my readthrough of the code, it *should* get called on empty formsets: is_valid calls total_form_count to get a loop count total_form_count should be positive even if forms are blank is_valid then accesses form.errors inside that loop

Re: How to execute linux command in django view

2009-12-11 Thread Preston Holmes
On Dec 11, 10:40 am, Kashif Azeem wrote: > Thank you Shawn for the reply now i have another problem i.e. on executing > some commands like 'vgs' or 'lvs' it didnt executed and the warning > generated as "Running as a non-root user. Functionality may be unavailable". > Any

Re: many permission sets for same user

2009-12-11 Thread Preston Holmes
On Dec 10, 8:41 am, Adonis wrote: > Hi, > > I am trying to figure out the best way to do this. > I have built a django application where users are members in projects. > Thus, i need to assign users different permission sets that correspond > to different projects. The

Re: Issue with Django form when submitted using jQuery form plugin

2009-12-11 Thread Preston Holmes
On Dec 10, 11:02 am, jul wrote: > hi, > > when submitting my form using jQuery form plugin, the request received > by the target view is different than that received when the form is > submitted in the standard way (with no javascript), and my Django > template does not render

Re: Raise error based on both form and inline_formset

2009-12-11 Thread Preston Holmes
On Dec 10, 9:05 am, cerberos wrote: > I'm building a library system and have models Member, Loan and > LoanItem (relationships as you'd expect), and an inline formset to > enter a new loan (Loan and LoanItems). > > A member can borrow up to 6 books at a time, so my form

Re: Separate views for form display and handling

2009-12-11 Thread Preston Holmes
On Dec 11, 5:20 am, Aaron wrote: > On Dec 10, 6:04 pm, aa56280 wrote: > > > if form.is_valid(): > >   # do something and redirect > > else: > >   render_to_response('foo.html', {'form' : form'}) > > Would that leave the URL as displayed in the browser

making RequestContext the default context_instance

2009-12-10 Thread Preston Holmes
Is there a way to make this the default at the project level? I see a number of tricks out there for making it easier to do within your own views, but I'm using an auth check in django-navbar, so I need the full context on every page, and not all reusable apps I'm using are passing the

Re: model design problem

2009-12-07 Thread Preston Holmes
On Dec 7, 8:56 am, Daniel Goertzen wrote: > Thanks for the reply Bill.  The problem I had with that approach is that > after creating the product I have to worry about creating red and green > ports.  Likewise, upon deletion, I have to mop up the ports.  Looking >

Re: How to get timeuntil tag to display minutes?

2009-12-05 Thread Preston Holmes
Not simply. The design of the tag to drop smaller time frames the further out you are. The source is all there for you to copy and modify into your own custom filter, but that may be more than you want to bother with... -Preston On Dec 4, 3:22 pm, Continuation wrote:

Re: What apps do besides provide views?

2009-12-05 Thread Preston Holmes
On Dec 3, 12:02 pm, Wayne Koorts wrote: > >> > remember that an app can do a lot more than provide views. > > >> Explain this one to me.  AFAICS, its just http request/response all the > >> way down and this is basically done by getting a > > > An app can expose views,

Re: Where to store repetitive form logic?

2009-12-05 Thread Preston Holmes
On Dec 4, 6:43 pm, jwpeddle wrote: > Not having any luck with this. Surely there's a simple example out > there somewhere of view agnostic DRY form logic. The old thread you point to still makes sense. A redirect can only happen in response to a request a request is

Re: What exactly does order_with_respect_to do?

2009-11-30 Thread Preston Holmes
On Nov 29, 4:50 pm, Continuation wrote: > In the doc (http://docs.djangoproject.com/en/dev/ref/models/options/ > #order-with-respect-to) it is mentioned that  order_with_respect_to > marks an object as "orderable" with respect to a given field. > > What exactly does

Re: streaming response, missing something simple

2009-11-29 Thread Preston Holmes
On Nov 28, 11:07 pm, Preston Holmes <pres...@ptone.com> wrote: > My expectation was that it was possible to 'stream' a response back to > a browser from a view, where that response is 'trickled' onto the > browser page.  I had done this a while back in cherrypy and it worke

streaming response, missing something simple

2009-11-28 Thread Preston Holmes
My expectation was that it was possible to 'stream' a response back to a browser from a view, where that response is 'trickled' onto the browser page. I had done this a while back in cherrypy and it worked as expected. a super simple view demonstrates the issue. Instead of a series of numbers

Re: Accessing model instance on pre_save signal

2009-11-25 Thread Preston Holmes
I'm a bit confused on a few points here. The upload_to field attribute should be atomic to the imagefield - it doesn't rely on related models. your change_upload_to creates a new screenshot - but doesn't connect it to the current WebProject instance. Is that what you are trying to do? s =

Re: Alternative model without Database

2009-11-24 Thread Preston Holmes
On Nov 24, 1:28 am, Elyrwen wrote: > Hello, > > I' ve been recently interested in Djagno framework and I am at the > point of choosing it as the framework for my project. My application > will not use database, but will use webservices to get data and then > process it.

Re: Filtering using several parameters

2009-11-23 Thread Preston Holmes
On Nov 23, 8:51 am, Aizen wrote: > Hi, > > I'd like to implement filtering for my app...currently, the filtering > I have is stateless and so I can't add onto whatever value the user > last selected.  I've also implemented each filter separately, so I'd > like to know how

Re: Model inheritance - filtering base model only

2009-11-22 Thread Preston Holmes
Perhaps there is a more efficient way, but in my quick test, one can't filter() a queryset based on __class__ of the model, but seems one can manually filter it afterwords: qs = Player.objects.all() for i,obj in enumerate(qs): if obj.__class__ != Player: del(qs[i]) On Nov 22, 4:32 

Re: Question on how to update an existing record when using ModelForm

2009-11-22 Thread Preston Holmes
On Nov 22, 4:47 pm, Micah Vivion wrote: > Greetings, > > I have a question on how to update an existing row in my database when one of > the fields is my primary key. I am using ModelForm and Django-Piston - my > main goal here is to have RESTful Post send to my

Re: Automatic swapping of field data?

2009-11-19 Thread Preston Holmes
There are some details left out of how you want this to look. The lower the level you try to make an object self protecting, the trickier it's going to be. The sweet spot I think here is a custom manager that adds a protect filter, and perhaps a subclass of ModelForm if you need this in forms.

Re: @login_required decorator sends me to the wrong URL

2009-11-19 Thread Preston Holmes
http://docs.djangoproject.com/en/1.1/ref/settings/#login-url There are going to be some other places you will have to be careful running django on a path other than / -Preston On Nov 19, 7:11 am, Stodge wrote: > I added the @login_required decorator to my view but it

Re: same model field times in query result. How?

2009-11-18 Thread Preston Holmes
Its not clear how you differentiate one measure as speed or another as dir. Assuming only one has a link to another measure then you could do something like: results = Measurand.objects.exclude(entry__isnull=True).select_related () for speed in results: speed_avg = speed.avg_value

Re: Default sort order in admin

2009-11-16 Thread Preston Holmes
On Nov 16, 8:31 am, Zeynel wrote: > Thanks! > > I noticed that using > > class Lawyer(models.Model): >     ... >     ordering = ('last',) > > did not work. > > But this worked > > class Lawyer(models.Model): >     ... >     class Meta: >         ordering = ('last',) > >

Re: Django on Dreamhost internal server error

2009-11-16 Thread Preston Holmes
do you have error templates defined? http://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views -Preston On Nov 16, 12:55 pm, Alessandro Ronchi wrote: > If I put Debug = False in my django settings.py I receive an internal > server error with

Re: updating parent model on inline creation

2009-11-13 Thread Preston Holmes
On Nov 13, 5:13 pm, Preston Holmes <pres...@ptone.com> wrote: > if submission.status == "submitted" and submission.reviews.count > 0: > submission.status = "pending review" > > Are there even simpler ways to do this that I haven't thought of? ans

updating parent model on inline creation

2009-11-13 Thread Preston Holmes
I'm setting up a conference website where a submission will have one or more "reviews" I've got the reviews set as inlines for submissions in the admin The submission model has a "status" field that needs to go through steps like "submitted" and "pending review" What I'd like to do is when the

Re: Model Theory 101 - Video Sharing App

2009-11-13 Thread Preston Holmes
On Aug 26, 4:17 pm, thornomad wrote: > > Caveats: I would like to keep the original "synced" data in its own > field and the "approved" data (as edited) in separate field. I > imagine that the data first gets brought into the "edit" field, admin > may make changes and

Re: admin.site.register() - help

2009-11-11 Thread Preston Holmes
You should change: admin.site.register(PageAdmin) to: admin.site.register(FlatPage, PageAdmin) also I don't see where you are using a generic relation - so the class for your inline should be admin.StackedInline not generic.GenericStackedInline -Preston On Nov 11, 8:37 pm, neridaj

Re: Can I change the restriction on "username" without breaking anything?

2009-11-11 Thread Preston Holmes
On Nov 11, 4:38 pm, "Richard E. Cooke" wrote: > My client wants to use e-mail addresses for user names. > > the contrib.auth application does not have a restriction in its > model.  But the form code has put a regex on the field that disallows > the ampersand (@). fyi

Re: AssertionError: Response didn't redirect as expected: Response code was 200 (expected 302)

2009-11-11 Thread Preston Holmes
Does your fixture result in a valid form? if the form.is_valid() line doesn't pass, then you would get a 200 from the render to response... -Preston On Nov 11, 4:38 pm, Eesti Mate wrote: > When I'm testing my form with assertRedirects I get the following error >

Re: problems registering models in admin

2009-11-11 Thread Preston Holmes
Is the admin in your installed apps in settings.py? http://docs.djangoproject.com/en/1.1/intro/tutorial02/#activate-the-admin-site Add "django.contrib.admin" to your INSTALLED_APPS setting. -Preston On Nov 11, 5:19 pm, neridaj wrote: > I'm working on a standalone app and

Re: How to handle this race condition?

2009-11-10 Thread Preston Holmes
another option if you want to stay in just python and are on a POSIX system is to use system file locking to ensure you don't get concurrent calls to your updated function. http://docs.python.org/library/fcntl.html#fcntl.lockf -Preston On Nov 9, 10:17 pm, Continuation

Re: User class, change name of fields(like username with login name)

2009-11-09 Thread Preston Holmes
On Nov 9, 7:49 am, NMarcu wrote: > Hello all, > >    I have a list of all users. My head table is made with the fields > from User class. So look like this: > > username           first name             last name > superuser status > > I want to make this head table

Re: Making the case for Django (vs. Drupal)

2009-11-01 Thread Preston Holmes
On Oct 31, 8:44 am, shacker wrote: > At the university where I work, there is a LOT of momentum behind > Drupal. A large and active users group, and dozens of departmental > sites running it. I've succeeded in building a few departmental sites > with Django but still

Re: Display Certain Fields of the Model Formset As Text

2009-10-30 Thread Preston Holmes
On Oct 30, 12:00 pm, Bill Freeman wrote: > Yet another option is to write a widget that subclasses the existing > one, and adds > disabled='disabled' to the dictionary that will be used to populate > the attributes > (usually the 'attrs' argument, I think, and you will have

Re: django can't access site-packages when inside fastcgi on dreamhost

2009-10-29 Thread Preston Holmes
On Oct 27, 9:07 pm, Jacob Fenwick wrote: > Wow, big surprise that someone else is having shared hosting issues with > dreamhost eh? > > I'm importing a library I installed in site-packages in a module in a django > app. When I call this django project, it returns with

Re: Internal error on dreamhost when debug=False

2009-10-29 Thread Preston Holmes
Well you've gotten farther than I have. I can get passenger_wsgi working with hello world, and cherrypy I can get those working with any combination of virtualenv etc But with django I get the not too helpful Premature end of script headers even with apache LogLevel set to debug. -Preston

Re: Behaviour of related objects

2009-10-25 Thread Preston Holmes
On Oct 25, 2:55 pm, Bojan Mihelac wrote: > Hi all, > > given an many_to_one doctests with Reporter/Article models, the > following example would fail with "IntegrityError: > many_to_one_article.reporter_id may not be NULL": > > >>> r = Reporter(first_name='John',

Re: Interesting code abstraction Challenge

2009-10-24 Thread Preston Holmes
I think a base class with subclasses is the best approach. Define as much common behavior as possible, set up defaults for those fields needed by your outbound API How are you handling the branching lookup of what subclass to use? You might name the subclasses in some way that they can be

Re: Advantages of using ManyToManyField(Bar, through='Foo_Bar') syntax vs not declaring a ManyToManyField at all

2009-10-24 Thread Preston Holmes
The way I think of the value of the "through" table approach is when you want to attach information to the relationship that does not belong on either model. I like a band/musician example. A person can be a part of many bands A band has many people so here we have a classic M2M But a person

Re: Replicating Google Groups in Django

2009-10-24 Thread Preston Holmes
It doesn't seem like it would be that hard to combine django- extensions export_emails command with Mailmans sync_members script inside a cron job or a URL triggered script. Usage: /usr/share/mailman/bin/sync_members [options] -f file listname -Preston On Oct 23, 6:06 am, Julien Phalip

Re: I don't even know where to begin writing this template-tags

2009-01-21 Thread Preston Holmes
It may not be as pretty as a parseable param array, but what about just having all your args in a single JSON string. Are your template authors savvy enough? -Preston On Jan 20, 3:32 pm, Andrew Ingram wrote: > I'm building a simple banner/promotion system for a site.

Re: ForeignKeys and select_related

2009-01-18 Thread Preston Holmes
So just for completeness, here is the bit about avoiding the inner for loop in this situation: On Jan 17, 8:40 am, ptone wrote: > matching_torrents = Torrent.objects.filter(name__icontains='x360') > my_data = [] > for a_torrent in matching_torrents: >     info_objects =