Skip to content

Instantly share code, notes, and snippets.

from gza.artist_shops.models import *
from django.contrib.auth.models import User, Group, Permission
from django.contrib.contenttypes.models import ContentType
content_type = ContentType.objects.get_for_model(ArtistShopSignupLandings)
permission = Permission.objects.create(codename='add_artistshopsignuplandings', name='Can add artist shop signup landings', content_type=content_type)
permission = Permission.objects.create(codename='create_artistshopsignuplandings', name='Can create artist shop signup landings', content_type=content_type)
permission = Permission.objects.create(codename='delete_artistshopsignuplandings', name='Can delete artist shop signup landings', content_type=content_type)
permission = Permission.objects.create(codename='change_artistshopsignuplandings', name='Can change artist shop signup landings', content_type=content_type)
# creating and testing permissions and test groups in django tests.
from django.contrib.auth.models import User, Permission, Group
from django.test import TestCase
from django.test import Client
class ExampleGroupPermissionsTests(TestCase):
def setUp(self):
#create permissions group
@treyruncie
treyruncie / videojs thumbnails plug in config object generator
Last active December 21, 2015 12:49
Makes the config object for this videojs plugin from an image node https://github.com/brightcove/videojs-thumbnails.
YUI().use('node', 'event', function (Y) {
var YLang = Y.Lang,
src = 'http://placehold.it/320x90',
img = Y.Node.create('<img src="'+src+'" />'),
cellCount = null,
thumbnails = {},
width = null,
imageWidth = null,
cellWidth = 160,
left, right, leftPos,
Our presenter for September is covering YUI, and is really doing his homework.
Please send responses to Ben Pardo, visaudi@gmail.com If you hit reply, it will go to the entire mailing list.
Ben:
I am giving a talk about YUI for Chicago Javascripters and I am working to determine where YUI is the best solution. I am putting the talk on video, so the highest frequency demands shall be evaluated and studied in different frameworks for this presentation for the benefit of all.
Please feel free to say as much or as little of value as you would like to say, but I am wondering:
YUI().use('app','event-key', function (Y) {
Y.PhotoView = Y.Base.create('photoView', Y.View, [], {
template: '<p><a href="/link_prev" id="previous">prev</a> <a href="/link_next" id="next">next</a> {photo_id} </p>',
render: function () {
this.get('container').setHTML(Y.Lang.sub(this.template, {photo_id: this.get('photo_id')}));
return this;
}
});
@treyruncie
treyruncie / yui3-widget-pattern
Created October 12, 2012 19:56
yui3 widget pattern
YUI.add('mymodule', function (Y) {
Y.Mymodule = Y.Base.create('mymodule', Y.Widget, [], {
initializer: function (config) {
console.log('initializer');
},
renderUI: function (){
console.log('renderUI');
},
bindUI: function (){