Search Results

Search found 6 results on 1 pages for 'shacker'.

Page 1/1 | 1 

  • django-oembed and tinymce

    - by shacker
    I've got django-oembed working fine, e.g. a YouTube URL on a line by itself gets transformed to the correct embed code. Then I added a limited TinyMCE text area. Now that URL on a line by itself gets surrounded in opening and closing html p tags. This breaks oembed - now the URL itself is displayed in the template rather than the embed code. Any reliable fixes or workarounds for this problem?

    Read the article

  • Disabling email-style usernames in Django 1.2 with django-registration

    - by shacker
    Django 1.2 allows usernames to take the form of an email address. Changed in Django 1.2: Usernames may now contain @, +, . and - characters I know that's a much-requested feature, but what if you don't want the new behavior? It makes for messy usernames in profile URLs and seems to break django-registration (if a user registers an account with an email-style username, the link in the django-registration activation email returns 404). Does anyone have a recipe for restoring the old behavior and disabling email-style usernames?

    Read the article

  • Combining regroup with get_foo_display in Django templates

    - by shacker
    I'm using the regroup template tag to group queryset output on a Choices field. In the model: RESOURCE_TYPES = ( ('tut','External tutorial'), ('read','Additional reading'), ('org','Company or organization'), ) restype = models.CharField('Resource type',max_length=6,choices=RESOURCE_TYPES) in the view: resources = Resource.objects.filter(tutorial=tutorial) in the template: {% regroup resources by restype as resource_list %} {% for type in resource_list %} <h3>{{type.grouper}}</h3> So type.grouper renders as 'tut' or 'org' on the page, rather than the long form. Normally you would use the get_foo_display syntax to get at the value of the choice, rather than the key. But the value doesn't seem to be available after going through regroup. There's no way I can find to use get_foo_display on {{type.grouper}}. It makes sense when you think about it, but what's the workaround? Thanks.

    Read the article

  • Overriding the admin Media class

    - by shacker
    Given an admin media class that sets up a rich text editor, like: class TutorialAdmin(admin.ModelAdmin): fields... class Media: js = ['/paths/to/tinymce.js',] I would like the ability to selectively override js depending on a field value in the model it references. I've added a "use_editor" boolean to the Tutorial model. The question is, how can I detect whether the current instance has that bool set? I'd like to end up with something like: class Media: if self.use_editor: js = ['/path/to/tinymce.js',] else: js = '' Ideas? Thanks.

    Read the article

  • bidirectional bubble sort

    - by davit-datuashvili
    Here is the code for shacker sort or bidirectional bubble sort. Something is wrong. Error is java.lang.ArrayIndexOutOfBoundsException Can anybody help me? public class bidirectional{ public static void main(String[]args){ int x[]=new int[]{12,9,4,99,120,1,3,10}; int j; int n=x.length; int st=-1; while (st<n){ st++; n--; for (j=st;j<n;j++){ if (x[j]>x[j+1]){ int t=x[j]; x[j]=x[j+1]; x[j+1]=t; } } for (j=n;--j>=st;){ if (x[j]>x[j+1]){ int t=x[j]; x[j]=x[j+1]; x[j+1]=t; } } } for (int k=0;k<x.length;k++){ System.out.println(x[k]); } } } thanks i have got result thanks guys i have accepted all answers

    Read the article

  • bidirectional buble sort

    - by davit-datuashvili
    Here is the code I'm using for shacker sort (or bidirectional buble sort). Something is wrong; the error is java.lang.ArrayIndexOutOfBoundsException. Can anybody help me? public class bidirectional{ public static void main(String[]args){ int x[]=new int[]{12,9,4,99,120,1,3,10}; int j; int n=x.length; int st=-1; while (st<n){ st++; n--; for (j=st;j<n;j++) { if (x[j]>x[j+1]) { int t=x[j]; x[j]=x[j+1]; x[j+1]=t; } } for (j=n;--j>=st;) { if (x[j]>x[j+1]) { int t=x[j]; x[j]=x[j+1]; x[j+1]=t; } } } for (int k=0;k<x.length;k++) { System.out.println(x[k]); } } }

    Read the article

1