Skip to content

Instantly share code, notes, and snippets.

@GaretJax
Created January 22, 2015 18:33
Show Gist options
  • Save GaretJax/4ccaf1963314d4754f64 to your computer and use it in GitHub Desktop.
Save GaretJax/4ccaf1963314d4754f64 to your computer and use it in GitHub Desktop.
from optparse import make_option
from django.core.management.base import BaseCommand
from products.models import SupplierOpportunity
class Command(BaseCommand):
def handle(self, *args, **options):
objs = SupplierOpportunity.objects.raw("""
SELECT
Id,Name,
Account__c,
Contact__c,
Contact_Name__c,
Contact_Typ__c,
Kontaktperson__c,
Opportunity__c,
Opportunity_Name__c,
Opportuniy_PLZ__c,
SortOrder_Default__c,
Status__c,
CreatedById,
LastModifiedById,
CreatedDate,
Verkaufspreis__c,
Opportunity_Leadbeschreibung__c,
Opportunity_Kontaktdaten_Lead__c
FROM Opportunity_Supplier__c
WHERE
Account__c = %s
AND Opportunity__c.Stage != \'Verloren und Geschlossen\'
""", ['0011100000ddDnEAAU'])
print len(list(objs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment