Sending unsafe requests from web extension to DRF - cannot send Referer

2021-09-30 Thread Brad Solomon
We have a web extension using Chrome Manifest V3 , which talks with a backend web service written with Django (3.2) / Django Rest Framework, and served with Gunicorn/Nginx. After turning on HTTPS, we are no longer to successfully make uns

Replicating complex query with two dense_rank() functions using ORM

2020-11-03 Thread Brad Buran
I have a "puzzle of the day" that users can answer. I track the puzzle of the day using the Puzzle model. I track the answers using the PuzzleAnswer model. I would like to calculate the number of consecutive puzzles a particular user (i.e., the author) gets right in a row. The current SQL I use

Django formset, forms passing unique choices into a choicefield for each form

2019-12-18 Thread Brad Allgood
Initially posted on stack overflow: https://stackoverflow.com/questions/59395761/passing-dynamic-choices-into-a-formset-unique-for-each-form I am working on what I thought was a simple college football confidence pool. The concept is as follows: - Bowl Model: Model that stores information of

django.core.exceptions.ImproperlyConfigured DJANGO_SETTINGS_MODULE

2019-09-18 Thread Brad S
I am trying to get a new server up and running and I am make a n00b error somewhere. django.core.exceptions.ImproperlyConfigured: Requested setting MIDDLEWARE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure()

mod_wsgi picking up wrong settings

2019-05-14 Thread Brad Rice
I have multiple websites setup on a linode cloud. I am using Virtual Host containers with WSGI paths and Virtual Envs for each app. When I set any of the apps to Debug = False, they throw 500 errors. It appears they are using the same wsgi environment settings because the error is ALLOWED_HOSTS

Re: Make mobile app from webapp

2019-01-07 Thread Brad Pitcher
The basic formula we've used in the past: 1. Decouple back- and front-end using API 2. Use django-bakery (https://django-bakery.readthedocs.io/en/latest/) to export the needed pages to HTML (requires the use of class-based views, which are actually really awesome) 3. Use Phonegap to wrap these HTML

Re: issue in hosting https://www.pythonanywhere.com

2018-12-25 Thread Brad Pitcher
, Dec 25, 2018 at 7:58 AM Brad Pitcher wrote: > Can you share your wsgi file created on pythonanywhere? > > On Tue, Dec 25, 2018, 1:01 AM Atul Anand >> Hi >> I have activated the venv by below cmd: >> 07:57 ~/simplesocial (master)$ workon djangoVenv >> Please let

Re: issue in hosting https://www.pythonanywhere.com

2018-12-25 Thread Brad Pitcher
you activate it? >> Sincerely yours, >> >> Joel G Mathew >> >> >> >> On Tue, 25 Dec 2018 at 12:27, Atul Anand >> wrote: >> >>> Hi Brad, >>> >>> Thanks for helping, but I am using a venv. >>> please find the bel

Re: issue in hosting https://www.pythonanywhere.com

2018-12-24 Thread Brad Pitcher
The paths in your logs indicate you aren't using a virtualenv. Find the virtualenv section in the web tab and make sure you specify the path to your virtualenv there. Should be something like /home/[username]/.virtualenvs/djangoVenv On Mon, Dec 24, 2018 at 8:09 AM Atul Anand wrote: > I am using

change display value of filter in admin

2016-05-31 Thread Brad Rice
I have a field that has two values set "S" or "E". I use it to filter records in the admin. I would like the values in the filter to be spelled out as "Signature" and "Emerging". How do I have it show like that in Admin? This is my filter: list_filter = ('app_complete', 'app_type') app_type

Setting a crispy form label from a db model field

2016-01-15 Thread Brad Rice
I'm using Crispy forms for an app that I created. I want to have the labels for the form come from a db entry. Is there a way, and how would you set the label using a model-view variable? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsu

Index(View) rendering template instead of view

2015-02-24 Thread Brad Rice
So I have a RedirectView.as_view() going to a page in an app called web. In the app web this is my view: class Index(View): def get(self, request, *args, **kwargs): return HttpResponse('Hello, World!') However, instead of showing that, when I get redirected to the app it shows my b

Re: RedirectView()

2015-02-23 Thread Brad Rice
#x27;index'), url(r'^gallery', gallery, name='gallery'), ) On Monday, February 23, 2015 at 10:01:53 AM UTC-5, Andréas Kühne wrote: > > > 2015-02-23 15:30 GMT+01:00 Brad Rice >: > >> I'm using RedirectView and it is redirecting to my app, bu

RedirectView()

2015-02-23 Thread Brad Rice
te display rather than Hello World. It isn't finding my Index(View) class for some reason. Can anybody explain to me how this should work? -- Brad Rice bradri...@gmail.com -- To succeed in life, you need two things: ignorance and confidence. -Mark Twain -- You received this message because y

Re: Class Based Views tutorials

2015-01-06 Thread Brad Rice
hlov > > On Tue, Jan 6, 2015 at 3:49 PM, Brad Rice > > wrote: > >> Does anyone have a recommendation for intermediate reading to understand >> Class Based Views? It seems most of the Django books were written when >> function based views were prevalent. I&#

Class Based Views tutorials

2015-01-06 Thread Brad Rice
Does anyone have a recommendation for intermediate reading to understand Class Based Views? It seems most of the Django books were written when function based views were prevalent. I'm still having trouble understanding what the differences are between CreateView and UpdateView and what Meta is

Re: Recommendations for hosting service?

2015-01-06 Thread Brad Rice
I like webfaction, too. I think they would have all the stuff you list as well as more. On Tuesday, January 6, 2015 6:30:18 AM UTC-5, Bobby Mozumder wrote: > > Anyone have recommendations for hosting services that can do Django, > Node.js, Postgreqsl, python3, as well as PHP/MySQL for legacy stu

Re: ANN: Django website redesign launched

2014-12-16 Thread Brad Rice
I noticed today when I went in to look something up. I like it. On Tuesday, December 16, 2014 11:12:54 AM UTC-5, Jannis Leidel wrote: > > Hi everyone, > > We're incredibly proud to share with you the new design of the Django > website, the documentation and the issue tracker. > > This is a long

Re: control attributes on form fields in formset

2014-12-16 Thread Brad Rice
Ah, found it on the django read the docs site. This is what I did in my inline formset factory BookFormset = inlineformset_factory(Author, Book, extra=3, max_num=3, widgets={'name': forms.TextInput(attrs={'class':'u-full-width'})}) On Tuesday, December 16, 20

control attributes on form fields in formset

2014-12-16 Thread Brad Rice
When I do a model form I can control the fields with attributes using name = forms.CharField(widget=forms.TextInput(attrs={'class':'u-full-width'})) How do I do something like that in an inline formset? I don't see where I can set attributes. -- You received this message because you are subs

Re: CBV with inline formset

2014-12-15 Thread Brad Rice
onse(self.get_context_data(formset=book_formset)) On Monday, December 15, 2014 4:09:29 PM UTC-5, Vijay Khemlani wrote: > > Try changing the name of the parameter in the url from author_id to pk > > On Mon, Dec 15, 2014 at 5:39 PM, Brad Rice > wrote: >> >> I've pre

CBV with inline formset

2014-12-15 Thread Brad Rice
I've pretty much butchered the code for 3 days now and cannot figure out how to insert an inline formset. Can anybody help me? I've tried to pare everything down to use two simple Models just to try to get an insert. I'm using django Author - Book relationship to keep it simple. class Author(m

modelformst save

2014-12-05 Thread Brad Rice
For the life of me I can't figure out how to use a modelformset with class view. I get it to display but it won't save. Also, when it goes into form_invalid, it doesn't display the 3 formsets. Can anyone shed a little light? I'm using crispy forms with this in my template: {% crispy reference

Re: Alternative to fabric

2014-11-17 Thread Brad Pitcher
I agree Ansible is a good fit for your situation. Since Ansible works from yaml files, you don't have to write any Python 2.x compatible code as you would with Fabric. On Mon Nov 17 2014 at 8:24:24 AM Brian Schott wrote: > Ansible is a good choice. > > Sent from my iPhone > > On Nov 17, 2014, at

Re: Please help: urgent deployment problem with django post office

2014-10-03 Thread Brad Pitcher
If you want to simply disable logging, you could try setting the LOG_LEVEL to 0: POST_OFFICE = { 'LOG_LEVEL': 0 # Don't log anything } On Fri, Oct 3, 2014 at 4:55 AM, Sabine Maennel wrote: > Hello Collins, I need post office for other purposes not for error > logging. > > I worte an issue

Re: try, except problem

2014-09-06 Thread Brad Rice
Andréas that was it. I guess I wasn't thinking about that correctly. I sure appreciate the help. This Django group is a very good group. On Saturday, September 6, 2014 1:19:57 PM UTC-4, Andréas Kühne wrote: > > Hi Brad, > > 1. Why would app not be not be set if it is in

try, except problem

2014-09-06 Thread Brad Rice
I'm trying to write a try: except: to check for three things. First I want to check if an application has already been filled out, thus, check for existence. Second if it has been filled out a flag that is is complete is set to true. Then the else would be neither of those things, they need to

Re: crispy forms two forms and context

2014-09-02 Thread Brad Rice
ep in mind that only one of > the forms will be submitted (assuming each has it's own set of > tags). If you need to combine them and submit info for both, you may need > to roll a single custom form class that can handle all of the data, or > possibly look into Django formsets. >

Re: crispy forms two forms and context

2014-09-01 Thread Brad Rice
Schneider wrote: > > It looks like you are passing the context an actual Answers object, not a > Form or ModelForm object that will add/update an Answers object, hence > the reason the trace back complains about a lack of 'fields'. > > -James > > On Monday, Se

crispy forms two forms and context

2014-09-01 Thread Brad Rice
This document seems to indicate I can have two forms inside one set of form tags: http://django-crispy-forms.readthedocs.org/en/latest/crispy_tag_forms.html#rendering-several-forms-with-helpers I cannot figure out how to set the context to be able to iterate over both forms. {% crispy form %}

Re: update a field of a related table on form save

2014-07-30 Thread Brad Rice
Thank you both for those suggestions. I got Tundebazby's to work as it was closest to what I was doing. I'll have to study the post_save some more. On Wednesday, July 30, 2014 2:33:57 AM UTC-4, Tundebabzy wrote: > > Hi Brad, my response is inline > > On 30 Jul 2014 02:2

update a field of a related table on form save

2014-07-29 Thread Brad Rice
I have three tables. The first one is application which has a flag for if an app has been submitted as well as created date and modified date. The other two tables relate to the application table. I have two forms that get update those tables. What I want to do is update the application modified

Re: 1.6.5 as a zip for download?

2014-05-28 Thread Brad Pitcher
Is this what you're looking for? https://github.com/django/django/archive/1.6.5.zip On Wed, May 28, 2014 at 9:51 AM, Neil Walker wrote: > Hello, > I wish to download 1.6.5 stable zip without using pip and not as a tar/gz > (limitations on software I can use at work), but when I visit the downlo

Re: Centos 6.5 Python 3.3.x Django 1.6 Apache 2.2

2014-05-05 Thread Brad Pitcher
It's just something that was passed down to me from a senior programmer :-) - Brad Pitcher On Mon, May 5, 2014 at 2:45 PM, Guillem Liarte < guillem.lia...@googlemail.com> wrote: > Hello Brad, > > Thanks for the suggestion, I was suspecting something like that. I wil

Re: django 1.6.4 - markup / markdown (for django blog tutorial)

2014-05-05 Thread Brad Pitcher
django.contrib.markup has been deprecated. You could try using the standalone project that is a copy of the same code from django: pip install django_markup_deprecated Then add "markup_deprecated" to your INSTALLED_APPS instead of django.contrib.markup. - Brad Pitcher On

Re: Centos 6.5 Python 3.3.x Django 1.6 Apache 2.2

2014-05-02 Thread Brad Pitcher
=/data/app/guillem-py3-dj17-test/lib64/python3.3/site-packages/ - Brad Pitcher On Fri, May 2, 2014 at 4:11 AM, Guillem Liarte < guillem.lia...@googlemail.com> wrote: > Hello, > > I have looked through the web in several different especialised forums but > I cannot find

Re: validate answers from a detail view

2014-04-14 Thread Brad Rice
pen on this exact feature > > https://code.djangoproject.com/ticket/21644 > > > > Em sábado, 12 de abril de 2014 14h28min01s UTC-3, Brad Rice escreveu: > >> I'm using a Class based Generic Detail View to show end users their >> answers to previous mulit-page for

validate answers from a detail view

2014-04-12 Thread Brad Rice
I'm using a Class based Generic Detail View to show end users their answers to previous mulit-page forms. How can I use that final detail view to validate the answers? Should I not be using a Detail view or can I somehow do a conditional get to the next view based upon those answers? Right now I

Re: Printing things to the server console in Django?

2014-02-21 Thread Brad Pitcher
print("information") - Brad Pitcher On Fri, Feb 21, 2014 at 1:00 PM, wasingej wrote: > Hi guys. I'm pretty new to Django and I'm trying to figure out how I can > print out information to my console that I started my web application on > using "pytho

Re: Do you think Django's future is threatened by JS frameworks in both client & server?

2014-01-27 Thread Brad Moore
The tech giants are pushing JavaScript more than Python these days. JavaScript is said to be the future language for enterprise applications. I think Python will be around but will play a third place role behind JavaScript and PHP. Yes, I said PHP and I apologize but its true just look at the

Re: Save to User table first_name and last_name from a page with a different form

2014-01-22 Thread Brad Rice
plication_id})) On Wednesday, January 22, 2014 9:48:27 AM UTC-5, Brad Rice wrote: > > I have a registration and login page that only takes username and > password. After they register or login, they are taken to a profile form > where they can provide additional information such as addre

Save to User table first_name and last_name from a page with a different form

2014-01-22 Thread Brad Rice
I have a registration and login page that only takes username and password. After they register or login, they are taken to a profile form where they can provide additional information such as address and phone numbers. I'm using a Model Form CreateView there. On that page I want the First Name

Re: NoReverseMatch error on redirect

2014-01-14 Thread Brad Rice
I figured it out. I had a namespaced url so it needed: return HttpResponseRedirect(reverse('requestform:registrant_add', kwargs={'app_id': obj.id})) On Monday, January 13, 2014 12:22:59 PM UTC-5, Brad Rice wrote: > > I have a mulit-page form I am building. I get t

NoReverseMatch error on redirect

2014-01-13 Thread Brad Rice
I have a mulit-page form I am building. I get the start page to enter the data for the application, validate and save. When I try using reverse to move to the next page I get this error: NoReverseMatch at /requestform/start/Reverse for 'registrant_add' with arguments '()' and keyword arguments

using success_url

2014-01-10 Thread Brad Rice
I can't seem to find success using success_url If I try this in my urls.py file url(r'^step2/', AnswersCreate.as_view(success_url='/requestform/success'), name='answers'), and then in my view: def form_valid(self, form): obj = form.save(commit=False) obj.created_by = self.reque

Re: How to edit a model with an inline formset

2014-01-10 Thread Brad Rice
I'm following that blog entry, too, and getting an error when I try to save: [u'ManagementForm data is missing or has been tampered with'] On Thursday, January 9, 2014 11:57:37 AM UTC-5, Cody Scott wrote: > > I am trying to create a model with an inline formset. I followed the guide > here > ht

Re: saving to two models from one class view

2014-01-10 Thread Brad Rice
%} {{ form.as_p }} {{ application_form.management_form }} {{ application_form.non_form_errors }} {% endblock %} I'm really feeling the newbie moniker. On Friday, January 10, 2014 2:49:43 AM UTC-5, trojactory wrote:

saving to two models from one class view

2014-01-09 Thread Brad Rice
I have been banging around trying to write to two models from one view for a couple days and just cannot figure it out. I am using a CreateView. I want to write to a model with just the created_by user and a default value of False in app_complete to. I'm getting this error: [u'ManagementForm d

Admin permissions for proxy ModelAdmins?

2013-11-27 Thread Brad Smith
ndeed the more appropriate solution would be nice!). Thanks! --Brad -- 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...@googleg

Re: Using admin views "outside" of admin

2013-11-21 Thread Brad Smith
for embedding, and then you'd just need some javascript to cause the submit button to use e.g. jQuery.post()... right? Any tips/warnings with regard to this? --Brad -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Using admin views "outside" of admin

2013-11-21 Thread Brad Smith
glanceI don't see anything in the docs about replacing or extending the access control mechanism. Anyone have advice along those lines? Thanks again! --Brad On Wednesday, November 20, 2013 5:32:30 PM UTC-5, Gonzalo Delgado wrote: > > -BEGIN PGP SIGNED MESSAGE- > Ha

Using admin views "outside" of admin

2013-11-20 Thread Brad Smith
ed to suck it up and rewrite everything from scratch using regular Django forms? Thanks to anyone who can offer some advice. --Brad -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving email

Re: How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-17 Thread Brad Pitcher
th.abspath(os.path.dirname(__file__)), '..')) - Brad Pitcher On Tue, Sep 17, 2013 at 12:25 AM, DJ-Tom wrote: > > Hi, > > I'm also not sure if the python file is at the correct location. > > This is how the directory structure looks: > > my_

Re: How do I create a standalone python application that uses the django environment (e.g. the ORM etc...)?

2013-09-16 Thread Brad Pitcher
You need to do something like this before import django stuff: import os import sys sys.path.append(os.path.abspath(os.path.dirname(__file__))) os.environ['DJANGO_SETTINGS_MODULE'] = 'web.settings' - Brad Pitcher On Mon, Sep 16, 2013 at 8:19 AM, Nigel Legg wrote

Re: SQLite3 database error!!!

2013-04-21 Thread Brad Pitcher
Can you post the rest of the traceback? On Apr 21, 2013 7:06 AM, "Kakar" wrote: > I am in settings.py and using SQLite3. But when i execute manage.py > syncdb, it gives me error: "Value error: Empty module name" I didn't > understood this part. Plz help me guyz. > > -- > You received this message

Re: Possible Basic kwargs question.

2013-04-16 Thread Brad Pitcher
ram1'], etc > > Why even unpack the dictionary? I could just pass the dictionary instead. > > > On Tuesday, April 16, 2013 11:08:42 PM UTC-4, Brad Pitcher wrote: > >> It should be: >> model.method1(**params) >> On Apr 16, 2013 7:49 PM, "jayhalleaux&qu

Re: Possible Basic kwargs question.

2013-04-16 Thread Brad Pitcher
It should be: model.method1(**params) On Apr 16, 2013 7:49 PM, "jayhalleaux" wrote: > Not really a Django question but I'm trying to create a model method that > does not have a fixed set of parameters. > > models.py > Class Model_A(model.Model): > ... > > def method1(self, **kwargs): > > print p

Re: django-social-auth problem with facebook

2013-04-15 Thread Brad Pitcher
In my experience, that particular error always means that the database doesn't match what you have in your models. Try a syncdb and/or check your south migrations to make sure your database is up to date. - Brad Pitcher Software Developer (702)723-8255 On Sun, Apr 14, 2013 at 11:

Implementing query with Django ORM - left join with length() and replace() functions

2013-04-05 Thread Brad Buran
gth(a.ipa) = length(b.ipa) and a.ipa = replace(b.ipa, '%s', '%s') The idea of this query is to find all pairs of words that differ by one phoneme (e.g. "mat" and "bat" differ by only one sound). Is this query possible to accomplish with the ORM, or do I need

Re: Can't store valid JSON in JSONField because of SubfieldBase/to_python issues

2013-03-21 Thread Brad Jasper
AM UTC-4, Brad Jasper wrote: > > I maintain django-jsonfield, a project that allows you to store arbitrary > JSON objects in the database. > > It's having a problem with the way to_python is called while > using SubfieldBase. A full explanation of the problem is here

Re: Suggestion for using distinct on django 1.4+ in your unit tests?

2013-03-06 Thread Brad Pitcher
I believe sqlite supports "distinct" just not "distinct on". I have always managed to find workarounds using "distinct" anywhere I formerly used "distinct on". On Mar 6, 2013 7:01 AM, "Toran Billups" wrote: > I recently upgraded to django 1.4 and found that my "distinct" queries > don't work anym

Re: Upgrade to django 1.5

2013-03-04 Thread Brad Pitcher
It should be safe, just test things out. Also, if you have DEBUG=False you must also include an ALLOWED_HOSTS array, which became required in Django 1.4.4: https://www.djangoproject.com/weblog/2013/feb/19/security/#s-issue-host-header-poisoning It should contain a list of domains used to access th

Re: How to abstract model methods to a separate class?

2013-02-26 Thread Brad
On Tue, 2013-02-26 at 07:53 -0800, Richard Brockie wrote: > class myLinksClass: > basepath = 'testing/' > > def self(self): > return "%s" % (self.basepath, ) > > def view1(self): > return "%s%s" % (self.basepath, 'view1', ) > > def view2(self): > return "%

Re: How do I get the current user in a model?

2013-02-11 Thread Brad
Sounds like you are maybe calling a user method from a template? You will probably want to create a custom tag or filter: https://docs.djangoproject.com/en/1.4/howto/custom-template-tags/ A filter would look like this: {{ my_model_item|price:request.user }} And the filter itself something like th

Re: Collectstatic not working

2013-02-10 Thread Brad
The problem is that you have your STATIC_ROOT as one of the STATICFILES_DIRS. The STATIC_ROOT directory should be empty, that is where all the static files from different places will be gathered when you run collectstatic. You should probably create a static directory under the myapp directory and

Re: Why i can't get the debug informations (in case of error) when i run LiveServerTestCase tests?

2013-02-09 Thread Brad
I admit it is vexing that Django overrides what you have specified in the settings file in this case, but it doesn't seem to be hard to override. I simply added "settings.DEBUG = True" to the beginning of the "setUp" function for the test class and that seems to do the trick. Btw, I see tracebacks

Re: How do I get the integer of a decimal string?

2013-02-09 Thread Brad
Convert it to float first: int(float("14.00")) On Sat, 2013-02-09 at 09:27 -0800, frocco wrote: > Hello, > > > I am reading a cdv file and one col has the value of "14.00" > I want to get the integer value if 14 > I tried int("14.00") > > > Thanks in advance > > -- > You received this messag

Re: Why i can't get the debug informations (in case of error) when i run LiveServerTestCase tests?

2013-02-09 Thread Brad Pitcher
Have you tried adding a: import pdb; pdb.set_trace() in the view to debug that way? On Jan 30, 2013 12:31 AM, "Alessandro Pelliciari" wrote: > Thanks for the answer! > > Because i'm developing and integrating some flow (social registration etc) > through tests. > > So, instead of creating every t

Re: No module named models again

2013-02-06 Thread Brad
On Wed, 2013-02-06 at 11:49 -0800, frocco wrote: > Line 22 does not make any sense to me as to why it is failing. > If I remove receipt, it runs fine It can be surprising sometimes what code can cause other code to get imported and run. My guess is, in trying to find your url route there, Django l

Re: No module named models again

2013-02-06 Thread Brad
On Wed, 2013-02-06 at 10:31 -0800, frocco wrote: > Exception Location:C:\ndsutil\Menus\CTD-NDSUser\PycharmProjects\ntw > \checkout\views.py in , line 5 Django gives you the line in the file where the error occurs so you don't need to track it down ;-) It's probably failing when you try to import s

Re: Help - No module named models

2013-02-04 Thread Brad Pitcher
On Sun, 2013-02-03 at 10:04 -0800, frocco wrote: > from catalog.models import Category It is probably this line. Maybe there is no __init__.py file in the catalog directory? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from th

Re: newbie needs to copy a record in admin to a new record

2013-01-11 Thread Brad Pitcher
s and copy them. - Brad Pitcher Software Developer (702)723-8255 On Fri, Jan 11, 2013 at 7:06 AM, frocco wrote: > Hello, > > I am just learning django and want to allow a user in admin to copy a > record from the list to create a new record and make changes. > This wi

Re: Email notifications app

2012-11-23 Thread Brad Pitcher
Checkout django drip: https://github.com/zapier/django-drip On Nov 23, 2012 7:22 AM, "Arnaud BRETON" wrote: > Hi everybody, > > I'm looking for a powerful third-app for Django to manage time-driven > email notifications. > > I found django-notifications ( > https://github.com/jtauber/django-notif

Re: selenium test for fallback page loaded from app cache when server is unavailable

2012-11-03 Thread Brad Pitcher
Are you having the selenium test go to online.html first like in your manual test? Maybe you need to have selenium hit offline.html first and cache that page? On Nov 3, 2012 6:14 AM, "Joao Coelho" wrote: > Hi. I haven't been able to figure this one out. Trying to write an > automated test that us

Re: How to reference model instance fields dynamically

2012-10-26 Thread Brad Pitcher
Use setattr's counterpart, getattr :-) getattr(inst, k).add(relatedObject) On Fri, Oct 26, 2012 at 5:16 PM, Chris Pagnutti wrote: > Awesome. Thanks Brad. Now the question is, what if the attribute is a > ManyToManyField. > > e.g. > inst.k.add(relatedObject) > > How

Re: How to reference model instance fields dynamically

2012-10-26 Thread Brad Pitcher
You can use python's setattr function to do this: for k,v in fields.iteritems(): setattr(inst, k, v) On Fri, Oct 26, 2012 at 8:37 AM, Chris Pagnutti wrote: > Say I have a model like > class MyModel(models.Model) >name = models.CharField(max_length=100) >number = models.IntegerField()

Re: Best way to detect if a user has changed password

2012-10-24 Thread Brad Pitcher
You could use a "pre_save" signal. kwargs['instance'] will contain the updated record and you can get the old record with "User.objects.get(id= user.id) if user.pk else None". I've done this in the past to check for a changed email address. On Wed, Oct 24, 2012 at 2:23 PM, Roarster wrote: > I'm

Re: static files

2012-10-11 Thread Brad Pitcher
I believe the best way of doing this is to have your image(s) in static/images and your css in static/css. Then you can use a relative URL to set the background image like so: background-image : url("../images/PAE.jpg") It's better not to have any CSS mixed in with your HTML anyway. On Oct 11, 2

Re: Possible spam from mailing list? ("China Mobile")

2012-09-10 Thread Brad Pitcher
Yes, I received a similar email about the post "Re: I can't install django on my mac. I'm not sure wh..." which I recently responded to. Not sure what to make of it. On Mon, Sep 10, 2012 at 12:27 PM, Kurtis wrote: > I just received a very unusual e-mail that included a recent post's > subject. T

Re: I can't install django on my mac. I'm not sure why. Details inside.

2012-09-09 Thread Brad Pitcher
Glad to here you got it working, and please let us know if you have any other questions. On Sun, Sep 9, 2012 at 5:52 PM, Shayan Afridi wrote: > It works! Thank you all so much. It feels great to know that there is a > very responsive and helpful support system for django users. Thanks again! > >

Re: I can't install django on my mac. I'm not sure why. Details inside.

2012-09-09 Thread Brad Pitcher
I can't speak authoritatively on this, since that's not how it installs in Linux, but in my understanding the contents of the django.pth file should be the directory django has been installed to. Check the contents of that file to see if everything is in order. An alternative to this is to update P

Re: I can't install django on my mac. I'm not sure why. Details inside.

2012-09-09 Thread Brad Pitcher
The question is, is django inside one of those directories? It should probably be installed to C:\Python27\lib\site-packages so there would be a C:\Python27\lib\site-packages\django directory. Is it there? On Sun, Sep 9, 2012 at 3:41 PM, Shayan Afridi wrote: > Interesting. I'm doing it on my PC n

Re: bar charts

2011-11-07 Thread Brad Montgomery
+1 for Google Charts. For small stuff (1 chart), I just render JavaScript in the of my html templates. For more complex stuff, you could write a view that *just* renders JavaScript and include it via a script tag. Just make sure to serve it with MIME type "application/javascript" Here's mor

Re: Django hosting

2011-07-25 Thread Brad Montgomery
I've been using rackspace's Cloud servers. They give you a nice platform and charge only for what you use (so low-traffic sites end up being very affordable). However, you should play close attention to a service like https://gondor.io/ - it's an extremely easy-to-use service that makes host

Re: [ask for help] how to solve this issue: "DatabaseError at /admin/myapp, no such column: myapp.myvar"

2011-05-21 Thread brad
e corresponding to that model and run syncdb again. You should also consider looking at south (http://south.aeracode.org/). It provides migration tools that let you add columns to existing models via a managment command. - Brad -- You received this message because you are subscribed to th

Re: cx_Oracle error: ImproperlyConfigured

2011-04-21 Thread brad
This may be related to Oracle's shared libraries not being in the path recognized by your web server. I created hard links to the Oracle shared libraries in /user/local/lib to get cx_oracle working. I have a blog post that outlines what I did, here: http://bradmontgomery.net/blog/gahhh-django-vi

Django Donations App

2011-02-25 Thread Brad Reardon
thing; instead of the name of the person that had donated that PayPal provides, I would like for them to be able to input an alias. Thanks! Brad Reardon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email

Re: default_if_none as settings (??)

2010-12-13 Thread Brad Reardon
If I understand correctly, then the solution would be to do something of this sort: (pardon the formatting) if value: {{value}} else: {{default_value}} Something of that sort *should* work, although I am not entirely sure. On Mon, Dec 13, 2010 at 4:00 AM, PyMan wrote: > Maybe I'm wrong

Re: django-admin.py startproject not working

2010-12-12 Thread Brad Reardon
umed, and neither the PYTHONPATH nor the environmental variables > path gets checked when Python runs the command, so this (full path to > django-admin.py) is what finally worked for me: > > python C:/Python27/Scripts/django-admin.py startproject mysite > > > On Dec 12, 8

Re: django-admin.py startproject not working

2010-12-12 Thread Brad Reardon
Vista is very picky about permissions. Try running the command prompt as an administrator. On Sun, Dec 12, 2010 at 8:06 PM, codegal wrote: > I'm trying to create my first Django project, and I must be missing > something really basic. I'm using Windows Vista, and have installed > Python 2.7 and

Re: Updating a video rating using AJAX

2010-10-20 Thread brad
Also, if you DO choose to pass JSON back to your client, you should serialize it first. See this: http://docs.djangoproject.com/en/dev/topics/serialization/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to d

Re: Updating a video rating using AJAX

2010-10-20 Thread brad
> I would like to do this without using a view or doing a form POST or GET of > any kind. Any pointers? Why? If you're building a web app, you should use HTTP to for the client to communicate with the app (AJAX is just another form of that communication). You're almost there, though, because yo

Re: problem reversing namespaced URL (application instance not recognized?)

2010-10-17 Thread Brad Buran
x27;test.wiki.urls', app_name='wiki', namespace='help'). Sorry for the trouble, Brad On Sun, Oct 17, 2010 at 6:14 PM, Brad Buran wrote: > I'm trying to reuse a wiki app twice in my project; however, whenever I > call the reverse function, it returns the

problem reversing namespaced URL (application instance not recognized?)

2010-10-17 Thread Brad Buran
eyword defined in the top-level urls.conf to know which : def display(request, wiki, slug): try: wiki = models.Wiki.objects.get_or_create(wiki) page = models.Page.objects.get(wiki=wiki, slug=slug) except models.Page.DoesNotExist: url = reverse('%s:wiki_page_404&#

Sorting related model

2010-09-11 Thread Brad Buran
(revision=F('page__current_revision')).order_by('created').select_related() pages = [content.page for content in qs] This works fine, but is there a more straightforward way to do this? Thanks, Brad -- You received this message because you are subscribed to the Google Groups &quo

Re: best practice for widget that edits multiple model fields

2010-07-21 Thread Brad Buran
class EventDateRange(DateRange): date = ForeignKey(Event) class Event(Model): #various other fields required for event Does this seem like it would make more sense? Thanks, Brad On Wed, Jul 21, 2010 at 8:03 AM, Scott Gould wrote: > My immediate thought upon reading your post was that y

Re: best practice for widget that edits multiple model fields

2010-07-21 Thread Brad Buran
elds/#howto-custom-model-fields > > On Jul 20, 10:00 pm, Brad Buran wrote: > > I have a group of fields (date_start, date_end, all_day) that I would > like > > to reuse in several models. I've defined a MultiWidget that displays two > > split datetime fields plus a ch

best practice for widget that edits multiple model fields

2010-07-20 Thread Brad Buran
is, then I would use model.save() to deserialize the data in the combined_date_info field and save it to the appropriate model fields. This solution seems a bit hackish and not very DRY. Are there better approaches? Brad -- You received this message because you are subscribed to the Google G

Re: File Upload with Progress Bar

2010-06-03 Thread Brad Pitcher
; > opposition to flash based solution. Also, i have not been to get it > > > > working > > > > > inspite of it being not an ideal solution. > > > > > I hear that there are some issues with filebrowser since it uses > > > > Uploadify. > > > > &g

Re: File Upload with Progress Bar

2010-06-03 Thread Brad Pitcher
x27;t streaming the file upload to django, I'm currently investigating that. On Jun 2, 9:24 pm, Brad Pitcher wrote: > Sort of, that's what the default is in the demo, but now I've noticed I have > the same problem with apache progress reporting as I did using django > progr

  1   2   >