Override queryset for admin Inline

2010-08-06 Thread Nick
I have an admin set up with three inlines. I would like to filter the inline's editable options by a variable that is defined in a settings file. I can over ride the actual admin pieces for each of the inlines (they all have full admin screens of their own). But I can't seem to get the standard

Re: Django IDE

2010-08-03 Thread Nick Arnett
On Sun, Jul 18, 2010 at 10:19 AM, Biju Varghese <bijukava...@gmail.com>wrote: > Eclipse is the best IDE for python and django. > > I don't know if it is actually the best, but I'm happy with it. Nick -- You received this message because you are subscribed to the Google Groups

Re: Splitting LONGTEXT column to its own table?

2010-08-02 Thread Nick Arnett
cessary, you could create properties in the original model > to map the names you have in your application. Interesting idea... anybody here ever tried anything like that? Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Splitting LONGTEXT column to its own table?

2010-08-02 Thread Nick Arnett
though. Ah... I didn't think of views. Haven't used them in a while, but that's worth a shot, I think, since that way, I might not have to touch the Django code at all. Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To po

Splitting LONGTEXT column to its own table?

2010-08-02 Thread Nick Arnett
every piece of code that uses those tables. In other words, I'm looking at vertical partitioning, but only across tables, not databases, as transparently as possible to the code that I've already written. Thanks in advance for any pointers. Nick -- You received this message because you

updating admin values with other fields

2010-07-27 Thread Nick
I have a save override in my admin file that catches a value from one field and applies it to another. The values it grabs from a manytomany field. I can get it to work, but only when I save twice. It looks like it needs the manytomany to update with the new values and then it needs to second

Re: save a values_list to a charfield

2010-07-27 Thread Nick
e the help. On Jul 27, 2:49 pm, ringemup <ringe...@gmail.com> wrote: > ', '.join(primary_ids) > > The fact that you're doing this with foreign keys, though, suggests to > me that you may have a database normalization problem. > > On Jul 27, 3:26 pm, Nick <nickt...

Re: save a values_list to a charfield

2010-07-27 Thread Nick
I am getting this to save but I can't get it to output properly it's outputting as [16L, 451L, 521L] for a list of id's, which it should according to documentation. However, how can I output it like this 16, 451, 521 On Jul 27, 12:11 pm, Nick <nickt...@gmail.com> wrote: > I am need

save a values_list to a charfield

2010-07-27 Thread Nick
I am needing to do some duct taping for a project that is going on right now. In it I need to take a values_list of id's from a ManyToMany field and save those values to a varchar field so a mysql query can access the values. I am working with two different sets of developers and this is the best

Re: Custom admin input app

2010-07-26 Thread Nick
Completely missed that section. You are always very helpful, Daniel. Thank you. On Jul 26, 10:08 am, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Jul 26, 3:56 pm, Nick <nickt...@gmail.com> wrote: > > > Has anyone heard of, see, or used an app that would tran

Custom admin input app

2010-07-26 Thread Nick
Has anyone heard of, see, or used an app that would transform the table view of the admin into a data entry point, basically jumping the need to click through to individual entries in order to edit them? -- You received this message because you are subscribed to the Google Groups "Django users"

modelformset vs. inlineformset vs. DIY

2010-07-23 Thread Nick
I have inherited a project with a tight deadline and I am lost for how to proceed. There are two tables: Canididates and Race. The race table holds 145 different races with information about precincts, winners of different stages of the race (primary, runoff, gneral) The Candidates table has

Re: values() returning more than values

2010-07-22 Thread Nick
This is still an issue I'm seeing. I don't know how it can return the proper count but then when i request the actual values it spits out 9 times as many On Jul 21, 11:08 pm, Nick <nickt...@gmail.com> wrote: > It looks like its returning every organization instance in

Re: using the update() method

2010-07-22 Thread Nick
that what you want can be accomplished by: > > from django.db.models import F > > readers = Readers.objects.filter(status=active) > readers.update(sorter=(F('library') + F('book')) > > > > On Wed, Jul 21, 2010 at 19:40, Nick <nickt...@gmail.com> wrote: > >

Re: values() returning more than values

2010-07-21 Thread Nick
multiple duplicate organizations. On Jul 21, 10:47 pm, Kenneth Gonsalves <law...@au-kbc.org> wrote: > On Thursday, July 22, 2010 09:10:31 am Nick wrote: > > > Readers = Readers.objects.values_list('organization').distinct() > > > The count returns 189 results but when I

values() returning more than values

2010-07-21 Thread Nick
I may be misunderstanding the values method but it is returning duplicate results when I use the distinct method. I have a query that pulls the values of a column: Readers = Readers.objects.values_list('organization').distinct() The count returns 189 results but when I send it to output to a csv

using the update() method

2010-07-21 Thread Nick
I am trying to loop through a queryset and assign values to a field based on other values in that entry. So something like this readers = Readers.objects.filter(status=active) for reader in readers: library = reader.library book = reader.book readers.update(sorter="%s%s" % (lirbary,

Re: formatting values list

2010-07-21 Thread Nick
Perfect, thanks On Jul 21, 4:50 pm, n3ph <n...@terminal21.de> wrote: >  Definitely the better way.. > > On 07/21/10 23:42, Franklin Einspruch wrote: > > > Nick, > > > I think you're looking for this: > > >http://docs.djangoproject.com/en/dev/howto/output

formatting values list

2010-07-21 Thread Nick
or csv? so: id, name, type id2, name, type etc. etc. Thanks for the help Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group,

Re: Django memory requirements

2010-07-19 Thread Nick Arnett
. It was only when I started doing some heavier analysis that I had to bump up to Shared 2. Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe

Re: www.djangoproject.com

2010-07-15 Thread Nick Raptis
new-guy, Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more opti

Re: www.djangoproject.com

2010-07-15 Thread Nick Raptis
book.com maintainers a heads-up on this is issue, so they can cater for it. Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send e

Re: www.djangoproject.com

2010-07-14 Thread Nick Raptis
could provide you with the offending value. Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-user

Re: Trouble writing a view for a model

2010-07-12 Thread Nick
I think a choice field is probably best, then you can customize the presentation in a forms file. class Question(models.Model): q_cjoices = ( ('choice1', 'choice1'), ('choice2', 'choice2'), ('choice3', 'choice3'), ('choice4', 'choice4'), ('choice5', 'choice5'), )

__init__ custom form validation

2010-07-12 Thread Nick
I am working on a validation that will require a field be filled in if it is another field enters on of three values: For example: I have a form class myform(forms.Modelform): field1 = forms.CharField field2 = forms.Charfield field3_type = forms.CharField(choices=choices) field3

Re: www.djangoproject.com

2010-07-12 Thread Nick Raptis
. Maybe it has something to do with it, maybe it doesn't. Haven't got any more trouble since I fixed it though. Glad I could help :) Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: www.djangoproject.com

2010-07-08 Thread Nick Raptis
for the list and thought only one would go through as the first answer I sent lagged significantly. I hope this gets sent properly. Glad i could be of help, Nick On 07/08/2010 06:32 PM, Andi wrote: On Jul 8, 5:12 pm, Nick Raptis<airsc...@gmail.com> wrote: If there is a non-standard

Re: www.djangoproject.com

2010-07-08 Thread Nick Raptis
le like en-US, some django pages won't ever display. Nick On 07/08/2010 04:11 PM, eon wrote: Same for me. The problem is in the firefox profile (maybe due to the switch from 3.5 to 3.6 ?) Start-up with a new profile (backport plugins, bookmarks argh...) resolves the issue On 5 juil, 20:52,

Re: www.djangoproject.com

2010-07-08 Thread Nick Raptis
le like en-US, some django pages won't ever display. Nick On 07/08/2010 04:11 PM, eon wrote: Same for me. The problem is in the firefox profile (maybe due to the switch from 3.5 to 3.6 ?) Start-up with a new profile (backport plugins, bookmarks argh...) resolves the issue On 5 juil, 20:52,

Re: Query raises a DoesNotExist error

2010-07-07 Thread Nick
A lot of this is me trying to find out why it's failing. The problem I'm getting is that there is a FullProfile associated with the email address. When i go through the steps in the shell it works perfectly. When I run it through the form it throws an error. If you look at the custom

Query raises a DoesNotExist error

2010-07-07 Thread Nick
I am working on a form to resend an account activation email for newly registered users who did not receive their first email. The form is currently raising a DoesNotExist error and I can't figure out why: Here is the activation code: class resend_activation(forms.Form): email =

URL configuration

2010-07-06 Thread Nick
I currently have several django projects on one server. I am working with subdomains for some of these projects and I'd like the base URL to be a little different than the default behavior. I am working with modwsgi and apache. I have a project called MyProject. I have a subdomain set up at

Price fixing (was Re: How much would you charge for this? £5k? £15k? £50k?)

2010-06-21 Thread Nick Arnett
irly good description of the issue, look at the HTML Writer's Guild guidelines: http://www.hwg.org/resources/faqs/priceFAQ.html Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@google

Re: Django Sphinx or haystack Xapian

2010-06-19 Thread Nick Arnett
ch-related technology for a long time and I should know that search performance always demands lots of memory... So I may bite the bullet and use Solr, after all. I just wish there were a way to trade off the memory for speed until I'm ready to deploy a real working version. Nick -- You received thi

Re: Django Sphinx or haystack Xapian

2010-06-19 Thread Nick Arnett
f about $25/month, which I'd rather not have to pay yet. Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-

Re: How to implement this model

2010-06-16 Thread Nick
e) >     def on_premise(self): >         return self.related_premise is not None >     def get_related_premise(self): >         assert self.on_premise() >         return self.related_premise > > On Jun 16, 3:39 pm, Nick <nickt...@gmail.com> wrote: > > > OK, here's the deal. I'm

Re: How to implement this model

2010-06-16 Thread Nick
neral Home and bus_type_2 = Crematorium, in the obituary form the user will have a drop down of either "Funeral Home" or "Crematorium" to choose from. On Jun 16, 2:39 pm, Nick <nickt...@gmail.com> wrote: > OK, here's the deal. I'm working up an obituary site. There are 3

Re: How to create the model in a different database from within the same database server.

2010-06-16 Thread Nick
Which version of django are you working with? On Jun 16, 2:28 pm, thusjanthan wrote: > Hi, > > when I mean database I mean the separate databases from within one > mysql database server. So ex: > > DB server: server.example.com > Databases that are contained in the one

How to implement this model

2010-06-16 Thread Nick
OK, here's the deal. I'm working up an obituary site. There are 3 models/tables and at one point I need to connect two in a way that is different than I have done up to this point. Here is the situation, any recommendations on how to accomplish this would be great: I have an obituary table. In

Re: Upgrading Python from 2.4 to 2.6 - can I just copy site-packages folder?

2010-06-14 Thread Nick
Many thanks for your helpful posts - in the end I just changed a bit of my code to work with 2.4, but this will come in handy for when I finally make the upgrade. Thanks again, Nick -- You received this message because you are subscribed to the Google Groups "Django users" grou

Re: assigning data based on a comparison between two tables

2010-06-09 Thread Nick
Just to let you know, this code worked out nicely. I made a few changes to the bottom save function: if len(candidates) > 1: raise Exception candidates.update(incumbent=True) On Jun 8, 6:11 pm, Nick <nickt...@gmail.com> wrote: > Thanks Dan, I'll give it a shot > > On J

Re: ordering integers with regroup

2010-06-09 Thread Nick
epending "District " to it in some other fashion. > > On Jun 9, 10:38 am, Nick <nickt...@gmail.com> wrote: > > > Has anyone come across an ordering issue with the regroup tag whereby > > if the field that is being ordered is an integer you get the following >

ordering integers with regroup

2010-06-09 Thread Nick
Has anyone come across an ordering issue with the regroup tag whereby if the field that is being ordered is an integer you get the following problem: say you have the grouped field "District" and the following groupings District 1 District 2 District 3 District 10 District 14 District 20

Re: assigning data based on a comparison between two tables

2010-06-08 Thread Nick
ght work for you assuming that the models and > stuff are similar. Also, this code is just off the top of my head, so > who knows if it will actually work :) > > Cheers, > > Dan Harris > dih0...@gmail.com > > On Jun 8, 6:30 pm, Nick <nickt...@gmail.com> wrot

assigning data based on a comparison between two tables

2010-06-08 Thread Nick
I have two models. One is a list of candidates that have filed to run for office. The second is a list of people who currently hold office. I'd like to compare the two tables and whenever a match is found between the two (an entry in the candidate table shares the same last_name and first_name

Re: styling with django templates

2010-06-08 Thread Nick
Tue, Jun 8, 2010 at 8:05 PM, Dejan Noveski <dr.m...@gmail.com> wrote: > > change {% if is_first_item %} with {% if forloop.first %} and you are set. > > > On Tue, Jun 8, 2010 at 7:59 PM, Nick <nickt...@gmail.com> wrote: > > >> I am looking for a way to identify

styling with django templates

2010-06-08 Thread Nick
I am looking for a way to identify the first item returned in a loop and display it differently than the others: basically it would go like: {% for item in items %} {% if is_first_item %} This is what will show {% else %} this is what will show {% endfor %} Am I overlooking

Upgrading Python from 2.4 to 2.6 - can I just copy site-packages folder?

2010-06-08 Thread Nick
ll located in Python 2.4's site- packages folder. When I upgrade to 2.6, is it just a case of copying these over into 2.6's site-packages folder, or do I need to install the modules afresh? Thanks, Nick -- You received this message because you are subscribed to the Google Groups "Django users&

Re: If is first time logging in

2010-05-19 Thread Nick
: > Do you use the generic login view? > > > > > > On Thu, May 20, 2010 at 12:16 AM, Nick <nickt...@gmail.com> wrote: > > I have an expanded user form right now. Here is the sign up process. > > > user registers using username, email, password > > &g

Re: If is first time logging in

2010-05-19 Thread Nick
ill be second > login and you will be able to show them again. > > > > > > On Wed, May 19, 2010 at 11:05 PM, Nick <nickt...@gmail.com> wrote: > > I'm trying to figure out a way to see if it is a users first time > > logging in after registering on the si

If is first time logging in

2010-05-19 Thread Nick
I'm trying to figure out a way to see if it is a users first time logging in after registering on the site. If it is then I will pass them through some formsets, otherwise I let them go to their profile page. I tried using date_joined == last_login but that doesn't work, as the last login date

Re: send_mail not firing

2010-05-19 Thread Nick
:07 am, Nick <nickt...@gmail.com> wrote: > It looks like the problem isn't with send_mail, its the save override > on the form, the is_active = False isn't setting that option in the DB > either, so it is skipping over the save options. Here they are again: > > forms.py:

Re: send_mail not firing

2010-05-19 Thread Nick
ndthe > message? Any errors? > > Nuno > > > > On Tue, May 18, 2010 at 11:42 PM, Nick <nickt...@gmail.com> wrote: > > Actually, I've fixed the problem with send_activation. If i go via the > > form it still doesn't trigger the email. > > > On

Re: send_mail not firing

2010-05-18 Thread Nick
Actually, I've fixed the problem with send_activation. If i go via the form it still doesn't trigger the email. On May 18, 5:19 pm, Nick <nickt...@gmail.com> wrote: > I get the same results. > > I dropped into the shell and tried it out > > >>> user = User(usernam

Re: send_mail not firing

2010-05-18 Thread Nick
y 18, 5:19 pm, Nick <nickt...@gmail.com> wrote: > I get the same results. > > I dropped into the shell and tried it out > > >>> user = User(username="nick", email="t...@test.com") > >>> send_activation(user) > > 1 > > I thi

Re: send_mail not firing

2010-05-18 Thread Nick
I get the same results. I dropped into the shell and tried it out >>> user = User(username="nick", email="t...@test.com") >>> send_activation(user) 1 I think the 1 means that it passed but I don't get any emails sent On May 18, 5:08 pm, "ge...@aquaria

Re: send_mail not firing

2010-05-18 Thread Nick
...@aquarianhouse.com> wrote: > what happens if you set fail_silently to True? > > On May 19, 12:05 am, Nick <nickt...@gmail.com> wrote: > > > > > I am having an issue with an authentication app I am writing. The app > > saves the form appropriately but does

send_mail not firing

2010-05-18 Thread Nick
I am having an issue with an authentication app I am writing. The app saves the form appropriately but doesn't send the confirmation email. I am using the same email_host settings as with other application that send email messages but with no results. Here is the process. First a form processes

Re: Pluggable Q app?

2010-05-14 Thread Nick
I actually just got done writing a QandA app. It's very basic. I don't have it open yet but I would turn over the source to you if you wanted. Here are the features: Question Answer Answerer Answerer's credentials site specific QandA (using django.contrib sites) tagging (using django-tagging)

Re: Taking on a NoneType error

2010-05-12 Thread Nick
ce to have a built in fail safe rather than checking in the templates each time. Thanks a bunch, Dummy On May 12, 12:46 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Wed, May 12, 2010 at 1:06 PM, Nick <nickt...@gmail.com> wrote: > > I am using a custom template tag called calc

Taking on a NoneType error

2010-05-12 Thread Nick
I am using a custom template tag called calculate age to produce an age in numbers based on a filter for a template tag. Here is the tag: def age(bday, d=None): if d is None: d = datetime.datetime.now() return (d.year - bday.year) - int((d.month, d.day) < (bday.month, bday.day))

Re: Saving objects that have foreign key fields using the pk instead of an instance of the foreignkeyed object

2010-05-12 Thread Nick Serra
Exactly what I was looking for, thanks! On May 12, 11:50 am, Daniel Roseman <dan...@roseman.org.uk> wrote: > On May 12, 4:34 pm, Nick Serra <nickse...@gmail.com> wrote: > > > Thanks for the response. I actually will already have the PK, and am > > trying

Re: Saving objects that have foreign key fields using the pk instead of an instance of the foreignkeyed object

2010-05-12 Thread Nick Serra
Thanks for the response. I actually will already have the PK, and am trying to avoid grabbing an instance of the actual item object. On May 12, 11:26 am, Daniel Roseman <dan...@roseman.org.uk> wrote: > On May 12, 4:04 pm, Nick Serra <nickse...@gmail.com> wrote: >

Saving objects that have foreign key fields using the pk instead of an instance of the foreignkeyed object

2010-05-12 Thread Nick Serra
Sorry for the confusing title. Here is a simple example to illustrate my question: class Item(models.Model): name = models.CharField() class Manager(models.Model): item = models.ForeignKey(Item) On a POST I have the PK of the Item I want to link to a new instance of the Manager object.

Re: Paginating search results

2010-05-11 Thread Nick
xt; > click next again...). > > Nuno > > > > On Tue, May 11, 2010 at 2:41 PM, Nick <nickt...@gmail.com> wrote: > > The POST thing was the result of late night meltdowns and desperation. > > I tend to just try stupid things when i'm working through an issue > > li

Re: Paginating search results

2010-05-11 Thread Nick
the object list (reps) when rendering a specific > page (any particular reason why are you using POST in the search > form?). > > hth, > Nuno > > > > On Tue, May 11, 2010 at 1:58 AM, Nick <nickt...@gmail.com> wrote: > > I'm trying to paginate results from a sear

Re: How to define different user types?

2010-05-10 Thread Nick
Yeah, this is built in to django. You are on the right track with user.contrib.auth. If you are doing this all from the admin then it's as simple as creating a few groups, giving them the permisions you want and then assigning users to those groups. If you are doing it on a front facing site,

Paginating search results

2010-05-10 Thread Nick
I'm trying to paginate results from a search with multiple options. The only problem is, once I hit the next button it clears the query and I'm left paginating all the objects in the DB. Here is my view: def filter_search(request): if request.POST: reps = Rep.objects.all() else:

Custom Model Fields

2010-05-09 Thread Nick Taylor
pretty close, any ideas anyone? Thanks in advance, Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubs

Additional Text Form Field within a Models Admin Screen

2010-05-08 Thread Nick Taylor
ppreciated! Thanks a lot, Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For

Re: Working out some custom API stuff

2010-05-06 Thread Nick
Never mind this, I got it figured out. Thanks again On May 6, 12:51 pm, Nick <nickt...@gmail.com> wrote: > Thanks for the help on that portion, it is working wonderfully. > > I've been able to power through most of the requests for this project > but there is one outstanding

Re: Django 1.2 release candidate available

2010-05-06 Thread Nick Serra
Awesome! Thanks so much! On May 6, 3:32 am, Federico Capoano wrote: > I've been using the beta for a while and it works pretty good for what > I've seen. > > On May 6, 6:40 am, James Bennett wrote: > > > > > > > Tonight we're proud to announce,

Re: Working out some custom API stuff

2010-05-06 Thread Nick
seman <dan...@roseman.org.uk> wrote: > On May 5, 4:46 am, Nick <nickt...@gmail.com> wrote: > > > > > Here's the deal. I'm working on a customAPIfor moving information > > about. I am stuck at a point in creating my view. > > It might be best just to get into the

Working out some custom API stuff

2010-05-04 Thread Nick
Here's the deal. I'm working on a custom API for moving information about. I am stuck at a point in creating my view. It might be best just to get into the details. Here is the model: class entry(models.Model): question = models.CharField('Question', max_length=200, blank=False) answer

Re: override a form field, to allow usernames with '@'

2010-05-04 Thread Nick Serra
I just implemented this and it's a hassle. There are heated discussions about it. I ended up modifying the auth app and completely eliminating the 'username' field and just using email. Then I modified the admin app to allow the login, and am basically just completely overriding both. Good luck!

Re: Is it safe to alter Django generated tables in MySQL to have composite PK?

2010-05-02 Thread Nick Arnett
On Sat, May 1, 2010 at 11:13 AM, Continuation <selforgani...@gmail.com>wrote: > > On Apr 30, 9:42 pm, Nick Arnett <nick.arn...@gmail.com> wrote: > > > If you don't have data in the table, just drop it and use > "unique_together" > > in models

Re: Is it safe to alter Django generated tables in MySQL to have composite PK?

2010-04-30 Thread Nick Arnett
our data... or, even easier, create a whole new database with syncdb and copy your data into it. Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from th

Encoding makes text go away in templating; mx.DateTools.strptime v. utf-8

2010-04-30 Thread Nick Arnett
something similar - vanishing string after encoding...? Thanks in advance for any insights. Nick P.S. As often happens, describing the problem helped a bit... it seems to be related to mixing unicode and non-unicode strings. When I decode the results to utf-8, my text is back but I still

Re: grabbing request while overriding save or in a signal

2010-04-30 Thread Nick Serra
Yeah, I realize this now hah. Instead I am now passing request into a ModelForm for what I need. Basically I have a comment system, and on each comment post I wanted to run it through Akismet, which required the IP and User Agent. So I just passed request into my form.save() method on comment

Re: Setting readonly_fields dynamically

2010-04-29 Thread Nick
Yes that works, totally missed the get_readonly_fields method - thanks! Nick On Apr 29, 4:40 pm, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Apr 29, 3:43 pm, Nick <n...@njday.com> wrote: > > > > > > > Hi, > > > I would like to set some

Setting readonly_fields dynamically

2010-04-29 Thread Nick
print self.readonly_fields Any help on how I can access readonly_fields from the ModelForm to override it would be really helpful! Thanks, Nick -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, sen

Re: Template composition: Rendering based on permissions

2010-04-28 Thread Nick
The bible for user authentication is found here http://docs.djangoproject.com/en/1.1/topics/auth/ The quick answer to number 2 is to check for authentication in a template tag: {% if user.is_authenticated %} Welcome back you rotten jerk {% else %} Log in, you rotten jerk {% endif %} On Apr 28,

Re: following reverse relationship of an extended model

2010-04-28 Thread Nick Serra
Yeah, that is going to be my fallback, I was just curious on an actual reverse relationship solution to the situation. Thanks for the input! On Apr 28, 4:12 pm, zinckiwi wrote: > > class Account(models.Model): > >     name = CharField > > > class Entry(models.Model): > >    

following reverse relationship of an extended model

2010-04-28 Thread Nick Serra
Hey, quick query question. I know there has to be an answer for this one, just don't know the syntax. I need to follow the reverse relationship for an extended model. class Account(models.Model): name = CharField class Entry(models.Model): account = ForeignKey(Account) class

grabbing request while overriding save or in a signal

2010-04-28 Thread Nick Serra
Hey everyone. I'm trying to access the request object while overriding the save or tapping into the post_save on a model. I need request info when someone posts a comment. But I don't just want to handle this in my view, I would like it to be cleaner than that, so that functionality would remain

Re: adding foreign key attributes to the admin editing screen

2010-04-26 Thread Nick Serra
Are you trying to interface django with an existing table? Why do you have the StandardCode class foreign key-ing to the table, instead of just making a model that references the table exactly? On Apr 26, 2:43 pm, Jesse wrote: > Table LOINCCode has loinc_obr4 (a number) and a

Re: M2M Manager -- how to get primary key of join table?

2010-04-26 Thread Nick Serra
You could create a model that references the join table itself. class ArticlePublicationsJoin(models.Model): id = models.AutoField() publicaiton_id = models.IntegerField() article_id = models.IntegerField() class Meta: db_table = 'article_publications' then just query on

Re: How to return an audio file in django

2010-04-26 Thread Nick Serra
Interesting. If the file is an mp3, maybe try: file = open("/path/to/my/song.mp3", "rb").read() response['Content-Disposition'] = 'attachment; filename=filename.mp3' return HttpResponse(file, mimetype="audio/mpeg") On Apr 26, 1:20 pm, Dexter wrote: > Hi there, > > I want

Re: difficulty with 1.2 CSFR processing

2010-04-26 Thread Nick Serra
Include request context: from django.template import RequestContext ...and then pass it in with the render. That should include the token in the template. return render_to_response('add_pair.html', {}, context_instance=RequestContext(request)) On Apr 26, 12:45 pm, jeff

Re: feed decorator

2010-04-26 Thread Nick Serra
Seems very odd how you're trying to implement this. Unless your pseudocode has me confused. Can you give us the view functions too? Seems like you're trying to use a decorator function on two views. Why don't you just bail on the decorator, and just check for request.GET.get('format') == 'rss',

Re: Many-To-Many issue; trying to find a way around conditional id

2010-04-26 Thread Nick Serra
Can you be more clear on the exact result you're trying to achieve? Do you want to see, for a given high school, how many recruit objects are foreign keyed to it? On Apr 26, 7:38 am, Nuno Maltez wrote: > Are you saying that: > > collegelist = >

Re: Track "before" and "after" state of an object when editing in the Admin?

2010-04-26 Thread Nick Serra
There are a couple ways to do this. You can either override the model methods like save and init, or you can use signals and tie into the pre_save, post_save, etc. Signals are here: http://docs.djangoproject.com/en/dev/ref/signals/ If using signals, you will have an instance of the object being

Re: Performing an action on model.save() but not on update

2010-04-26 Thread Nick Serra
:) On Apr 26, 9:48 am, Jim N <jim.nach...@gmail.com> wrote: > Nick, > > Thanks very much.  That worked!  I can't work out why my code didn't > though (or rather, worked twice). > > -Jim > > On Apr 23, 6:37 pm, Nick Serra <nickse...@gmail.com> wrote: > > &

Re: Performing an action on model.save() but not on update

2010-04-23 Thread Nick Serra
, it increments TWICE! > > Is there some glaring error in my logic above? > > On Apr 23, 4:50 pm, Nick Serra <nickse...@gmail.com> wrote: > > > > > I didn't even think of that. It's not very common to be specifying > > pk's on create anyway, so yours would prob

Re: Performing an action on model.save() but not on update

2010-04-23 Thread Nick Serra
ion fails for a user-defined rather than > auto-incrementing pk. > > On Apr 23, 4:21 pm, Nick Serra <nickse...@gmail.com> wrote: > > > > > > > A post save signal seems better suited for this. The post save signal > > has an attribute 'created' that will be tr

Re: Performing an action on model.save() but not on update

2010-04-23 Thread Nick Serra
A post save signal seems better suited for this. The post save signal has an attribute 'created' that will be true or false depending on if the object is being created or updated. Check out the post_save documentation:

Re: New with Django

2010-04-23 Thread Nick Serra
Whenever I use django on my windows box, i use XAMPP, which is a all in one installer that gets apache and mysql. So I: - install XAMPP - install python - svn checkout django in the site-packages folder - install mysql bindings for python - install python image library and I think you need to

Re: import request ? - django debugsqlshell

2010-04-23 Thread Nick Serra
Request is an object that django passes view functions that includes post data, meta data, and data about the request taking place. Not sure what your test function is doing, but to start, python is complaining because you are referencing the variable before it has been declared. You need to

Re: temp url with time limit

2010-04-23 Thread Nick Serra
Just create a model that stores the url and the expiration time. If the url is hit past the expiration time, delete it, if it's still within the time limit, display whatever you want to display. Obviously this is for a small system, since you would be waiting to delete until the url is hit, but

Re: Retrieving an ID from a posted form

2010-04-22 Thread Nick
works like a charm, thanks Ian. On Apr 22, 10:02 am, Ian Lewis <ianmle...@gmail.com> wrote: > Nick, > > Because you won't get an id for your newly created object before you > save it you'll need to send the email after you save the form. I'm > assuming that ArtistFormFinal i

<    1   2   3   4   5   6   7   >