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 ManufacturerProductionDetailForm(forms.ModelForm): | |
def __init__(self, *args, **kwargs): | |
self.helper = FormHelper() | |
self.helper.form_show_errors = True | |
self.helper.form_tag = False | |
self.update_base_fields_label() | |
self.update_type_transport_field_choices(*args, **kwargs) | |
super(ManufacturerProductionDetailForm, self).__init__(*args, **kwargs) |
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
# Ignore the default SQLite database. | |
/db/*.sqlite3 | |
# Ignore idea files | |
/.idea | |
/wordsmark.iml | |
# Ignore DS_Store files | |
.DS_Store |
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 test_when_email_exist(self): | |
from django.contrib.messages.storage.fallback import FallbackStorage | |
from mock import MagicMock | |
user_data = { | |
'email': 'manufacturer_test@gmail.com' | |
} | |
with self.assertNumQueries(1): | |
User.objects.create(**user_data) | |
User.get_roles = MagicMock(return_value=['MANUFACTURER']) |
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 | |
def select_from_chosen(driver, id, value): | |
chosen = driver.find_element_by_id(id + '_chzn') | |
results = chosen.find_elements_by_css_selector(".chzn-results li") | |
found = False | |
for result in results: | |
if result.text == value: |
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
# Helper functions | |
def dict_strip_unicode_keys(uni_dict): | |
""" | |
Converts a dict of unicode keys into a dict of ascii keys. | |
Useful for converting a dict to a kwarg-able format. | |
""" | |
data = {} |
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 ProductListView(LoginRequiredMixin, SearchFormMixin, ListView): | |
model = Product | |
search_form_class = ProductFiltersForm | |
template_name = 'panel/products/list.html' | |
context_object_name = 'product_list' | |
paginate_by = settings.PANEL_PAGE_SIZE | |
filtering = { | |
'manufacturer': SearchFormMixin.ALL, | |
'category': SearchFormMixin.ALL, | |
} |
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
curationApp.directive('rpDisplayCategories', ['$compile', function($compile) { | |
return { | |
restrict: 'A', | |
replace: true, | |
templateUrl: curation_template_urls.category_select, | |
link: function(scope, element, attrs) { | |
// element is a select tag | |
element.bind('change', function() { | |
debugger; | |
var parent_category_id = element.val(); |
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 GNA { | |
// b = 26 | |
const M = 67108864; | |
// M y C PESI | |
const C = 3; | |
// K = 1 | |
const A = 5; | |
public function get_randoms($Xo=100, $total_randoms=10){ | |
// Retorna un arreglo de numeros aleatorios |
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
<?php | |
class Persistence { | |
private static $_instance=null; | |
private $_conexion; | |
public static function getImagen($id) | |
{ | |
$mongo = new Mongo(); |
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
/* ALLOWS HAVE MULTUPLIE THUMBNAILS */ | |
.row-fluid ul.thumbnails li.span12 + li { margin-left : 0px; } | |
.row-fluid ul.thumbnails li.span6:nth-child(2n + 3) { margin-left : 0px; } | |
.row-fluid ul.thumbnails li.span4:nth-child(3n + 4) { margin-left : 0px; } | |
.row-fluid ul.thumbnails li.span3:nth-child(4n + 5) { margin-left : 0px; } |