This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Migration(DataMigration): | |
def forwards(self, orm): | |
Vendor = orm['vendor.Vendor'] | |
Customer = orm['customers.Customer'] | |
for vendor in Vendor.objects.all(): | |
user, customer = Customer.create_user_and_customer(is_active=True) | |
vendor.customer = customer | |
vendor.save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery.task import task | |
import pyes | |
import json | |
from django.conf import settings | |
from warehouse_pieces.models import PieceMeta | |
from products.models import SimpleProduct | |
from lib.aquameta.pricelevel import RETAIL, WHOLESALE | |
@task | |
def update_search(mapping=False): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
d.contact_name AS "Drop Name", | |
CONCAT(d.address_1, ', ', d.city, ', ', states.abbrev) AS "Drop Location", | |
to_char(avg(drop_route_trip.cached_ordered_weight),'99999999999999999D99') | |
AS "Avg Weight for Drop", | |
to_char(sum(avg(drop_route_trip.cached_ordered_weight)) | |
over(order by MAX(drop_route_trip.cached_sequence)), '99999999999999999D99') AS "Load Total" | |
FROM routes_route AS route | |
LEFT JOIN routes_routetrip AS route_trip | |
ON route.id = route_trip.route_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.common.exceptions import TimeoutException | |
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0 | |
from selenium.webdriver.support import expected_conditions as EC # available since 2.26.0 | |
# Create a new instance of the Firefox driver | |
#driver = webdriver.Firefox() | |
driver = webdriver.Chrome() | |
# go to the google home page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@phasing("route_trip.status") | |
def calculate_weight_to_display(self): | |
return self.ordered_weight | |
@calculate_weight_to_display.phase_after(ROUTE_TRIP_SHIPPED) | |
def calculate_weight_to_display(self): | |
return self.picked_weight |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Password for user jordan: | |
psql (9.1.8) | |
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256) | |
Type "help" for help. | |
beehive=# \d | |
List of relations | |
Schema | Name | Type | Owner | |
--------+----------------------------------------------------------+----------+-------- | |
public | accounts_receivable_adjustment | table | jordan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def save(self, **kwargs): | |
self.flag_cached_attrs_as_stale() | |
self.react_to_purchasing_status() | |
if not self.id: | |
self.payment_term = self.vendor.payment_term | |
if self.freight_method in (FREIGHT_CC_FULL, FREIGHT_CC_LTL): | |
self.common_carrier_pickup_address = self.vendor.any_warehouse_contact | |
if self.common_carrier_pickup_address: | |
if(not self.common_carrier_pickup_address.the_same_address_as(self.historic_common_carrier_pickup_address) | |
and self.phase <= PHASE_RECEIVING): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _price(product, level): | |
if product.is_priced_by_weight: | |
price_obj = product.sell_price_per_pound(level) | |
else: | |
price_obj = product.sell_price(level) | |
amount, off = price_obj | |
if off == False: | |
off = "" | |
try: | |
amount = float(amount) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import unicode_literals | |
from datetime import datetime, timedelta | |
from django.conf import settings | |
from django.db import models | |
from django.core.mail import send_mail | |
from django.template import Context, loader | |
from django_cached_field import CachedDecimalField, CachedFloatField, CachedIntegerField, CachedCharField | |
import django_snailtracker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, timedelta | |
# If drop is more then 2 years old | |
two_years_ago = datetime.now() - timedelta(2*365) | |
drops = DropPoint.objects.filter(created_at__gte=two_years_ago) | |
for d in drops: | |
# if it hasn't ordered in the last 2 years mark it as inactive | |
if d.last_shipable_drop_point_trip > two_years_ago: | |
d.active = False |