Skip to content

Instantly share code, notes, and snippets.

patras:socceramerica callen$ python ./manage.py shell_plus
From 'sites' autoload: Site
From 'auth' autoload: Permission, Group, User, Message
From 'contenttypes' autoload: ContentType
From 'sessions' autoload: Session
From 'admin' autoload: LogEntry
From 'comments' autoload: Comment, CommentFlag
From 'flatpages' autoload: FlatPage
From 'redirects' autoload: Redirect
From 'venus' autoload: MenuType, SubType, Category, Author, Type, Tag, Article, ArticleMeta, Change, ArticleOffsite, TypeFormField, InlineImage, Note, SphinxCounter
View:
def bimport_add(request):
error = None
if request.method == "POST":
biform = BimportForm(request.POST, request.FILES)
if biform.is_valid():
bimport = biform.save()
#p = Popen(['python', 'utils/processing.py', '%s' % bimport.id])
process_bimport(bimport)
STATUS_CHOICES = (('D', 'Done without errors'),
('E', 'Done with errors'),
('P', 'Processing'),
('N', 'Nothing processed yet'))
Cannot resolve keyword 'bimport' into field. Choices are: archive_column, archive_order, article, construct, day, edition, frequency, frequency_text, from_email, html_template, id, is_public, list_name, name, newsletterarticle, newsletterarticles, slug, subject, subject_type, subscription, text_template, time
# Caused by
# this is a many-to-many relationship
for nl in bimport.newsletters.all():
# Here's the trace:
for nl in bimport.newsletters.all():
import os
from optparse import OptionParser
usage = "usage: %prog -s SETTINGS | --settings=SETTINGS"
parser = OptionParser(usage)
parser.add_option('-s', '--settings', dest='settings', metavar='SETTINGS',
help="The Django settings module to use")
(options, args) = parser.parse_args()
if not options.settings:
parser.error("You must specify a settings module")
def process_bimport(sender, **kwargs):
from bimport.models import Bimport
import ipdb; ipdb.set_trace()
if sender == (Bimport):
inst = kwargs['instance']
if not inst._processing:
inst.status = 'P'
inst._processing = True
inst.save()
if int(inst.content_type.id) == 116:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<PassVirtualTour xmlns="http://tour.realliving.com">
<TourURL>http://bitemyapp.com</TourURL>
<PropertyID>14436696</PropertyID>
</PassVirtualTour>
</soap12:Body>
</soap12:Envelope>