Posts

python - Django ValueError: ModelForm has no model class specified -

i have following code complains following error: valueerror: modelform has no model class specified. from django import forms straightred.models import straightredteam straightred.models import userselection class selecttwoteams1(forms.form): campaignnoquery = userselection.objects.filter(user=349).order_by('-campaignno')[:1] currentcampaignno = campaignnoquery[0].campaignno cantselectteams = userselection.objects.filter(campaignno=currentcampaignno) currentteams = straightredteam.objects.filter(currentteam = 1).exclude(teamid__in=cantselectteams.values_list('teamselectionid', flat=true)) team_one = forms.modelchoicefield(queryset = currentteams) team_two = forms.modelchoicefield(queryset = currentteams) class selecttwoteams(forms.modelform): used_his = forms.modelmultiplechoicefield(queryset=userselection.objects.filter(user__id=1)) def __init__(self, user, *args, **kwargs): super(selecttwoteams, self).__init__(*...

javascript - Controller functions not being called from ng-click link in Angular -

i'm using angular bootstrap calendar custom cell template , cell modifier . in controller, i"m building bunch of tables inside each day cell. of cells have link that, when clicked on, should run function in controller add or delete record on end , change content of cell. here's ui-router definition: $stateprovider .state('home', { url: '/', templateurl: 'views/home.html', }) .state ('calendar', { url : '/calendar', templateurl: 'views/calendar/index.html', controller: 'calendarcontroller', controlleras: 'vm' }); here's relevant controller code: (function() { angular.module('formioappbasic') .controller('calendarcontroller', function($scope, moment, calendarconfig, $http, formio, shiftservice, appconfig, $q) { var vm = this; calendarconfig.templates.calendarmonthcell = 'views/calendar/daytemplate.html'...

ios - Call method in another View Controller, but not segue to it? -

i have tabbed application. tab : download button. tab b : tableview what want when click button in a, want download function in b called. now have several scenarios after click button: stay in a if click b now, can see download process, or if finished, can see file there. +----------------+ +-----------------+ | | |downloaded files | | | +-----------------+ | +------------+ | | | | | download | | +-----------------+ | +------------+ | | | | | | | +-------+--------+ +--------+--------+ |now in | b | | | in | | | | | | b | +-------+--------+ +--------+--------+ now write download function in a, , save files in directory, whenever click tab b, viewwillappear function load downloaded files directory, problem want show download process in case file large. ...

gwt 2.5 - JS functions in GWT -

how use simple js functions in gwt? (picture animation script example) <script type="text/javascript"> var cspeed=4; var cwidth=64; var cheight=64; var ctotalframes=8; var cframewidth=64; var cimagesrc='images/sprites.gif'; var cimagetimeout=false; var cindex=0; var cxpos=0; var cpreloadertimeout=false; var seconds_between_frames=0; function startanimation(){ document.getelementbyid('loaderimage').style.backgroundimage='url('+cimagesrc+')'; document.getelementbyid('loaderimage').style.width=cwidth+'px'; document.getelementbyid('loaderimage').style.height=cheight+'px'; //fps = math.round(100/(maxspeed+2-speed)); fps = math.round(100/cspeed); seconds_between_frames = 1 / fps; cpreloadertimeout=settimeout('continueanimation()', seconds_between_frames/1000); } function continueanimation(){ cxpos += cframewidth; //increase index know frame of our animatio...

Insert text when new related field added filemaker 11 -

i have been tasked adding functionality old filemaker 11 database. i have table portal related field. whenever entry added portal insert text description field prompt users record specific information related portal field. i have set global variables hold required text , in case of normal field quite easy trigger text insert based on value in field. having trouble figuring out how trigger insert text based on values in portal. suggestions? in general, can insert default value field using field's auto-enter options . if want happen upon record's creation, leave do not replace existing value (if any) option checked. i did not understand part: how trigger insert text based on values in portal. you need explain how inserted text should " based on values in portal ".

jquery - turn a curl call into a javascript ajax call -

how turn curl request ajax call in javascript? (an answer in raw js or library fine) curl: curl -h "content-type: application/json" -d '{"foo":0, "bar": 0, "baz":"test"}' -x http://localhost:8080/public/v1/state/helloworld the url tried in ajax call (it gives 404 error): get http://192.168.56.101:8080/public/v1/state/helloworld?foo=0&bar=0&baz=test code return axios.get(switchdomain + '/public/v1/state/helloworld', { params: { foo: 0, bar: 0, baz: "ber", } }) .then(function(response){ console.log('perf response', response); }); seems -d turn curl request post regardless of -x option, so: var req = new xmlhttprequest(); req.open( "post", "http://localhost:8080/public/v1/state/helloworld", true); req.send("foo=0&bar=0&baz=test"); eventually may need add content-type header after req.open , b...

What html tags are not affected by same origin policy? -

i have read this page same origin policy regarding script tag. situation is: have 2 domain manage (host differently) , need share (actually lot) resources (particularly js, css , media). ask whether following tags affected or not affected if source domain: <script> <img> <audio> <link rel="stylesheet"> (possibly <video>) from page linked above, seems can wrote html domain b can have <script> tags directly link domain a, cannot css. correct? must copy css file of domain domain b if want use them? you can include external css same way include js ! do in head section: <link rel="stylesheet" type="text/css" href="your_file_name.css">