Mathieu Marques

1

votes
1

answer
2.2k

views

TypeError: render_option() argument after * must be a sequence, not int

I am willing to use Django for a school project but I'm encountering several issues. The one I need help for is described in the title. Basically, I have a todo application in which I could add tasks. Now that I added a form in a my view to let the user add a task, I can't access the tasks in the Dj...
Mathieu Marques
1

votes
1

answer
634

views

Where do I initialize my webdriver in Django using Selenium along django.test

I am willing to test my Django application using Selenium. From what I read, Django already cover the testing part and allow you to write your own tests. Willing to use this with Selenium, here is my /test.py: from some.path.to.my.utilitary.module import TestTools class FormTestCase(TestCase): def s...
1

votes
1

answer
71

views

Factoring Django URLs using Python wizardry

Situation I am using a Django plugin, django-ajax-validation, which handle for me the form validation when building AJAX forms with jQuery. Basically, it does what it says. However, now that I am willing to implement more form in my application I need several URL for the AJAX requests. For now my aj...
Mathieu Marques
1

votes
1

answer
94

views

Why does userena.forms.EditProfileForm add 2 extra fields?

I am using django-userena inside a Django 1.5.1 project. I am implementing the user thing of the website, so basically django-userena does it just fine. However I noticed that the EditProfileForm contains 2 extra fields: First name Last name As in the documentation, I used userena.models.UserenaBase...
Mathieu Marques
1

votes
1

answer
323

views

How can I get the user requesting a POST through Tastypie in a custom view

Inside of a Django 1.5.5 project I am trying to allow mobile clients to bet on encounters through the Tastypie's API. After reading POST datas I can then save the Bet object, but I need the User instance for that matter. I know bundle.request.user but this reference isn't available in custom views (...
Mathieu Marques
1

votes
2

answer
301

views

How to filter on 2 attributes at once with Django ORM

I have the following models: class Parent(models.Model): item_involved = models.ManyToManyField(Item, through=ItemInvolved) class ItemInvolved(models.Model): parent = models.ForeignKey(Parent, related_name='item_involvement') item = models.ForeignKey(Item) kind = models.PositiveIntegerField() I want...
Mathieu Marques
1

votes
2

answer
812

views

How do I store a ForeignKey list in a Django model?

I am building a platform where the user can buy players (like in fantasy leagues). So I have 4 models as such : POSITION_CHOICES = ((1,'1'), (2,'2'), (3,'3'), (4,'4'), (5,'5'), ) class Team(models.Model): ... class Player(models.Model): team = models.ForeignKey(Team, blank=True, null=True, ...) posi...
Mathieu Marques
1

votes
1

answer
2.4k

views

How to dynamically toggle the `resizable` boolean in the jQuery UI Layout plugin?

Problem I am using the jQuery UI Layout plugin (layout.jquery-dev.net/index.cfm) in my web application. Using 2 panels only (center and east), I need to dynamically disable the resizable option of the layout. function InitializeLayout(sElement) { var oOptions = { closable: false, resiz...
1

votes
1

answer
89

views

Can I safely assume that Django models IDs are unique upon save()

I need to store matches in my database and those matches already have a unique ID where they come from. For further assistance and referring, it is best for me to keep this ID: match = Match(id=my8digitsid) match.save() However, incoming matches (not played yet) don't have an ID yet. Can I safely sa...
1

votes
3

answer
120

views

What is the good way of writing tons of HTML code with jQuery?

I am writing several HTML forms dynamically with jQuery inside a Django project. This is how I do it right now: function WriteSomeRandomContent() { var sContent = 'foobar'; sContent += ''; sContent += 'Gosh ! This is a lot of HTML content !'; ... sContent += 'For real dude I have to do it within dec...
1

votes
4

answer
103

views

Comments in CSS make it wrong

Situation I recently decided to put comments in my CSS files. And once I did so, one of them stopped working. Both ways of making comments make my entire CSS file not to work. I know this is lacking informations, I just don't know where it could even possibly come from. In case it does matter, this...
Mathieu Marques
6

votes
1

answer
1.6k

views

How to change the character composing the Emacs vertical border?

I am using Emacs 24, console. I am looking for a way to replace the character of the vertical border with another, \u2502. Since I didn't find much, I believe it is hardcoded in the source. Is there any better way to do this, other than recompiling Emacs ? I use many different machines, and thus hav...
Mathieu Marques
4

votes
3

answer
430

views

How to highlight Python modules that are not used in Emacs

Something like 6 months ago, I met a developer who was using Emacs. We were writing Django code and thus Python. There is a feature he has enabled (wrote himself ?) which could highlight the imported modules that were not used. I am willing to have this, unfortunately I didn't find anything related...
Mathieu Marques
4

votes
1

answer
536

views

jQuery Aristo theme removes tooltips' style

Situation I am using Aristo as my jQuery UI theme. It works just fine, but when it comes to display tooltips, they cover 100% of the page width. I don't have this particular issue with other themes. So I inspected Aristo.css in which I didn't find anything related to the tooltip's width unfortunatel...
Mathieu Marques
3

votes
2

answer
832

views

Why does using a variable in settings.ALLOWED_INCLUDE_ROOTS won't let me use {% ssi %}?

Problem I'm using Django 1.3. I will have to use many different JavaScript functions (like 10 or something) in my template. What I first did was to put them in the tag, which worked fine. But now that it works, I want to separate them from the template code. It would make the code way more read'abl...
6

votes
1

answer
2.5k

views

Extra blank lines in a Sphinx unordered list

I am writing documentation for my project using Sphinx and have found a difference in how two similar reStructuredText segements, given below, are rendered. Example 1 Some text: * Item 0 * Item 1 * Item 2 :: Some code Some code Some code Some code .. WARNING:: Some text. * Item 3 Example 2 Some...
Mathieu Marques
2

votes
1

answer
162

views

tastypie - Login from mobile to Django, how do I set up with ApiKeyAuthentication

I've set up Tastypie within a Django project and the API is correctly serving resources. I am now trying to allow mobile users (applications) to sign up, sign in and sign out through said API. class BaseResource(ModelResource): class Meta: allowed_methods = [ 'get' ] authentication = BasicAuthentic...
Mathieu Marques
2

votes
2

answer
62

views

How to center a character that is larger than its container

I have icons that I want centered both horizontally and vertically. See codepen and snippet below: div { border: 1px solid black; } .icon-placeholder { height: 34px; overflow: hidden; width: 34px; } .icon { color: hotpink; font-size: 400%; } .icon::before { content: '+'; } How can I do...
Mathieu Marques
1

votes
1

answer
589

views

How can I have full-height Tabs inside of a Toolbar using material-ui?

I am trying to have a fixed header where on the right side should be tabs. The component is responsible for the responsiveness of the block but doesn't allow for stretched tabs so easily. https://codesandbox.io/s/jv8v6vwqpv
Mathieu Marques
2

votes
2

answer
814

views

How to check whether or not a Django form is correctly bound?

Situation Using Django 1.5, I am using forms.ModelForms to let the user edit database contents. However I can't get the form to update the database upon form.save(). Each of my models correspond to a setting form (the application is a the direct porting of a desktop software in which the user can st...
Mathieu Marques
3

votes
1

answer
659

views

How do I access an array content using {{this}} inside a Handlebars loop?

I am currently using Handlebars to dynamically populate some panels. In one of them, I feel the need of repeating a given task. // Add a looping helper for Handlebars Handlebars.registerHelper('repeat', function(nFrom, nTo, oBlock) { var sResult = ''; for (var i=nFrom; i < nTo+1; i++) sResult += oBl...
Mathieu Marques
3

votes
2

answer
622

views

How to customize a face on Emacs, but only when hl-line is active?

I am using Emacs 24, console (8 colors) with the Solarized theme. I want to make the comments less intrusive using: (set-face-foreground 'font-lock-comment-delimiter-face 'black') (set-face-foreground 'font-lock-comment-face 'black') That way the comments would be colored with the same color as the...
Mathieu Marques
2

votes
0

answer
447

views

Gulp exit in error with Karma tests failing

Fairly new to testing AngularJS applications, I am using a mixture of Gulp (4.0), AngularJS (1.4.5), Karma (0.13.15) and Jasmine (2.3.4) for this project. I'm using OS X (10.11.1). Upon success, the tests run and Gulp exits smoothly $ gulp test-directives [12:56:20] Using gulpfile ~/Workspace/liv/gu...
Mathieu Marques
3

votes
3

answer
1k

views

How does one protect his AJAX views with Django?

I'm using a private view in my Django project for an AJAX request. def HereIsSomeJSON(request, label): if not request.method == 'POST': raise PermissionDenied # Here is the job of my AJAX, basically feeding a JSON json = {...} return HttpResponse(json, 'application/json') Using JavaScript, I request...