Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,180 --> 00:00:04,770
So the last model is this tag model.
2
00:00:04,770 --> 00:00:07,210
And the relation related to that
3
00:00:07,210 --> 00:00:09,210
is the many to many relation.
4
00:00:09,210 --> 00:00:10,760
So let's add that.
5
00:00:10,760 --> 00:00:13,810
The model of course is fairly trivial.
6
00:00:13,810 --> 00:00:16,430
I'll just add a new class here and name it tag
7
00:00:16,430 --> 00:00:20,370
and extend models.Model.
8
00:00:20,370 --> 00:00:23,360
And in there, all I want to have is this caption field
9
00:00:23,360 --> 00:00:25,030
which is a simple char field,
10
00:00:25,030 --> 00:00:27,590
because it should just be some short text.
11
00:00:27,590 --> 00:00:32,083
So let's say not longer than maybe 20 characters.
12
00:00:34,310 --> 00:00:36,950
But now I also want to set up a relation,
13
00:00:36,950 --> 00:00:39,140
a many to many relation.
14
00:00:39,140 --> 00:00:41,750
And we could add the relation on both the tag
15
00:00:41,750 --> 00:00:44,280
and the post, but for me here, it makes more sense
16
00:00:44,280 --> 00:00:47,490
to see that from the posts perspective.
17
00:00:47,490 --> 00:00:50,587
So here I will add tags and set this
18
00:00:50,587 --> 00:00:53,377
= models.ManyToManyField.
19
00:00:54,280 --> 00:00:56,840
And then parse the tag clause
20
00:00:56,840 --> 00:00:59,763
as a value to many to many field.
21
00:01:01,370 --> 00:01:03,330
And that is all we need to do here.
22
00:01:03,330 --> 00:01:06,563
That allows us to set up a many to many relation.
23
00:01:07,840 --> 00:01:10,820
So now these posts are all set up,
24
00:01:10,820 --> 00:01:14,420
before we now make the migrations and run the migrations,
25
00:01:14,420 --> 00:01:17,720
I want to register them all for my admin panel
26
00:01:17,720 --> 00:01:20,363
to make sure that we also can use Stat Suite.
1990
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.