-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes.txt
93 lines (77 loc) · 3.95 KB
/
notes.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
python manage.py collectstatic
python manage.py runserver
python manage.py makemigrations && python manage.py migrate
python manage.py migrate --run-syncdb
python manage.py createsuperuser
python manage.py startapp
email: abhishek@gmail.com
phone number=+91
password=djangoadmin
for sqlite:
python manage.py dbshell
for model:
python manage.py shell
regular queries:
https://medium.com/@singhgautam7/django-annotations-steroids-to-your-querysets-766231f0823a
https://docs.djangoproject.com/en/3.2/ref/models/querysets/#annotate
https://docs.djangoproject.com/en/3.2/topics/db/queries/#
Cart.objects.get(id=1).product.all()
cart_obj=Cart.objects.create(user=User.objects.get(id=2))
cart_obj.product.add(Product.objects.get(id=5))
cart_obj.save()
#take the last cart
Order.objects.get_or_create(user=User.objects.get(email="abhishek@gmail.com")
,cart=Cart.objects.get(user=User.objects.get(email="abhishek@gmail.com"))
,active=True, shipping_cost=100.0,total=125.00
,delivery_address=Address.objects.get(user=User.objects.get(email="abhishek@gmail.com")))
User.objects.create(email="abhi@gmail.com",full_name="abhishek kumar", is_active=True, staff=True, admin=False,phone_number='+917277905904').save()
Product.objects.create(title="Washing2",slug="washing2", description="Washing2",price=50,active=True).save()
https://www.w3docs.com/learn-css/the-ultimate-guide-to-flexbox.html#align-items
https://web.dev/one-line-layouts/
https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child
from order.forms import OrderForm
from account.models import User
from cart.models import Cart
class CommentForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['name'].widget.attrs.update({'class': 'special'})
self.fields['comment'].widget.attrs.update(size='40')
self.fields['user'].queryset=instance.user
# filter has to go always, exception wont be shown
form.fields["user"].queryset = User.objects.filter(email=user_email) # this is lazy evaluated so cannot put objects
form.fields["shipping_cost"].initial = 29
https://simpleisbetterthancomplex.com/questions/2017/03/22/how-to-dynamically-filter-modelchoices-queryset-in-a-modelform.html
form=OrderForm(
initial=model_to_dict(order_obj)
# {
# 'user': User.objects.get(email=user_email),
# 'cart': Cart.objects.filter(user=user_obj).latest('updated_timestamp'),
# }
)
https://docs.djangoproject.com/en/3.2/topics/auth/default/
https://stackoverflow.com/questions/64170442/formview-not-saving-data-in-django
https://docs.djangoproject.com/en/3.2/topics/auth/default/#django.contrib.auth.forms.AuthenticationForm
https://stackoverflow.com/questions/16937581/no-file-was-submitted-check-the-encoding-type-on-the-form
from django.contrib import messages
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Authentication
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.decorators import login_required
from django.conf import settings
@login_required(login_url=settings.LOGIN_URL)
login_url=settings.LOGIN_URL
--react native---
https://www.instamobile.io/react-native-tutorials/react-native-app-ideas-beginners/
https://github.com/ReactNativeNews/React-Native-Apps
https://www.instamobile.io/app-templates/react-native-ecommerce-app-template/
https://github.com/mxck/react-native-material-menu
https://mrousavy.com/react-native-vision-camera/docs/guides/
https://reactnative.directory/
https://callstack.github.io/react-native-paper/getting-started.html
https://materialdesignicons.com/
=> If you wish to uninstall them at a later point (or re-install them under your
=> `nvm` Nodes), you can remove them from the system Node as follows:
$ nvm use system
$ npm uninstall -g a_module
sudo chown -R $(whoami) /usr/local/bin
https://medium.com/djangotube/django-roles-groups-and-permissions-introduction-a54d1070544