Debian Codegraph @

allauth/socialaccount/migrations/0001_initial.py

raw
1 from django.conf import settings
2 from django.db import migrations, models
3
4 from allauth import app_settings
5
6
7 class Migration(migrations.Migration):
8 dependencies = (
9 [
10 ("sites", "0001_initial"),
11 ]
12 if app_settings.SITES_ENABLED
13 else []
14 ) + [
15 migrations.swappable_dependency(settings.AUTH_USER_MODEL),
16 ]
17
18 operations = [
19 migrations.CreateModel(
20 name="SocialAccount",
21 fields=[
22 (
23 "id",
24 models.AutoField(
25 verbose_name="ID",
26 serialize=False,
27 auto_created=True,
28 primary_key=True,
29 ),
30 ),
31 (
32 "provider",
33 models.CharField(
34 max_length=30,
35 verbose_name="provider",
36 ),
37 ),
38 (
39 "uid",
40 models.CharField(
41 max_length=getattr(
42 settings, "SOCIALACCOUNT_UID_MAX_LENGTH", 191
43 ),
44 verbose_name="uid",
45 ),
46 ),
47 (
48 "last_login",
49 models.DateTimeField(auto_now=True, verbose_name="last login"),
50 ),
51 (
52 "date_joined",
53 models.DateTimeField(auto_now_add=True, verbose_name="date joined"),
54 ),
55 (
56 "extra_data",
57 models.TextField(default="{}", verbose_name="extra data"),
58 ),
59 (
60 "user",
61 models.ForeignKey(
62 to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE
63 ),
64 ),
65 ],
66 options={
67 "verbose_name": "social account",
68 "verbose_name_plural": "social accounts",
69 },
70 bases=(models.Model,),
71 ),
72 migrations.CreateModel(
73 name="SocialApp",
74 fields=[
75 (
76 "id",
77 models.AutoField(
78 verbose_name="ID",
79 serialize=False,
80 auto_created=True,
81 primary_key=True,
82 ),
83 ),
84 (
85 "provider",
86 models.CharField(
87 max_length=30,
88 verbose_name="provider",
89 ),
90 ),
91 ("name", models.CharField(max_length=40, verbose_name="name")),
92 (
93 "client_id",
94 models.CharField(
95 help_text="App ID, or consumer key",
96 max_length=100,
97 verbose_name="client id",
98 ),
99 ),
100 (
101 "secret",
102 models.CharField(
103 help_text="API secret, client secret, or consumer secret",
104 max_length=100,
105 verbose_name="secret key",
106 ),
107 ),
108 (
109 "key",
110 models.CharField(
111 help_text="Key",
112 max_length=100,
113 verbose_name="key",
114 blank=True,
115 ),
116 ),
117 ]
118 + (
119 [
120 ("sites", models.ManyToManyField(to="sites.Site", blank=True)),
121 ]
122 if app_settings.SITES_ENABLED
123 else []
124 ),
125 options={
126 "verbose_name": "social application",
127 "verbose_name_plural": "social applications",
128 },
129 bases=(models.Model,),
130 ),
131 migrations.CreateModel(
132 name="SocialToken",
133 fields=[
134 (
135 "id",
136 models.AutoField(
137 verbose_name="ID",
138 serialize=False,
139 auto_created=True,
140 primary_key=True,
141 ),
142 ),
143 (
144 "token",
145 models.TextField(
146 help_text='"oauth_token" (OAuth1) or access token (OAuth2)',
147 verbose_name="token",
148 ),
149 ),
150 (
151 "token_secret",
152 models.TextField(
153 help_text='"oauth_token_secret" (OAuth1) or refresh token (OAuth2)',
154 verbose_name="token secret",
155 blank=True,
156 ),
157 ),
158 (
159 "expires_at",
160 models.DateTimeField(
161 null=True, verbose_name="expires at", blank=True
162 ),
163 ),
164 (
165 "account",
166 models.ForeignKey(
167 to="socialaccount.SocialAccount",
168 on_delete=models.CASCADE,
169 ),
170 ),
171 (
172 "app",
173 models.ForeignKey(
174 to="socialaccount.SocialApp", on_delete=models.CASCADE
175 ),
176 ),
177 ],
178 options={
179 "verbose_name": "social application token",
180 "verbose_name_plural": "social application tokens",
181 },
182 bases=(models.Model,),
183 ),
184 migrations.AlterUniqueTogether(
185 name="socialtoken",
186 unique_together={("app", "account")},
187 ),
188 migrations.AlterUniqueTogether(
189 name="socialaccount",
190 unique_together={("provider", "uid")},
191 ),
192 ]