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
angular.module('cricketapp', []). | |
config(['$routeProvider', function($routeProvider){ | |
$routeProvider. | |
when('/dashboard', {templateUrl: 'partials/pending-games.html', controller: GameListCtrl}). | |
otherwise({redirectTo: '/'}); | |
}]) | |
//my controller |
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
var skill_sets = { | |
JavaScript : 'ninja!', | |
FrontEnd : ['jQuery', 'AngularJS', 'Not affriad to write plain Javascript', 'html5', 'css3'], | |
Technology : ['ASP MVC3'], | |
Education : ['BS Computer Science'] | |
Experience : ['2+ years', 'worked on a shipped project with a team follow agile/scrum development'] | |
Creativity : 'MUST!!!!' | |
}; | |
var responsibilities = { |
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
#models.py | |
class Player(models.Model): | |
first_name = models.CharField(max_length=32) | |
last_name = models.CharField(max_length=32) | |
team = models.ForeignKey(Team) | |
role = models.ManyToManyField(Roles) | |
preffered_position = models.IntegerField(max_length=3,choices=zip(range(1,12),range(1,12)) , default=1) | |
status = models.BooleanField(default=True) | |
#forms.py |
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
#forms.py | |
def make_innings_form(teamid, fixtureid): | |
class InningsForm(forms.Form): | |
player = forms.ModelChoiceField(PlayerShortlist.objects.filter( | |
team = teamid, | |
fixture = fixtureid | |
) | |
) | |
status = forms.ChoiceField(choices=OUT_CHOICES, initial='DNB') |
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
#views.py | |
def shortlist(request, team_id, fixture_id): | |
template = get_template('cricket/shortlist.html') | |
loggedinuser = request.user | |
userteam = Team.objects.get(owner=loggedinuser) | |
form = ShortlistForm | |
#get the players only belonging to this team_id | |
form.fields['player'].queryset = Player.objects.filter(team=userteam) | |
currentteam = Team.objects.get(id=team_id) |
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
#url.py | |
urlpatterns = patterns('', | |
# Examples: | |
url(r'^$', 'djangocricket.Cricket.views.index', name='default'), | |
url(r'^user/(\w+)/$', 'djangocricket.Cricket.views.user_home', name='user home'), | |
url(r'^login/$', 'django.contrib.auth.views.login'), | |
url(r'^dashboard/$', 'djangocricket.Cricket.views.dashboard'), | |
url(r'^team/(\w+)/$', 'djangocricket.Cricket.views.team'), | |
url(r'^team/(<team_id>\d+)/player/(<player_id>\d+)', 'djangocricket.Cricket.views.player'), |
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
__author__ = 'yousuf jawwad' | |
__adult_supervision__ = 'fahad yousuf' | |
from django.contrib import admin | |
from Cricket.models import Season, League, Team, Fixture, Player, TossResult, InningsCard, BattingDetail | |
from django.http import HttpResponseRedirect | |
from Cricket.fixtures import generate | |
class ButtonableModelAdmin(admin.ModelAdmin): | |
buttons=() |
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 InningsCard(models.Model): | |
fixture = models.ForeignKey(Fixture) | |
team = models.ForeignKey(Team) | |
runs = models.IntegerField(max_length=6, default=0) | |
wickets = models.IntegerField(max_length=6, default=0) | |
overs = models.FloatField(max_length=6, default=0.0) | |
def __unicode__(self): | |
return str(self.team) |
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
__author__ = 'yousuf' | |
from dateutil.rrule import * | |
from dateutil.relativedelta import * | |
import itertools | |
import datetime | |
import random | |
teams = 18 | |
teams = range(1, teams+1) |
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
__author__ = 'yousuf' | |
from League.models import Leagues | |
from League.models import Team | |
from django.contrib import admin | |
class TeamsInLeague(admin.StackedInline): | |
model = Team | |
extra = 1 |