Re: Django app svn management

2010-04-30 Thread Dan Gentry
I have my DEV server pointing to the svn repository, and I can try out changes there. The web server admins take care of moving the application to production. On Apr 29, 4:25 pm, Dexter wrote: > This was not really a feature request or how its really setup. > But I wanted to know how the communi

Re: Chase Paymentech

2010-06-20 Thread Dan Gentry
Storing credit card numbers (and other info) isn't the only concern of the PCI standards. If your form collects a number an passes it on to the processor, you could also be vulnerable. On Jun 18, 2:09 pm, surtyaar wrote: > Hi Bobby, > > You might be interested in a django clone of the sample shop

View Decorator

2010-08-04 Thread Dan Gentry
I'm trying to move some code from a view to a decorator to use with many views. This is the view: views.py: def list_type(request): inst_id=request.session.get('inst_id',None) ## move to decorator if not inst_id: path = urlquote(request.get_full_path()) tup = reverse

Re: View Decorator

2010-08-04 Thread Dan Gentry
When I attempt to use the decorator logic, the view becomes this: views.py @institution_required def list_type(request): inst_id=request.session.get('inst_id',None) queryset = RecordType.objects.filter(institution=inst_id) return object_list(request, queryset, paginate_by = 12) I do

Re: View Decorator

2010-08-04 Thread Dan Gentry
Forgot to paste in the urls. urls.py from django.conf.urls.defaults import * from django.views.generic.simple import redirect_to from views import * urlpatterns = patterns('person', url(r'^create_type/$',create_type,name='type_create'), url(r'^view_type/(?P\d+)/$',view_type,name='type_v

Re: View Decorator

2010-08-05 Thread Dan Gentry
den wrote: > On 8/4/2010 10:52 AM, Dan Gentry wrote: > > > > > > > When I attempt to use the decorator logic, the view becomes this: > > > views.py > > @institution_required > > def list_type(request): > > >     inst_id=request.session.ge

Migrating Groups of Permissions

2010-10-07 Thread Dan Gentry
As I deploy my application into production, I haven't found a good way to migrate the groups of permissions I have defined and tested in development. In fact, due to my poor typing and reviewing, I missed one in production and caused a small amount of concern with the users until I figured it out.

Multiple CAS Servers

2010-02-23 Thread Dan Gentry
In the early stages of writing an app that will serve two constituencies, each with their own CAS service. (I work at a university, and we serve both staff/students and alumni.) The idea is to attempt authentication with the first CAS server, and try the other if the first is unsuccessful. I've

Re: Help with new version of django

2012-01-29 Thread Dan Gentry
I agree with Aaron. I upgraded 5 apps from v1.0.4 to 1.3 earlier this year, and it was pretty easy after reviewing the release notes. Moving to class based views (to replace generic views) was not required for 1.3, but I had fun and learned quite a bit. On Jan 28, 7:35 pm, Aaron Cannon wrote: >

Re: failing django install on dreamhost

2012-01-29 Thread Dan Gentry
I'm going to guess that maybe there is a syntax in one of the lines preceding this one. Could you share the entire DATABASE session of your settings file? FYI, I have written a more up to date procedure for running Django on Dreamhost - built on the great posts by Jeff Croft and others. http://da

Re: auth groups puzzle

2012-02-04 Thread Dan Gentry
I've solved this problem in an app, but not with the built-in permissions system. Instead, I created a DB structure that links users to companies and stores the r/w status for each. On Feb 3, 12:58 am, Mike Dewhirst wrote: > I want to use the built-in auth_groups permissions system in a > many-t

Re: where do you host your django app and how to you deploy it?!

2012-04-04 Thread Dan Gentry
Dreamhost shared account http://dashdrum.com/blog/2011/08/django-on-dreamhost/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to dj

Re: Why using Generic Views?

2012-04-04 Thread Dan Gentry
I use generic views - either function or class based - for the common functionality in my apps. As Serge mentioned, a list works pretty much the same in every application, so I just provide a few parameters to a generic view. More complicated forms still require custom code. On Apr 3, 1:07 am, a

Catching Oracle Errors

2012-07-10 Thread Dan Gentry
My Django app runs on an Oracle database. A few times a year, the database is unavailable because of a scheduled process or unplanned downtime. However, I can't see how to catch the error and give a useful message back to the requester. Instead, a 500 error is triggered, and I get an email (o

Re: Catching Oracle Errors

2012-07-11 Thread Dan Gentry
Thanks Ian. I'll see what I can do. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/EYbdNNR4bS8J. To post to this group, send email to django-users@g

Re: I can not install Django on Windows7

2012-07-18 Thread Dan Gentry
Do you have the proper level of security on the machine to install software? On Wednesday, July 18, 2012 8:50:48 AM UTC-4, Владислав Иванов wrote: > > when I run the installation of Django python setup.py install - comes at > the end of an error that can not be put Django in C: \ Python27 \ Lib \

Re: form.save() fails silently - how to debug?

2012-07-27 Thread Dan Gentry
I too am a little confused by the clean() method and the data_set field. It seems that the data_set would contain a copy of the ID value for a change operation, and be None for an add. What purpose does that serve? Perhaps comment the clean() method just to see if the other fields can be save

Re: Issue Deploying Django

2012-08-03 Thread Dan Gentry
Agreed that virtualenv will allow you to install python packages - however not any linux/unix packages. I have no problems using Django on Dreamhost. http://dashdrum.com/blog/2011/08/django-on-dreamhost/ On Thursday, August 2, 2012 10:34:35 PM UTC-4, trevorj wrote: > > You are trying to instal

Re: complicated permissions

2012-09-10 Thread Dan Gentry
> > Complicated indeed! > I once worked on a similar project that tackled the first 2 requirements as part of a multi-tenant application, storing both the userID and company ID for each detail record (content). Plus, the user profile was extended to tie a User record to one or more companies.

Re: Alternatives to CBVs (class based views)

2012-09-13 Thread Dan Gentry
It would be helpful to see some more complex examples with these classes. One thing I like about the CBVs is that they include all of the necessary code for common functions. I have used them extensively (once I figured them out). On Wednesday, September 12, 2012 12:59:12 PM UTC-4, Cal Leemin

Re: save() got an unexpected keyword argument 'force_insert'

2012-09-25 Thread Dan Gentry
To address the original question, I saw a similar error when overriding the save() function of a model. The solution was to include *args and **kwargs in the function definition: def save(self,*args, **kwargs): # your custom code here # super(MyModel, self).save(*args, **kwa

Re: Django testing strategy

2012-10-05 Thread Dan Gentry
I've been using factory-boy as of late, and have found it to be a great way to setup each test exactly as I need it. Fixtures aren't bad either, but working with a large amount of data can make it difficult to predict the proper output for a test, and changes to this data to accommodate a new

Reverse of admin:jsi18n

2012-11-08 Thread Dan Gentry
t found anything helpful in my searches. Thanks, Dan Gentry -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/WUsQvc_QxKAJ. To post to this grou

Re: Reverse of admin:jsi18n

2012-11-08 Thread Dan Gentry
Correction: My URL tag does not include the quotes. Should be: {% url admin:jsi18n %} -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ifbpxbJtw_wJ. T

Re: tutorial first step. -ImportError: No module named django.core-

2012-11-09 Thread Dan Gentry
Quick note: when using virutalenv on Windows, one runs the activate script to use the environment. \Scripts\activate.bat Same function as the source command in Linux. Dan Gentry >> -- You received this message because you are subscribed to the Google Groups "Django users"

Re: Django Development environment

2011-08-25 Thread Dan Gentry
Ubuntu, Eclipse with PyDev, virtualenv, pip, django debug toolbar, Chrome, and lots of hot chocolate :) On Aug 22, 6:07 pm, Stephen Jackson wrote: > I am new to the world of Django. I would like to hear from other django > developers describe their dev environment (tools, os, editors, etc.). --

Re: Alternative to Decorators for Class-Based View

2011-10-05 Thread Dan Gentry
In the docs there a paragraph or two about this. Basically, one must decorate the dispatch method instead. See this link for the details. https://docs.djangoproject.com/en/dev/topics/class-based-views/#decorating-the-class Good luck! On Oct 5, 11:42 am, Kurtis wrote: > Hey, > > What's the bes

Re: TemplateView compatible with permission_required decorator?

2011-10-05 Thread Dan Gentry
Instead, you should decorate the dispatch method in the class-based view. See the docs here: https://docs.djangoproject.com/en/dev/topics/class-based-views/#decorating-the-class On Oct 5, 10:27 am, Victor Hooi wrote: > Hi, > > I'm attempting to use one of the new class-based TemplateView with

Re: Getting into professional django development

2011-10-18 Thread Dan Gentry
With all due respect to Mr. Gonsalves, I do not care to work with the Django trunk unless I'm just playing around with something. My goal is always to produce a production quality application. Even the more stable than average Django trunk cannot provide the consistency needed to deliver an app t

Re: converting from function based views to class based views

2011-12-12 Thread Dan Gentry
I can't test this, but the code below may do what you want. (I learned this stuff from Reinout's blog posts) # urls.py (r'^tags/(?P[a-zA-Z0-9_.-]+)/$', djangoblog.tag_views.TagDetailListView.as_view()) # views.py from django.views.generic import ListView class TagDetailListView(ListView):

Re: Redirect from get_queryset() in a class view?

2011-12-12 Thread Dan Gentry
I faced a similar situation where I had to check for valid input data used to build the query in get_queryset(). My solution was to use a decorator around the dispatch() function, but I think it could also be used within that function. I chose dispatch() because it acts like a traditional view fu

Re: Constraints on a one-to-many relationship and related problems

2011-12-28 Thread Dan Gentry
Just looking at the models, I'd like to make a couple of suggestions. Instead of using a Foreign Key relationship in Customer to indicate the billing address, I would include a flag called 'billing_address' in the Address table that would be set to True for the customer selected address. An over

Re: How many developers have moved to class-based views?

2012-11-12 Thread Dan Gentry
It took me a few months to warm up to using class based views, and it was the pending decommissioning of the generic function based views that first caused me to take a look. Now, I have converted all but the most complicated views to the class format (why change what works?). Any new work I

Re: Django & Oracle connection problem

2013-01-25 Thread Dan Gentry
You've probably already tried the simple things: - Confirm that the server name and port are correct. - Ensure that firewall/routing rules will allow the connection. - Try a simple connection on the same box with sqlplus. Walking through this list has helped me a number of times.

Re: My Data dont be updated with my forms

2013-03-16 Thread Dan Gentry
Rafael, This is a bit of a wild guess, but I'm wondering if your form isn't validating. Since your template doesn't seem to be displaying any errors, you wouldn't know it. Also, since the Url column is marked as unique, but you are excluding it from the form, it may be the field throwing th

Re: Django 1.5 CBV - DeleteView - CustomQuery

2013-03-24 Thread Dan Gentry
Agree with Tom that ccbv is a great resource for help with CBVs. In fact, I used it to help me with this comment. I would probably override the delete() method in DeleteView to do what you want to do. The original justs deletes the record and redirects to the supplied URL: 1. def delete(

Re: Django throws ImproperlyConfigured error when loading URLconf on startup

2013-03-24 Thread Dan Gentry
Andrei, I once received this error when the problem was actually in another python module being imported - in my case views.py. Hope this helps, Dan -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiv

Re: Adding context data to a TemplateView?

2013-04-04 Thread Dan Gentry
Roy, I agree with Fallen that a subclass of TemplateView is required here. I have used this technique often. Dan class MyTemplateView(TemplateView): template_name = 'my_template.html' def get_context_data(self, **kwargs): context = super(MyTemplateView, self).get_context_data(*

Re: Multi-tenant database model with new user model?

2013-05-01 Thread Dan Gentry
Something I'm looking forward to learning as well. My app uses the older user_profile approach. -- 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+un

Re: Handling delete and ability to support undo

2013-05-15 Thread Dan Gentry
A couple of thoughts: Override the delete() method in your model to set the flag to True rather than delete the record. Write a manager that filters out the 'deleted' records. Use it for every query, except those used to retrieve or undo. On Monday, May 13, 2013 3:07:16 PM UTC-4, Subodh Nijsur

Re: Class Based CreateView with foreign key question

2013-06-13 Thread Dan Gentry
I use the same pattern in my application, and it works just fine. def dispatch(self, *args, **kwargs): self.tc = get_object_or_404(TrainingClass, pk=kwargs.get('class_id', None)) return super(TrainingScheduleCreateView, self).dispatch(*args, **kwargs) def form_vali

Re: more testing questions

2013-07-09 Thread Dan Gentry
1) I've been using Factory Boy to create test data rather than fixtures. It is so much easier to ensure that I know exactly what data is available for a given test. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this grou

Testing with legacy data

2013-08-08 Thread Dan Gentry
I'm not a fan of testing with actual data, except maybe as a final run to make sure no existing data breaks something or for stress testing with large amounts of data. Your legacy DB will not cover all of the possible cases that need to be tested in your code. Instead, write quality unit tests

Re: Iterating over fields in Formset

2013-08-11 Thread Dan Gentry
What is the purpose of checking test.id for a value of 3 or 6? -- 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 post

Re: OperationalError: unable to open database file

2013-08-30 Thread Dan Gentry
When using sqlite3, one has to provide a full path to the database file. For my projects I use something like this on my development machines (for a database file named 'db'): import os PROJECT_DIR = os.path.dirname(__file__) DATABASES = { 'default': { 'ENGINE': 'django.db.backen

Re: Script to move django 1.4.3 to 1.5.1

2013-08-30 Thread Dan Gentry
I've been using Django since v1.0, and when each major version is released, I run through the release notes to see what I need to change. Russell is correct that most things will work from one version to the next, but I like to keep as up to date as possible to minimize my risk of hitting a de

Re: I really about to give up Django

2013-08-30 Thread Dan Gentry
Just my opinion, but I see no reason to use English names in models. Use whatever you wish. English speaking programmers have been using cryptic variable names for decades. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: verify before make changes?

2013-09-01 Thread Dan Gentry
Seems to me your call to get_object_or_404() would effectively check for the object's existence. > > -- 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-us

Re: What is the best way to have multiple admin users with there own models?

2013-09-06 Thread Dan Gentry
I would write views for the client to access their tables rather than using the built-in admin. Your situation is not really what the admin was designed to do. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group a

Re: Best Practice for Raw SQL

2011-04-14 Thread Dan Gentry
Thanks. I'll give raw() a try. On Apr 11, 11:51 am, Jacob Kaplan-Moss wrote: > On Mon, Apr 11, 2011 at 7:53 AM, Dan Gentry wrote: > > Where I run into trouble is that the query returns data in columns, > > but not objects. That means that I can’t reference an object att

Formset and Choices with Objects

2011-04-21 Thread Dan Gentry
, time, location) and the radio button in a tabular format. Any thoughts here? Thanks for pondering my questions. Dan Gentry -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googleg

Re: Formset and Choices with Objects

2011-04-21 Thread Dan Gentry
I should have included that my desire is to access these objects in the template. On Apr 21, 11:22 am, Dan Gentry wrote: > I'm trying to use a formset to display a variable number of detail > rows on a form.  It's what they were created for, right? > > However, in order to

Re: filtering drop downs according to logged in user

2011-04-21 Thread Dan Gentry
I have set the choices list in the view: choices = SomeModel.objects.filter(user=request.user).values_list('id','label') Then, after the form is instantiated, modify the choices attribute of the ChoiceField: form = SomeOtherModelForm() form.fields['model_dropdown'].choices = choices

Re: When do we stop using Django admin?

2011-03-11 Thread Dan Gentry
I tend to use the Admin for internal tasks - ones that would be performed by a application or system administrator. These are people that understand the data structure and know things like the effects of a cascaded delete. For users, even a customer 'admin' person, I would write my own views that

Re: unique identifier to distinguish an instance

2011-04-07 Thread Dan Gentry
When faced with a similar problem (I wanted to mark one of the 'B' records as the primary of the group), I extended the save function of the 'B' model to ensure that none of the other records were marked as such. def save(self): if self.primary: other_primaries = B_Model.ob

Best Practice for Raw SQL

2011-04-11 Thread Dan Gentry
My application includes some existing tables from another, non-Django application. One of them does not have an atomic primary key, and I’m not in a position to change that. Therefore, I’m using one raw SQL to access the data. Where I run into trouble is that the query returns data in columns, but

Re: ListView and Deleteview

2015-02-02 Thread Dan Gentry
This is a bit of a stumper! I don't see any big glaring issues. A couple of housekeeping things: Is there data in the table? Are you certain that you are using the correct template? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubsc

Re: Fixing a poorly written Django website (no unit tests)

2015-03-04 Thread Dan Gentry
No need to test the Django provided logic, but I like to write a few tests for each view that check the permissions, urls, updates, etc. More of a functional test than a unit test. I find that when these tests fail it is usually something changed somewhere else in the app. For example, a chan

Re: Using multiple form in Class Base View (CBV)

2015-04-09 Thread Dan Gentry
To modify the generic CBVs to handle two forms would mean changes in many of the base classes and mixins, including ProcessFormView, FormMixin, and BaseFormView. It would make more sense to start with the View base class and roll your own methods. If this is a one-off, I would probably keep it

Re: modelformst save

2014-12-11 Thread Dan Gentry
While your form_invalid method is looking for reference_form as a parameter, the post method by default passes the form from get_form(form_class). I would recommend overriding post to pass both form and reference form to form_invalid and form_valid. Best of luck, Dan -- You received this mes

Re: CBV with inline formset

2014-12-15 Thread Dan Gentry
I created a couple of mixins for a project that might help you. See this gist: https://gist.github.com/dashdrum/03858d79ddfd9bba44d6 Pretty easy to use. Here's an example Create view: class RegistrationView(FormsetCreateMixin,CreateView): template_name = 'registration/registration_form.htm

Re: Django Class-Based CreateView and UpdateView with multiple inline formsets

2015-01-10 Thread Dan Gentry
I would suggest that in the UpdateView you should set the object to the master record being updated rather than to none for both get() and post(). On Saturday, January 10, 2015 at 8:08:47 AM UTC-5, Ranjith Kumar wrote: > > Hello all, > I have been trying to do Django class-based CreateView and

Re: saving to two models from one class view

2014-01-14 Thread Dan Gentry
With a formset, like your application form, the template could look like one of these examples: {{ formset.management_form }} {% for form in formset %} {{ form }} {% endfor %} {{ formset }} (found on https://docs.djangoproject.com/en/de

Re: installing django trunk

2014-03-08 Thread Dan Gentry
Malik, in order to install within your virtualenv, you should activate it first /bin/activate . Then run the pip install command. Cheers! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emai

Re: Dreamhost for Django hosting.

2014-03-09 Thread Dan Gentry
I've had good luck hosting an app with a Dreamhost shared hosting account. I even wrote a post about it a couple of years ago. (Maybe I should update it for 2014) http://dashdrum.com/blog/2011/08/django-on-dreamhost/ On Saturday, March 8, 2014 11:53:54 PM UTC-5, Chen Xu wrote: > > I am tryin

Re: How would you do this cleanly in Django (remembering the states of check boxes in multiple pages)

2014-05-09 Thread Dan Gentry
I would setup a data structure keyed off the session ID (or maybe a logged in user ID) that stored the transaction in progress for the user. As the user went through the pages this data would be used to display what has already been selected and be updated for each screen. I suppose that one c

Re: Importing Existing Oracle Databases

2014-05-18 Thread Dan Gentry
I would suggest the managed option in the Meta class of the model. Setting this to false will stop Django from trying to create the table, and it will instead expect it to already be available. Also, the db_table option can be used if the name of your model is different than the existing table

Re: UpdateView, ModelForm - form not redirecting problem

2014-06-01 Thread Dan Gentry
What does it do instead? > -- 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 post to this group, send email to djan