Django project model design
1
Name:
Anonymous
2008-06-11 17:11
I'm designing a simple text-based game with Django, and I came up with this model for messages sent to/from players.
class Message(models.Model):
sender = models.ForeignKey(Player, related_name='sent_message')
receiver = models.ForeignKey(Player, related_name='received_message')
subject = models.CharField(max_length=80)
body = models.TextField()
date = models.DateTimeField()
I'm not sure why "related_name" is needed; can /prog/ explain, and share their thoughts on this model?
2
Name:
Anonymous
2008-06-11 17:17
I thought you came up with the model?
3
Name:
Anonymous
2008-06-11 17:22
I did, but Django bitched about not having "related_name" for the sender/receiver, which I'd never seen before, so I just put in that.
4
Name:
Anonymous
2008-06-11 17:24
http://www.djangoproject.com/documentation/db-api/#related-objects
If you're not willing to actually learn Django in the process, what's the point?
5
Name:
Anonymous
2008-06-11 17:35
>>4
Whoa, thanks, I get it now.
6
Name:
Anonymous
2008-06-12 1:44
7
Name:
Anonymous
2008-06-12 1:51
Posting in a thread likely to be read by an internet celebrity.
8
Name:
Anonymous
2008-06-12 3:55
Hahaha. Shit me, awesome.
http://www.imageput.com/hosted/19679holyshit.png
Where did this syntax highlighting come from? Firefox 3.0?
<code><br/>
class Message(models.Model):<br/>
sender = models.ForeignKey(Player, related_name='sent_message')<br/>
receiver = models.ForeignKey(Player, related_name='received_message')<br/>
subject = models.CharField(max_length=80)<br/>
body = models.TextField()<br/>
date = models.DateTimeField()</code>
Fuck yeah! It's highlighting <code> tags. Why was I not informed?
I wonder how it detects the language used. Probably falls back to "highlight strings and numbers".
9
Name:
Anonymous
2008-06-12 3:57
>>8
Ohhh. It's a /prog/ script. Fantastic!
10
Name:
Anonymous
2008-06-12 3:59
http://dis.4chan.org/script/prettify.js
zomg added in my browser as a global script
11
Name:
Anonymous
2008-06-12 4:01
test = do
x <- (+5) <$> getTime
y <- (+10) <$> getTime
let list = zip [x, y] [print "apa", print "bepa"]
forM_ list $ \(t, f) -> do
now <- getTime
print . unwords . map show $ [x, y, now, t]
sleep . fromIntegral $ t - now
f
print =<< getTime
12
Name:
Mr VacBob
2008-06-12 4:06
(capped)
the syntax highlighter is pretty generic but expects C-like languages, if you know of one that does clisp/scheme/haskell better point it out (or send a patch to
http://code.google.com/p/google-code-prettify/ ).
13
Name:
Anonymous
2008-06-12 4:09
Hmm.
(define (foo x y)
(let ((a 1)
(b 2))
(if (= a x)
(print a)
(print y))))
14
Name:
Anonymous
2008-06-12 4:13
>>13
not bad really. just needs LET, DEFINE, etc. probably doesn't do quotes well.
(eval '(hai guyz))
15
Name:
Anonymous
2008-06-12 4:15
pity it doesn't support [code lang="whatever"][/code] , but n/m.
let's see what we can do here for lisp...
16
Name:
Anonymous
2008-06-12 4:47
meh I can't be bothered reading through this javascript code
17
Name:
Anonymous
2008-06-12 5:15
>>12
Y HALO THAR!
Good to see some familiar guys lurking /prog/
18
Name:
Anonymous
2008-06-12 7:37
>>14
Then use (eval (quote (hai guyz)))
19
Name:
Anonymous
2008-06-12 7:49
(eval `(hai guyz))
20
Name:
Anonymous
2008-06-12 8:31
>>18
lol yeah cause I write scheme code just for /prog/
21
Name:
Anonymous
2008-06-12 9:48
I'd rather see VacBob-sama ban all of these anus haxers.
22
Name:
Anonymous
2008-06-12 11:07
I'd rather see bob sakamato
23
Name:
Anonymous
2008-06-12 12:08
>>21
That's
Mr VacBob
-sama to you, cretin.
24
Name:
Anonymous
2008-06-12 12:31
25
Name:
Anonymous
2008-06-12 12:51
*grabs dick*
26
Name:
Anonymous
2008-06-12 16:26
>>17,21,23
Boot-licking fags.
27
Name:
Anonymous
2008-06-12 16:47
>>20
Erm... Why are you using that syntactic sugar anyway?
(quote) is much nicer.
28
Name:
Anonymous
2008-06-12 18:58
>>27
Erm... I disagree. The syntactic sugar for QUOTE is better than writing it explicitly.
29
Name:
Anonymous
2008-06-12 19:01
>>27 probably prefers
call-with-current-continuation to
call/cc.
30
Name:
Anonymous
2008-06-12 19:20
>>29
I'm not
>>27 but I do. If the length bothers you, you probably use it too much.
31
Name:
Anonymous
2008-06-12 19:21
>>30
THAT'S WHAT YOUR MOTHER SAID
32
Name:
Anonymous
2008-06-12 19:21
33
Name:
Anonymous
2008-06-12 19:22
I SAID THAT TO YOUR MOTHER. ABOUT MY PENIS
34
Name:
Anonymous
2008-06-12 19:58
>>33
Stop trying to salvage the joke. It's dead, Jim.
35
Name:
Anonymous
2008-06-12 21:42
>>34
THAT'S WHAT YOUR MOTHER SAID
36
Name:
Anonymous
2008-06-12 22:57
37
Name:
Anonymous
2008-06-13 5:19
>>34
I wish. It's machine code. It can never die.
38
Name:
Anonymous
2008-06-13 9:58
>>30
No, if the length bothers you, you have to change your text editor.
39
Name:
Anonymous
2008-06-13 11:34
>>38
Wise words from a wise dipshit.
40
Name:
Anonymous
2008-06-13 14:14
>>39
Learn English.
dipshitusually vulgar : a stupid or incompetent person wisecharacterized by wisdom : marked by deep understanding, keen discernment, and a capacity for sound judgment
41
Name:
Anonymous
2008-06-13 14:46
42
Name:
Anonymous
2008-06-13 18:40
43
Name:
Anonymous
2009-02-25 7:32
An to never get payed for programming a user interface is split into input and output frames this distinction would be more of us will be retarded enough to believe he is a real boy as far as I can type at least the poll will only affect a relatively small and therefore very cacheable table assuming the things you need the chilkat module to use it instead of something completely different to traditional Unix Linux is and is that you can learn about doing.
44
Name:
Anonymous
2010-11-27 1:05
45
Name:
Anonymous
2010-11-27 22:02