Skip to content

Instantly share code, notes, and snippets.

View kracekumar's full-sized avatar

Kracekumar kracekumar

View GitHub Profile
users | CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`first_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`last_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`admin` tinyint(1) DEFAULT NULL,
`student` tinyint(1) DEFAULT NULL,
`employee` tinyint(1) DEFAULT NULL,
`hashed_password` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
class CreateNews < ActiveRecord::Migration
def self.up
create_table :news do |t|
t.string :title
t.text :content
t.references :author
t.timestamps
end
create_table :news_comments do |t|
def admission2
@student = Student.find params[:id], :include => [:guardians]
@guardian = Guardian.new params[:guardian]
@g_u=GuardianUser.new()
@g_u[:guardian_id]=@guardian[:id]
@g_u[:email]=@guardian[:email]
@g_u[:ward_id]=@guardian[:ward_id]
randstr=""
chars=("0".."9").to_a + ("a".."z").to_a + ("A".."Z").to_a
8.times { randstr << chars[rand(chars.size -1)] }
/var/www/admin/app/controllers/student_controller.rb:93:in `size'
/var/www/admin/app/controllers/student_controller.rb:93:in `admission2'
/var/www/admin/app/controllers/student_controller.rb:93:in `times'
/var/www/admin/app/controllers/student_controller.rb:93:in `admission2'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1331:in `send'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1331:in `perform_action_without_filters'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:617:in `call_filters'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `ms'
@kracekumar
kracekumar / models.py
Created March 13, 2011 14:45
same type you have admin.py
from django.db import models
# Create your models here.
class company_list(models.Model):
company_name=models.TextField()
class company_details(models.Model):
company_name=models.ForeignKey(company_list)
phone1=models.IntegerField(max_length=10)
phone2=models.IntegerField(max_length=10)
email=models.EmailField()
kracekumar@kracekumar-laptop:/media/OTHERS/wb development/python/codes/django/codechecker/src/checker/cc_frontend$ python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 4, in <module>
import settings # Assumed to be in the same directory.
File "/media/OTHERS/wb development/python/codes/django/codechecker/src/checker/cc_frontend/settings.py", line 8, in <module>
TIME_ZONE = config.get('django', 'TIME_ZONE')
File "/usr/lib/python2.6/ConfigParser.py", line 531, in get
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'django'
<div id="content-header">
<img src="/images/uploads.png">
<h1>Upload Admission Bulk Details </h1>
<h3>Add Bulk details , download the sample file and edit and Upload </h3>
<div id="app-back-button">
<%= link_to_function image_tag("/images/buttons/back.png",:border => 0), "history.back()" %>
</div>
<% form_for({:action => 'admission'},:multipart=>true) %>
<%= error_message_for 'upload',:header_message=>nil %>
<div id="admission1_form">
class UploadController < ApplicationController
def admission
@all=Upload.get_all
@upload=Upload.new(params[:item])
@upload[:item]+='_'+Time.now.to_s
@upload[:uploaded_at]=Time.now
if @upload.save
flash[:notice]="File uploaded successful,please wait for processing "
else
flash[:notice]="SOmething went wrong "
<div id="content-header">
<img src="/images/manage_news/manage_news_logo.png" />
<h1>School News</h1>
<h3>Latest announcements</h3>
<div id="app-back-button">
<%= link_to_function image_tag("/images/buttons/back.png",:border => 0), "history.back()" %>
</div>
</div>
<div id="page-yield">
class ForumTopicsController < ApplicationController
before_filter :login_required
filter_access_to:all
def add
@forum=ForumTopics.new(params[:forum])
@forum.author=current_user
if request.post? and @forum.save
flash[:notice] = 'Forum Topic Added'
redirect_to :controller => 'forum_topics', :action => 'view', :id =>@forum_topics
end