-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGuide.txt
74 lines (54 loc) · 2.04 KB
/
Guide.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
python -m venv venv
python -m pip install --upgrade pip
pip install -r requirements.txt
python -m pytest
source venv/scripts/activate
./manage.py oscar_fork_app users_dashboard apps ex of how to fork a subapp
How to fork apps in oscar
./manage.py oscar_fork_app customer apps
then replace the oscar app in the [installed] setting in Settings.py with the GrandMarket version
Git guide for commit
1.git branch -M main
2.git commit -m "first commit"
3.git push -u origin main
How to use oscar custom loader
Example = get_model('Appname', 'Name of the model')
for pytest
export DJANGO_SETTINGS_MODULE=src.settings
to be added in later
"""'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': env('api_db'),
'USER': env('api_user'),
'PASSWORD': env('api_pwd'),
'HOST': env('host'),
'PORT': env('port'),
}"""
what is wrong with the reverse for this view
class StoreCreateView(CreateView):
model = Partner
template_name = 'oscar/store/store_update.html'
form_class = NewPartner
success_url = reverse_lazy('partner:user-update')
def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs)
ctx['title'] = _('Create new partner')
return ctx
def get_success_url(self):
messages.success(self.request,
_("Store '%s' was created successfully.") %
self.object.name)
return reverse('partner:user-update')
def form_invalid(self, form):
messages.error(
self.request,
"Your submitted data was not valid - please correct the below errors")
return super().form_invalid(form)
def form_valid(self, form):
form.instance.user = self.request.user
return super().form_valid(form)
def get_form_kwargs(self):
kwargs = super().get_form_kwargs()
kwargs['user'] = self.request.user
return kwargs
path('store/<int:partner_pk>/user/<int:user_pk>/update/', self.store_user_update_view.as_view(), name='user-update'),